From 4fb1c173ecac5acc4e264f3b77ef4031724dbcee Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Sun, 22 Nov 2026 13:02:55 +0000 Subject: [PATCH] agent, servers: short links of public groups and sites --- .../static/.well-known/apple-app-site-association | 12 ++++++++++++ apps/common/Web/static/link.html | 4 ++++ apps/smp-server/SMPWeb.hs | 2 +- src/Simplex/Messaging/Agent/Protocol.hs | 6 +++++- tests/AgentTests/ConnectionRequestTests.hs | 4 ++++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/apps/common/Web/static/.well-known/apple-app-site-association b/apps/common/Web/static/.well-known/apple-app-site-association index 3b513fe61e..3fb42d0b0d 100644 --- a/apps/common/Web/static/.well-known/apple-app-site-association +++ b/apps/common/Web/static/.well-known/apple-app-site-association @@ -41,6 +41,18 @@ }, { "/": "/i" + }, + { + "/": "/p/*" + }, + { + "/": "/p" + }, + { + "/": "/s/*" + }, + { + "/": "/s" } ] } diff --git a/apps/common/Web/static/link.html b/apps/common/Web/static/link.html index 396f3dc12f..6e2faafbfc 100644 --- a/apps/common/Web/static/link.html +++ b/apps/common/Web/static/link.html @@ -514,6 +514,10 @@

If you already installed SimpleX Chat for the term element.innerHTML = 'This is a public channel address on SimpleX network' } else if (url.includes('/r')) { element.innerHTML = 'This is a chat relay address on SimpleX network' + } else if (url.includes('/p')) { + element.innerHTML = 'This is a public group address on SimpleX network' + } else if (url.includes('/s')) { + element.innerHTML = 'This is a site address on SimpleX network' } } diff --git a/apps/smp-server/SMPWeb.hs b/apps/smp-server/SMPWeb.hs index 9a449e80b6..b819682b40 100644 --- a/apps/smp-server/SMPWeb.hs +++ b/apps/smp-server/SMPWeb.hs @@ -21,7 +21,7 @@ smpGenerateSite si onionHost path = Web.generateSite embeddedContent (serverInformation si onionHost) smpLinkPages path smpLinkPages :: [String] -smpLinkPages = ["contact", "invitation", "a", "c", "g", "r", "i"] +smpLinkPages = ["contact", "invitation", "a", "c", "g", "r", "i", "p", "s"] serverInformation :: ServerInformation -> Maybe TransportHost -> ByteString serverInformation ServerInformation {config, information} onionHost = render (Web.indexHtml embeddedContent) substs diff --git a/src/Simplex/Messaging/Agent/Protocol.hs b/src/Simplex/Messaging/Agent/Protocol.hs index 1d28db0064..e1813ac769 100644 --- a/src/Simplex/Messaging/Agent/Protocol.hs +++ b/src/Simplex/Messaging/Agent/Protocol.hs @@ -1664,7 +1664,7 @@ instance ConnectionModeI c => ToField (ConnShortLink c) where toField = toField instance (Typeable c, ConnectionModeI c) => FromField (ConnShortLink c) where fromField = blobFieldDecoder strDecode -data ContactConnType = CCTContact | CCTChannel | CCTGroup | CCTRelay deriving (Eq, Show) +data ContactConnType = CCTContact | CCTChannel | CCTGroup | CCTRelay | CCTPublicGroup | CCTSite deriving (Eq, Show) data AConnShortLink = forall m. ConnectionModeI m => ACSL (SConnectionMode m) (ConnShortLink m) @@ -1813,6 +1813,8 @@ ctTypeP = \case 'C' -> pure CCTChannel 'G' -> pure CCTGroup 'R' -> pure CCTRelay + 'P' -> pure CCTPublicGroup + 'S' -> pure CCTSite _ -> fail "unknown contact address type" {-# INLINE ctTypeP #-} @@ -1822,6 +1824,8 @@ ctTypeChar = \case CCTChannel -> 'C' CCTGroup -> 'G' CCTRelay -> 'R' + CCTPublicGroup -> 'P' + CCTSite -> 'S' {-# INLINE ctTypeChar #-} instance StrEncoding ContactConnType where diff --git a/tests/AgentTests/ConnectionRequestTests.hs b/tests/AgentTests/ConnectionRequestTests.hs index 40ca12cf95..2f0b469180 100644 --- a/tests/AgentTests/ConnectionRequestTests.hs +++ b/tests/AgentTests/ConnectionRequestTests.hs @@ -320,11 +320,15 @@ connectionRequestTests = CSLContact SLSServer CCTContact srv (LinkKey "0123456789abcdef0123456789abcdef") #==# "https://smp.simplex.im/a#MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY?h=jjbyvoemxysm7qxap7m5d5m35jzv5qq6gnlv7s4rsn7tdwwmuqciwpid.onion&p=5223&c=1234-w" CSLContact SLSServer CCTGroup srv (LinkKey "0123456789abcdef0123456789abcdef") #==# "https://smp.simplex.im/g#MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY?h=jjbyvoemxysm7qxap7m5d5m35jzv5qq6gnlv7s4rsn7tdwwmuqciwpid.onion&p=5223&c=1234-w" CSLContact SLSServer CCTContact shortSrv (LinkKey "0123456789abcdef0123456789abcdef") #==# "https://smp.simplex.im/a#MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY" + CSLContact SLSServer CCTPublicGroup shortSrv (LinkKey "0123456789abcdef0123456789abcdef") #==# "https://smp.simplex.im/p#MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY" + CSLContact SLSServer CCTSite shortSrv (LinkKey "0123456789abcdef0123456789abcdef") #==# "https://smp.simplex.im/s#MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY" CSLInvitation SLSServer srv (EntityId "0123456789abcdef01234567") (LinkKey "0123456789abcdef0123456789abcdef") #==# "https://smp.simplex.im/i#MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3/MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY?h=jjbyvoemxysm7qxap7m5d5m35jzv5qq6gnlv7s4rsn7tdwwmuqciwpid.onion&p=5223&c=1234-w" CSLInvitation SLSServer shortSrv (EntityId "0123456789abcdef01234567") (LinkKey "0123456789abcdef0123456789abcdef") #==# "https://smp.simplex.im/i#MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3/MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY" CSLContact SLSSimplex CCTContact srv (LinkKey "0123456789abcdef0123456789abcdef") #==# "simplex:/a#MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY?h=smp.simplex.im%2Cjjbyvoemxysm7qxap7m5d5m35jzv5qq6gnlv7s4rsn7tdwwmuqciwpid.onion&p=5223&c=1234-w" CSLContact SLSSimplex CCTGroup srv (LinkKey "0123456789abcdef0123456789abcdef") #==# "simplex:/g#MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY?h=smp.simplex.im%2Cjjbyvoemxysm7qxap7m5d5m35jzv5qq6gnlv7s4rsn7tdwwmuqciwpid.onion&p=5223&c=1234-w" CSLContact SLSSimplex CCTContact shortSrv (LinkKey "0123456789abcdef0123456789abcdef") #==# "simplex:/a#MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY?h=smp.simplex.im" + CSLContact SLSSimplex CCTPublicGroup shortSrv (LinkKey "0123456789abcdef0123456789abcdef") #==# "simplex:/p#MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY?h=smp.simplex.im" + CSLContact SLSSimplex CCTSite shortSrv (LinkKey "0123456789abcdef0123456789abcdef") #==# "simplex:/s#MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY?h=smp.simplex.im" CSLInvitation SLSSimplex srv (EntityId "0123456789abcdef01234567") (LinkKey "0123456789abcdef0123456789abcdef") #==# "simplex:/i#MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3/MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY?h=smp.simplex.im%2Cjjbyvoemxysm7qxap7m5d5m35jzv5qq6gnlv7s4rsn7tdwwmuqciwpid.onion&p=5223&c=1234-w" CSLInvitation SLSSimplex shortSrv (EntityId "0123456789abcdef01234567") (LinkKey "0123456789abcdef0123456789abcdef") #==# "simplex:/i#MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3/MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY?h=smp.simplex.im" it "should shorten / restore short links" $ do