mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-04 23:35:32 +00:00
wip
This commit is contained in:
@@ -87,10 +87,10 @@ simplexChatCore cfg@ChatConfig {confirmMigrations, testView, chatHooks} opts@Cha
|
||||
exitFailure
|
||||
|
||||
runSimplexChat :: ChatConfig -> ChatOpts -> User -> ChatController -> (User -> ChatController -> IO ()) -> IO ()
|
||||
runSimplexChat ChatConfig {testView} ChatOpts {coreOptions = CoreChatOpts {chatRelay, chatRelayServer, headless, maintenance}} u cc@ChatController {config = ChatConfig {chatHooks}} chat
|
||||
runSimplexChat ChatConfig {testView} ChatOpts {coreOptions = CoreChatOpts {chatRelay, chatRelayServer, headless, serviceRequests, maintenance}} u cc@ChatController {config = ChatConfig {chatHooks}} chat
|
||||
| maintenance = wait =<< async (chat u cc)
|
||||
| otherwise = do
|
||||
a1 <- runReaderT (startChatController True True False) cc
|
||||
a1 <- runReaderT (startChatController True True serviceRequests) cc
|
||||
when (chatRelay && not testView) $ askCreateRelayAddress cc u chatRelayServer headless
|
||||
forM_ (postStartHook chatHooks) ($ cc)
|
||||
a2 <- async $ chat u cc
|
||||
|
||||
@@ -265,6 +265,7 @@ mobileChatOpts dbOptions =
|
||||
chatRelayServer = Nothing,
|
||||
headless = False,
|
||||
highlyAvailable = False,
|
||||
serviceRequests = False,
|
||||
yesToUpMigrations = False,
|
||||
migrationBackupPath = Just "",
|
||||
maintenance = True
|
||||
|
||||
@@ -73,6 +73,7 @@ data CoreChatOpts = CoreChatOpts
|
||||
chatRelayServer :: Maybe SMPServerWithAuth,
|
||||
headless :: Bool,
|
||||
highlyAvailable :: Bool,
|
||||
serviceRequests :: Bool,
|
||||
yesToUpMigrations :: Bool,
|
||||
migrationBackupPath :: Maybe FilePath,
|
||||
maintenance :: Bool
|
||||
@@ -304,6 +305,12 @@ coreChatOptsP appDir defaultDbName = do
|
||||
( long "ha"
|
||||
<> help "Run as a highly available client (this may increase traffic in groups)"
|
||||
)
|
||||
-- TODO [directory] default this on for the directory binary, so a deployment cannot omit it
|
||||
serviceRequests <-
|
||||
switch
|
||||
( long "service-requests"
|
||||
<> help "Process service requests received on the address (requires an address with DR keys)"
|
||||
)
|
||||
yesToUpMigrations <-
|
||||
switch
|
||||
( long "yes-migrate"
|
||||
@@ -350,6 +357,7 @@ coreChatOptsP appDir defaultDbName = do
|
||||
True | not chatRelay -> errorWithoutStackTrace "--headless option requires --relay option"
|
||||
_ -> headless,
|
||||
highlyAvailable,
|
||||
serviceRequests,
|
||||
yesToUpMigrations,
|
||||
migrationBackupPath,
|
||||
maintenance
|
||||
|
||||
Reference in New Issue
Block a user