core: commands to get/set network configuration (#839)

This commit is contained in:
Evgeny Poberezkin
2022-07-25 14:04:27 +01:00
committed by GitHub
parent 7dcde32680
commit f150932e44
10 changed files with 52 additions and 41 deletions

View File

@@ -3,13 +3,12 @@
module Main where
import Control.Concurrent (threadDelay)
import Network.Socks5 (SocksConf (..))
import Server
import Simplex.Chat.Controller (versionNumber)
import Simplex.Chat.Core
import Simplex.Chat.Options
import Simplex.Chat.Terminal
import Simplex.Chat.View (serializeChatResponse)
import Simplex.Chat.View (serializeChatResponse, viewSocksProxy)
import System.Directory (getAppUserDataDirectory)
import System.Terminal (withTerminal)
@@ -31,10 +30,11 @@ main = do
threadDelay $ chatCmdDelay opts * 1000000
welcome :: ChatOpts -> IO ()
welcome ChatOpts {dbFilePrefix, socksProxy} = do
putStrLn $ "SimpleX Chat v" ++ versionNumber
putStrLn $ "db: " <> dbFilePrefix <> "_chat.db, " <> dbFilePrefix <> "_agent.db"
case socksProxy of
Just (SocksConf s _) -> putStrLn $ "using SOCKS5 proxy " <> show s
_ -> putStrLn "use -x CLI option to connect via SOCKS5 at :9050"
putStrLn "type \"/help\" or \"/h\" for usage info"
welcome ChatOpts {dbFilePrefix, socksProxy} =
mapM_
putStrLn
[ "SimpleX Chat v" ++ versionNumber,
"db: " <> dbFilePrefix <> "_chat.db, " <> dbFilePrefix <> "_agent.db",
viewSocksProxy socksProxy,
"type \"/help\" or \"/h\" for usage info"
]