From 89140e0ff05e8a3ab7a1fdcc19c55eb0d54e2163 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sun, 18 Feb 2024 08:56:35 +0000 Subject: [PATCH] use package version for all servers (#1001) --- src/Simplex/FileTransfer/Server/Main.hs | 6 ++---- src/Simplex/Messaging/Notifications/Server/Main.hs | 6 ++---- tests/CLITests.hs | 6 +++--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/Simplex/FileTransfer/Server/Main.hs b/src/Simplex/FileTransfer/Server/Main.hs index 33975298e..4533fbe8c 100644 --- a/src/Simplex/FileTransfer/Server/Main.hs +++ b/src/Simplex/FileTransfer/Server/Main.hs @@ -25,6 +25,7 @@ import Simplex.Messaging.Encoding.String import Simplex.Messaging.Protocol (ProtoServerWithAuth (..), pattern XFTPServer) import Simplex.Messaging.Server.CLI import Simplex.Messaging.Server.Expiration +import Simplex.Messaging.Transport (simplexMQVersion) import Simplex.Messaging.Transport.Client (TransportHost (..)) import Simplex.Messaging.Transport.Server (TransportServerConfig (..), defaultTransportServerConfig) import System.Directory (createDirectoryIfMissing, doesFileExist) @@ -32,9 +33,6 @@ import System.FilePath (combine) import System.IO (BufferMode (..), hSetBuffering, stderr, stdout) import Text.Read (readMaybe) -xftpServerVersion :: String -xftpServerVersion = "1.2.3.0" - xftpServerCLI :: FilePath -> FilePath -> IO () xftpServerCLI cfgPath logPath = do getCliCommand' (cliCommandP cfgPath logPath iniFile) serverVersion >>= \case @@ -57,7 +55,7 @@ xftpServerCLI cfgPath logPath = do putStrLn "Deleted configuration and log files" where iniFile = combine cfgPath "file-server.ini" - serverVersion = "SimpleX XFTP server v" <> xftpServerVersion + serverVersion = "SimpleX XFTP server v" <> simplexMQVersion defaultServerPort = "443" executableName = "file-server" storeLogFilePath = combine logPath "file-server-store.log" diff --git a/src/Simplex/Messaging/Notifications/Server/Main.hs b/src/Simplex/Messaging/Notifications/Server/Main.hs index bb10d8e3e..2f6ee7e29 100644 --- a/src/Simplex/Messaging/Notifications/Server/Main.hs +++ b/src/Simplex/Messaging/Notifications/Server/Main.hs @@ -23,6 +23,7 @@ import Simplex.Messaging.Notifications.Transport (supportedServerNTFVRange) import Simplex.Messaging.Protocol (ProtoServerWithAuth (..), pattern NtfServer) import Simplex.Messaging.Server.CLI import Simplex.Messaging.Server.Expiration +import Simplex.Messaging.Transport (simplexMQVersion) import Simplex.Messaging.Transport.Client (TransportHost (..)) import Simplex.Messaging.Transport.Server (TransportServerConfig (..), defaultTransportServerConfig) import System.Directory (createDirectoryIfMissing, doesFileExist) @@ -30,9 +31,6 @@ import System.FilePath (combine) import System.IO (BufferMode (..), hSetBuffering, stderr, stdout) import Text.Read (readMaybe) -ntfServerVersion :: String -ntfServerVersion = "1.7.3.0" - defaultSMPBatchDelay :: Int defaultSMPBatchDelay = 10000 @@ -58,7 +56,7 @@ ntfServerCLI cfgPath logPath = putStrLn "Deleted configuration and log files" where iniFile = combine cfgPath "ntf-server.ini" - serverVersion = "SMP notifications server v" <> ntfServerVersion + serverVersion = "SMP notifications server v" <> simplexMQVersion defaultServerPort = "443" executableName = "ntf-server" storeLogFilePath = combine logPath "ntf-server-store.log" diff --git a/tests/CLITests.hs b/tests/CLITests.hs index 032c1f748..3bc48c5ce 100644 --- a/tests/CLITests.hs +++ b/tests/CLITests.hs @@ -7,7 +7,7 @@ import Data.Ini (lookupValue, readIniFile) import Data.List (isPrefixOf) import qualified Data.X509 as X import qualified Data.X509.File as XF -import Simplex.FileTransfer.Server.Main (xftpServerCLI, xftpServerVersion) +import Simplex.FileTransfer.Server.Main (xftpServerCLI) import Simplex.Messaging.Notifications.Server.Main import Simplex.Messaging.Server.Main import Simplex.Messaging.Transport (simplexMQVersion) @@ -105,7 +105,7 @@ ntfServerTest storeLog = do lookupValue "TRANSPORT" "websockets" ini `shouldBe` Right "off" doesFileExist (ntfCfgPath <> "/ca.key") `shouldReturn` True r <- lines <$> capture_ (withArgs ["start"] $ (100000 `timeout` ntfServerCLI ntfCfgPath ntfLogPath) `catchAll_` pure (Just ())) - r `shouldContain` ["SMP notifications server v" <> ntfServerVersion] + r `shouldContain` ["SMP notifications server v" <> simplexMQVersion] r `shouldContain` (if storeLog then ["Store log: " <> ntfLogPath <> "/ntf-server-store.log"] else ["Store log disabled."]) r `shouldContain` ["Listening on port 443 (TLS)..."] capture_ (withStdin "Y" . withArgs ["delete"] $ ntfServerCLI ntfCfgPath ntfLogPath) @@ -122,7 +122,7 @@ xftpServerTest storeLog = do lookupValue "TRANSPORT" "port" ini `shouldBe` Right "443" doesFileExist (fileCfgPath <> "/ca.key") `shouldReturn` True r <- lines <$> capture_ (withArgs ["start"] $ (100000 `timeout` xftpServerCLI fileCfgPath fileLogPath) `catchAll_` pure (Just ())) - r `shouldContain` ["SimpleX XFTP server v" <> xftpServerVersion] + r `shouldContain` ["SimpleX XFTP server v" <> simplexMQVersion] r `shouldContain` (if storeLog then ["Store log: " <> fileLogPath <> "/file-server-store.log"] else ["Store log disabled."]) r `shouldContain` ["Listening on port 443..."] capture_ (withStdin "Y" . withArgs ["delete"] $ xftpServerCLI fileCfgPath fileLogPath)