mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-14 11:30:18 +00:00
deps: bump simplexmq for multi-link NameRecord; adapt consumers
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ constraints: zip +disable-bzip2 +disable-zstd
|
||||
source-repository-package
|
||||
type: git
|
||||
location: https://github.com/simplex-chat/simplexmq.git
|
||||
tag: 92b3d0492c5cf7730642774f925b6c1d61f04f54
|
||||
tag: f555e9af813a4ff6249911ef04da92db3618f2e8
|
||||
|
||||
source-repository-package
|
||||
type: git
|
||||
|
||||
@@ -4728,16 +4728,18 @@ dispatchResolvedRecord cxt nm user ni@SimplexNameInfo {nameType} NameRecord {nrS
|
||||
CSLInvitation _ srv lnkId linkKey -> CSLInvitation SLSServer srv lnkId linkKey
|
||||
CSLContact _ ct srv linkKey -> CSLContact SLSServer ct srv linkKey
|
||||
|
||||
-- | Pick the link from the @NameRecord@ matching the queried name type.
|
||||
-- A missing per-type field (record exists but advertises no link of this kind)
|
||||
-- is treated as "not found" — same UX as a local-store miss. The text fields
|
||||
-- on 'NameRecord' use the empty string as the absent sentinel.
|
||||
firstNameLink :: SimplexNameType -> Text -> Text -> SimplexNameInfo -> Either ChatError Text
|
||||
firstNameLink nameType simplexChannel simplexContact ni
|
||||
| T.null link = Left $ ChatError $ CESimplexNameNotFound ni
|
||||
| otherwise = Right link
|
||||
-- | Pick the primary link from the @NameRecord@ matching the queried name type.
|
||||
-- Each per-type field is a list of links (primary first, fallbacks after); the
|
||||
-- prepare flow uses the first non-empty entry. An empty list (record exists but
|
||||
-- advertises no link of this kind) is treated as "not found" — same UX as a
|
||||
-- local-store miss.
|
||||
firstNameLink :: SimplexNameType -> [Text] -> [Text] -> SimplexNameInfo -> Either ChatError Text
|
||||
firstNameLink nameType simplexChannel simplexContact ni =
|
||||
case filter (not . T.null) links of
|
||||
lnk : _ -> Right lnk
|
||||
[] -> Left $ ChatError $ CESimplexNameNotFound ni
|
||||
where
|
||||
link = case nameType of
|
||||
links = case nameType of
|
||||
NTPublicGroup -> simplexChannel
|
||||
NTContact -> simplexContact
|
||||
|
||||
@@ -4785,10 +4787,12 @@ apiVerifySimplexName user chatRef = do
|
||||
nameType' = (\SimplexNameInfo {nameType} -> nameType) claim
|
||||
resolveOnUserServers user domain >>= \case
|
||||
Right NameRecord {nrSimplexContact, nrSimplexChannel} -> do
|
||||
let resolvedLink = case nameType' of
|
||||
let resolvedLinks = case nameType' of
|
||||
NTContact -> nrSimplexContact
|
||||
NTPublicGroup -> nrSimplexChannel
|
||||
if not (T.null resolvedLink) && linksMatch resolvedLink storedLink
|
||||
-- The peer's stored link verifies if it matches ANY advertised link
|
||||
-- (primary or fallback); an empty list never matches.
|
||||
if any (`linksMatch` storedLink) resolvedLinks
|
||||
then do
|
||||
ts <- liftIO getCurrentTime
|
||||
withStore' $ \db -> persistVerified db ts
|
||||
|
||||
Reference in New Issue
Block a user