Skip to content

Commit

Permalink
core: temp-folder option (#3905)
Browse files Browse the repository at this point in the history
  • Loading branch information
spaced4ndy committed Mar 14, 2024
1 parent 240ca30 commit f3eeb9d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions apps/simplex-broadcast-bot/src/Broadcast/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ mkChatOpts BroadcastBotOpts {coreOptions} =
chatCmdLog = CCLNone,
chatServerPort = Nothing,
optFilesFolder = Nothing,
optTempDirectory = Nothing,
showReactions = False,
allowInstantFiles = True,
autoAcceptFileSize = 0,
Expand Down
1 change: 1 addition & 0 deletions apps/simplex-directory-service/src/Directory/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ mkChatOpts DirectoryOpts {coreOptions} =
chatCmdLog = CCLNone,
chatServerPort = Nothing,
optFilesFolder = Nothing,
optTempDirectory = Nothing,
showReactions = False,
allowInstantFiles = True,
autoAcceptFileSize = 0,
Expand Down
4 changes: 2 additions & 2 deletions src/Simplex/Chat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ newChatController
ChatDatabase {chatStore, agentStore}
user
cfg@ChatConfig {agentConfig = aCfg, defaultServers, inlineFiles, deviceNameForRemote}
ChatOpts {coreOptions = CoreChatOpts {smpServers, xftpServers, networkConfig, logLevel, logConnections, logServerHosts, logFile, tbqSize, highlyAvailable}, deviceName, optFilesFolder, showReactions, allowInstantFiles, autoAcceptFileSize}
ChatOpts {coreOptions = CoreChatOpts {smpServers, xftpServers, networkConfig, logLevel, logConnections, logServerHosts, logFile, tbqSize, highlyAvailable}, deviceName, optFilesFolder, optTempDirectory, showReactions, allowInstantFiles, autoAcceptFileSize}
backgroundMode = do
let inlineFiles' = if allowInstantFiles || autoAcceptFileSize > 0 then inlineFiles else inlineFiles {sendChunks = 0, receiveInstant = False}
config = cfg {logLevel, showReactions, tbqSize, subscriptionEvents = logConnections, hostEvents = logServerHosts, defaultServers = configServers, inlineFiles = inlineFiles', autoAcceptFileSize, highlyAvailable}
Expand Down Expand Up @@ -245,7 +245,7 @@ newChatController
chatActivated <- newTVarIO True
showLiveItems <- newTVarIO False
encryptLocalFiles <- newTVarIO False
tempDirectory <- newTVarIO Nothing
tempDirectory <- newTVarIO optTempDirectory
contactMergeEnabled <- newTVarIO True
pqExperimentalEnabled <- newTVarIO PQSupportOff
pure
Expand Down
1 change: 1 addition & 0 deletions src/Simplex/Chat/Mobile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ mobileChatOpts dbFilePrefix =
chatCmdLog = CCLNone,
chatServerPort = Nothing,
optFilesFolder = Nothing,
optTempDirectory = Nothing,
showReactions = False,
allowInstantFiles = True,
autoAcceptFileSize = 0,
Expand Down
9 changes: 9 additions & 0 deletions src/Simplex/Chat/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ data ChatOpts = ChatOpts
chatCmdLog :: ChatCmdLog,
chatServerPort :: Maybe String,
optFilesFolder :: Maybe FilePath,
optTempDirectory :: Maybe FilePath,
showReactions :: Bool,
allowInstantFiles :: Bool,
autoAcceptFileSize :: Integer,
Expand Down Expand Up @@ -258,6 +259,13 @@ chatOptsP appDir defaultDbFileName = do
<> metavar "FOLDER"
<> help "Folder to use for sent and received files"
)
optTempDirectory <-
optional $
strOption
( long "temp-folder"
<> metavar "FOLDER"
<> help "Folder for temporary encrypted files (default: system temp directory)"
)
showReactions <-
switch
( long "reactions"
Expand Down Expand Up @@ -304,6 +312,7 @@ chatOptsP appDir defaultDbFileName = do
chatCmdLog,
chatServerPort,
optFilesFolder,
optTempDirectory,
showReactions,
allowInstantFiles,
autoAcceptFileSize,
Expand Down
1 change: 1 addition & 0 deletions tests/ChatClient.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ testOpts =
chatCmdLog = CCLNone,
chatServerPort = Nothing,
optFilesFolder = Nothing,
optTempDirectory = Nothing,
showReactions = True,
allowInstantFiles = True,
autoAcceptFileSize = 0,
Expand Down

0 comments on commit f3eeb9d

Please sign in to comment.