directory: command to disable all spam filters (#5709)

* directory: command to disable all spam filters

* correct syntax

* move deviceName to core opts
This commit is contained in:
Evgeny 2025-03-05 11:20:30 +00:00 committed by GitHub
parent 3425bd0826
commit 8c7df76c24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 14 additions and 16 deletions

View file

@ -75,7 +75,6 @@ mkChatOpts :: BroadcastBotOpts -> ChatOpts
mkChatOpts BroadcastBotOpts {coreOptions} =
ChatOpts
{ coreOptions,
deviceName = Nothing,
chatCmd = "",
chatCmdDelay = 3,
chatCmdLog = CCLNone,

View file

@ -235,7 +235,7 @@ directoryCmdP =
acceptancePresetsP =
spacesP
*> A.choice
[ "no" $> noJoinFilter,
[ "off" $> noJoinFilter,
"basic" $> basicJoinFilter,
("moderate" <|> "mod") $> moderateJoinFilter,
"strong" $> strongJoinFilter

View file

@ -158,7 +158,6 @@ mkChatOpts :: DirectoryOpts -> ChatOpts
mkChatOpts DirectoryOpts {coreOptions} =
ChatOpts
{ coreOptions,
deviceName = Nothing,
chatCmd = "",
chatCmdDelay = 3,
chatCmdLog = CCLNone,

View file

@ -719,7 +719,7 @@ directoryServiceEvent st opts@DirectoryOpts {adminUsers, superUsers, serviceName
"",
-- "Use */filter " <> tshow gId <> " <level>* to change spam filter level: no (disable), basic, moderate, strong.",
-- "Or use */filter " <> tshow gId <> " [name[=noimage]] [captcha[=noimage]] [observer[=noimage]]* for advanced filter configuration."
"Or use */filter " <> tshow gId <> " [name] [captcha]* to configure filter."
"Use */filter " <> tshow gId <> " [name] [captcha]* to enable and */filter " <> tshow gId <> " off* to disable filter."
]
showCondition = \case
Nothing -> "_disabled_"

View file

@ -194,7 +194,7 @@ newChatController
ChatDatabase {chatStore, agentStore}
user
cfg@ChatConfig {agentConfig = aCfg, presetServers, inlineFiles, deviceNameForRemote, confirmMigrations}
ChatOpts {coreOptions = CoreChatOpts {smpServers, xftpServers, simpleNetCfg, logLevel, logConnections, logServerHosts, logFile, tbqSize, highlyAvailable, yesToUpMigrations}, deviceName, optFilesFolder, optTempDirectory, showReactions, allowInstantFiles, autoAcceptFileSize}
ChatOpts {coreOptions = CoreChatOpts {smpServers, xftpServers, simpleNetCfg, logLevel, logConnections, logServerHosts, logFile, tbqSize, deviceName, highlyAvailable, yesToUpMigrations}, optFilesFolder, optTempDirectory, showReactions, allowInstantFiles, autoAcceptFileSize}
backgroundMode = do
let inlineFiles' = if allowInstantFiles || autoAcceptFileSize > 0 then inlineFiles else inlineFiles {sendChunks = 0, receiveInstant = False}
confirmMigrations' = if confirmMigrations == MCConsole && yesToUpMigrations then MCYesUp else confirmMigrations

View file

@ -204,10 +204,10 @@ mobileChatOpts dbOptions =
logAgent = Nothing,
logFile = Nothing,
tbqSize = 4096,
deviceName = Nothing,
highlyAvailable = False,
yesToUpMigrations = False
},
deviceName = Nothing,
chatCmd = "",
chatCmdDelay = 3,
chatCmdLog = CCLNone,

View file

@ -38,7 +38,6 @@ import Simplex.Chat.Options.DB
data ChatOpts = ChatOpts
{ coreOptions :: CoreChatOpts,
deviceName :: Maybe Text,
chatCmd :: String,
chatCmdDelay :: Int,
chatCmdLog :: ChatCmdLog,
@ -64,6 +63,7 @@ data CoreChatOpts = CoreChatOpts
logAgent :: Maybe LogLevel,
logFile :: Maybe FilePath,
tbqSize :: Natural,
deviceName :: Maybe Text,
highlyAvailable :: Bool,
yesToUpMigrations :: Bool
}
@ -212,6 +212,13 @@ coreChatOptsP appDir defaultDbName = do
<> value 1024
<> showDefault
)
deviceName <-
optional $
strOption
( long "device-name"
<> metavar "DEVICE"
<> help "Device name to use in connections with remote hosts and controller"
)
highlyAvailable <-
switch
( long "ha"
@ -246,6 +253,7 @@ coreChatOptsP appDir defaultDbName = do
logAgent = if logAgent || logLevel == CLLDebug then Just $ agentLogLevel logLevel else Nothing,
logFile,
tbqSize,
deviceName,
highlyAvailable,
yesToUpMigrations
}
@ -260,13 +268,6 @@ defaultHostMode = \case
chatOptsP :: FilePath -> FilePath -> Parser ChatOpts
chatOptsP appDir defaultDbName = do
coreOptions <- coreChatOptsP appDir defaultDbName
deviceName <-
optional $
strOption
( long "device-name"
<> metavar "DEVICE"
<> help "Device name to use in connections with remote hosts and controller"
)
chatCmd <-
strOption
( long "execute"
@ -356,7 +357,6 @@ chatOptsP appDir defaultDbName = do
pure
ChatOpts
{ coreOptions,
deviceName,
chatCmd,
chatCmdDelay,
chatCmdLog,

View file

@ -94,7 +94,6 @@ testOpts :: ChatOpts
testOpts =
ChatOpts
{ coreOptions = testCoreOpts,
deviceName = Nothing,
chatCmd = "",
chatCmdDelay = 3,
chatCmdLog = CCLNone,
@ -135,6 +134,7 @@ testCoreOpts =
logAgent = Nothing,
logFile = Nothing,
tbqSize = 16,
deviceName = Nothing,
highlyAvailable = False,
yesToUpMigrations = False
}