move spam youtube IDs to config
parent
fb8e11e46b
commit
eecee116c4
|
@ -252,6 +252,7 @@ security {
|
|||
email = ${net.email}
|
||||
}
|
||||
ipintel.email = "-"
|
||||
banned_youtube_ids = ""
|
||||
}
|
||||
oauth {
|
||||
mongodb {
|
||||
|
|
|
@ -50,6 +50,7 @@ final class Env(
|
|||
private val NetDomain = config getString "net.domain"
|
||||
private val NetEmail = config getString "net.email"
|
||||
private val IpIntelEmail = EmailAddress(config getString "ipintel.email")
|
||||
private val BannedYoutubeIds = config getString "banned_youtube_ids" split " " toList
|
||||
|
||||
val recaptchaPublicConfig = RecaptchaPublicConfig(
|
||||
key = config getString "recaptcha.public_key",
|
||||
|
@ -170,7 +171,7 @@ final class Env(
|
|||
text = "Spam keywords separated by a comma".some
|
||||
)
|
||||
|
||||
lazy val spam = new Spam(spamKeywordsSetting.get)
|
||||
lazy val spam = new Spam(spamKeywordsSetting.get, BannedYoutubeIds)
|
||||
|
||||
scheduler.once(15 seconds)(disposableEmailDomain.refresh)
|
||||
scheduler.effect(DisposableEmailRefreshDelay, "Refresh disposable email domains")(disposableEmailDomain.refresh)
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package lila.security
|
||||
|
||||
final class Spam(spamKeywords: () => lila.common.Strings) {
|
||||
final class Spam(
|
||||
spamKeywords: () => lila.common.Strings,
|
||||
bannedYoutubeIds: List[String]
|
||||
) {
|
||||
|
||||
def detect(text: String) = staticBlacklist.exists(text.contains) ||
|
||||
spamKeywords().value.exists(text.contains)
|
||||
|
@ -13,9 +16,7 @@ final class Spam(spamKeywords: () => lila.common.Strings) {
|
|||
"chess.com/register?refId="
|
||||
)
|
||||
|
||||
private val youtubeIds = List("7UpltimWY_E", "J_bzfjZZnjU", "xRiQe_tq7h0", "8IlVvluRbwk", "P3o0hPjrxgo", "d8TSD4f89i8")
|
||||
|
||||
private lazy val staticBlacklist = List("chess-bot.com") ::: youtubeIds ::: referBlacklist
|
||||
private lazy val staticBlacklist = List("chess-bot.com") ::: bannedYoutubeIds ::: referBlacklist
|
||||
|
||||
def replace(text: String) = replacements.foldLeft(text) {
|
||||
case (t, (regex, rep)) => regex.replaceAllIn(t, rep)
|
||||
|
@ -27,7 +28,7 @@ final class Spam(spamKeywords: () => lila.common.Strings) {
|
|||
"""chess24.com\?ref=\w+""".r -> "chess24.com",
|
||||
"""chess.com/register\?refId=\w+""".r -> "chess.com",
|
||||
"""\bchess-bot(\.com)?[^\s]*""".r -> "[redacted]"
|
||||
) ::: youtubeIds.map { id =>
|
||||
) ::: bannedYoutubeIds.map { id =>
|
||||
id.r -> "7orFjhLkcxA"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,6 +176,4 @@ pid(a|o)r
|
|||
""")
|
||||
|
||||
private def dict(words: String) = words.lines.filter(_.nonEmpty)
|
||||
|
||||
val youtubeIds = List("7UpltimWY_E", "J_bzfjZZnjU", "xRiQe_tq7h0", "8IlVvluRbwk", "P3o0hPjrxgo", "d8TSD4f89i8")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue