core: use NTF scheme for notification server address (#774)

* core: use NTF scheme for notification server address

* simplexmq
This commit is contained in:
Evgeny Poberezkin
2022-07-06 08:46:04 +01:00
committed by GitHub
parent 65fae747c3
commit 111acb0813
6 changed files with 10 additions and 14 deletions

View File

@@ -5,7 +5,7 @@ constraints: zip +disable-bzip2 +disable-zstd
source-repository-package
type: git
location: https://github.com/simplex-chat/simplexmq.git
tag: 4c0164c49effe8d1b3fd98aca184245a8b4cac93
tag: abd694bd5af57b596f48214fe3c0d0e8982fc793
source-repository-package
type: git

View File

@@ -1,5 +1,5 @@
{
"https://github.com/simplex-chat/simplexmq.git"."4c0164c49effe8d1b3fd98aca184245a8b4cac93" = "1ni3phxal10rfrkgnhcih3ksh7nfnj5b7vkk0qs9k52hmc8g306b";
"https://github.com/simplex-chat/simplexmq.git"."abd694bd5af57b596f48214fe3c0d0e8982fc793" = "0j8m4hcms8ffkbpspds8crvcs1gslgrk4xqp6xvgb0hhv499541n";
"https://github.com/simplex-chat/aeson.git"."3eb66f9a68f103b5f1489382aad89f5712a64db7" = "0kilkx59fl6c3qy3kjczqvm8c3f4n3p0bdk9biyflf51ljnzp4yp";
"https://github.com/simplex-chat/haskell-terminal.git"."f708b00009b54890172068f168bf98508ffcd495" = "0zmq7lmfsk8m340g47g5963yba7i88n4afa6z93sg9px5jv1mijj";
"https://github.com/zw3rk/android-support.git"."3c3a5ab0b8b137a072c98d3d0937cbdc96918ddb" = "1r6jyxbim3dsvrmakqfyxbd6ms6miaghpbwyl0sr6dzwpgaprz97";

View File

@@ -5,6 +5,7 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
@@ -60,9 +61,8 @@ import Simplex.Messaging.Agent.Protocol
import qualified Simplex.Messaging.Crypto as C
import Simplex.Messaging.Encoding
import Simplex.Messaging.Encoding.String
import Simplex.Messaging.Notifications.Types (NtfServer)
import Simplex.Messaging.Parsers (base64P, parseAll)
import Simplex.Messaging.Protocol (ErrorType (..), MsgBody, MsgFlags (..))
import Simplex.Messaging.Protocol (ErrorType (..), MsgBody, MsgFlags (..), NtfServer)
import qualified Simplex.Messaging.Protocol as SMP
import qualified Simplex.Messaging.TMap as TM
import Simplex.Messaging.Util (ifM, liftEitherError, tryError, unlessM, whenM, (<$?>))
@@ -104,7 +104,7 @@ _defaultSMPServers =
]
_defaultNtfServers :: [NtfServer]
_defaultNtfServers = ["smp://FB-Uop7RTaZZEG0ZLD2CIaTjsPh-Fw0zFAnb7QyA8Ks=@ntf2.simplex.im"]
_defaultNtfServers = ["ntf://FB-Uop7RTaZZEG0ZLD2CIaTjsPh-Fw0zFAnb7QyA8Ks=@ntf2.simplex.im"]
maxImageSize :: Integer
maxImageSize = 236700
@@ -1126,7 +1126,7 @@ processAgentMessage (Just User {userId}) "" agentMessage = case agentMessage of
SUSPENDED -> toView CRChatSuspended
_ -> pure ()
where
serverEvent srv@SMP.ProtocolServer {host, port} conns event str = do
serverEvent srv@(SMPServer host port _) conns event str = do
cs <- withStore' $ \db -> getConnectionsContacts db userId conns
toView $ event srv cs
showToast ("server " <> str) (safeDecodeUtf8 . strEncode $ SrvLoc host port)

View File

@@ -49,7 +49,7 @@ extra-deps:
# - simplexmq-1.0.0@sha256:34b2004728ae396e3ae449cd090ba7410781e2b3cefc59259915f4ca5daa9ea8,8561
# - ../simplexmq
- github: simplex-chat/simplexmq
commit: 4c0164c49effe8d1b3fd98aca184245a8b4cac93
commit: abd694bd5af57b596f48214fe3c0d0e8982fc793
# - terminal-0.2.0.0@sha256:de6770ecaae3197c66ac1f0db5a80cf5a5b1d3b64a66a05b50f442de5ad39570,2977
- github: simplex-chat/aeson
commit: 3eb66f9a68f103b5f1489382aad89f5712a64db7

View File

@@ -274,6 +274,7 @@ serverCfg =
certificateFile = "tests/fixtures/tls/server.crt",
logStatsInterval = Just 86400,
logStatsStartTime = 0,
serverStatsFile = Nothing,
smpServerVRange = supportedSMPServerVRange
}

View File

@@ -15,7 +15,7 @@ import qualified Simplex.Messaging.Crypto as C
import Simplex.Messaging.Crypto.Ratchet
import Simplex.Messaging.Encoding.String
import Simplex.Messaging.Parsers (parseAll)
import Simplex.Messaging.Protocol (ProtocolServer (..), smpClientVRange)
import Simplex.Messaging.Protocol (smpClientVRange)
import Simplex.Messaging.Version
import Test.Hspec
@@ -23,12 +23,7 @@ protocolTests :: Spec
protocolTests = decodeChatMessageTest
srv :: SMPServer
srv =
ProtocolServer
{ host = "smp.simplex.im",
port = "5223",
keyHash = C.KeyHash "\215m\248\251"
}
srv = SMPServer "smp.simplex.im" "5223" (C.KeyHash "\215m\248\251")
queue :: SMPQueueUri
queue =