reuse existing types

This commit is contained in:
Alain Brenzikofer
2026-09-23 10:11:05 +02:00
parent 9d2c8368b0
commit d35aef85c9
3 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ constraints: zip +disable-bzip2 +disable-zstd
source-repository-package
type: git
location: https://github.com/simplex-chat/simplexmq.git
tag: 1d82c0815dcf005f4bbb84c307bae13cb51cdd6b
tag: 78ebf1cb2eae5c5012829336e4df1b25e8314551
source-repository-package
type: git
+1 -1
View File
@@ -1,5 +1,5 @@
{
"https://github.com/simplex-chat/simplexmq.git"."1d82c0815dcf005f4bbb84c307bae13cb51cdd6b" = "0mhdwzqcsm6mw55j68xv68g61awf33wl39slk5mr5jxsrlph66yx";
"https://github.com/simplex-chat/simplexmq.git"."78ebf1cb2eae5c5012829336e4df1b25e8314551" = "0x1asli9d70p3ywzxy4r442sqn3dlif1i5a8lnk9k55qc79hr1c8";
"https://github.com/simplex-chat/hs-socks.git"."a30cc7a79a08d8108316094f8f2f82a0c5e1ac51" = "0yasvnr7g91k76mjkamvzab2kvlb1g5pspjyjn2fr6v83swjhj38";
"https://github.com/simplex-chat/direct-sqlcipher.git"."f814ee68b16a9447fbb467ccc8f29bdd3546bfd9" = "1ql13f4kfwkbaq7nygkxgw84213i0zm7c1a8hwvramayxl38dq5d";
"https://github.com/simplex-chat/sqlcipher-simple.git"."a46bd361a19376c5211f1058908fc0ae6bf42446" = "1z0r78d8f0812kxbgsm735qf6xx8lvaz27k1a0b4a2m0sshpd5gl";
+2 -3
View File
@@ -27,10 +27,9 @@ import Network.HTTP.Types (hContentType, notFound404, ok200)
import Network.Wai (Application, pathInfo, responseLBS)
import qualified Network.Wai.Handler.Warp as Warp
import Simplex.Messaging.Encoding.String (strEncode)
import Simplex.Messaging.Names.Record (NamePricing (..), NameRecord (..), NameRegistration (..), NameResponse (..), OwnedName (..), OwnedNames (..), USDCents (..))
import Simplex.Messaging.Names.Record (NamePricing (..), NameRecord (..), NameRegistration (..), NameResponse (..), OwnedNames (..), USDCents (..))
import Simplex.Messaging.Server.Names (NamesConfig (..))
import Simplex.Messaging.SimplexName (SimplexDomain (..), SimplexNameInfo (..), labelHash)
import Simplex.Messaging.SystemTime (RoundedSystemTime (..))
type NameRegistry = TVar (Map Text NameRecord)
@@ -53,7 +52,7 @@ withNameResolver action = do
nameResponse Nothing = NameResponse {lastBlockTs = Nothing, registration = NRAvailable {pricing = NamePricing {registrationPrices = M.empty, basePrice = USDCents 1000, minLabelLength = 1}}}
-- an account is in use when it owns a name, the only thing this resolver knows about
ownedNames addr rs =
let ns = [OwnedName {onName = Just nrName, onLabelhash = "", onExpires = RoundedSystemTime 0, onStatus = "registered"} | NameRecord {nrName, nrOwner} <- rs, nrOwner == addr]
let ns = [nameResponse (Just r) | r@NameRecord {nrOwner} <- rs, nrOwner == addr]
in OwnedNames {ownNames = ns, ownInUse = not (null ns), ownNextOffset = Nothing}
-- | Register a name's domain to resolve to the given record.