- Introduce AutomaticDisableKeywords setting to dynamically control channel disabling - Implement AC search for matching error messages against disable keywords - Add frontend UI for configuring automatic disable keywords - Update localization with new keyword-based channel disabling feature - Refactor sensitive word and AC search logic to support multiple keyword lists
31 lines
728 B
Go
31 lines
728 B
Go
package setting
|
|
|
|
import "strings"
|
|
|
|
var DemoSiteEnabled = false
|
|
|
|
var AutomaticDisableKeywords = []string{
|
|
"Your credit balance is too low",
|
|
"This organization has been disabled.",
|
|
"You exceeded your current quota",
|
|
"Permission denied",
|
|
"The security token included in the request is invalid",
|
|
"Operation not allowed",
|
|
"Your account is not authorized",
|
|
}
|
|
|
|
func AutomaticDisableKeywordsToString() string {
|
|
return strings.Join(AutomaticDisableKeywords, "\n")
|
|
}
|
|
|
|
func AutomaticDisableKeywordsFromString(s string) {
|
|
AutomaticDisableKeywords = []string{}
|
|
ak := strings.Split(s, "\n")
|
|
for _, k := range ak {
|
|
k = strings.TrimSpace(k)
|
|
if k != "" {
|
|
AutomaticDisableKeywords = append(AutomaticDisableKeywords, k)
|
|
}
|
|
}
|
|
}
|