This commit is contained in:
spaced4ndy
2026-08-11 19:55:39 +04:00
parent b999b585cf
commit 247e327ebe
7 changed files with 61 additions and 11 deletions
+2 -2
View File
@@ -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
+1
View File
@@ -265,6 +265,7 @@ mobileChatOpts dbOptions =
chatRelayServer = Nothing,
headless = False,
highlyAvailable = False,
serviceRequests = False,
yesToUpMigrations = False,
migrationBackupPath = Just "",
maintenance = True
+8
View File
@@ -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