mirror of
https://ghfast.top/https://github.com/discourse/discourse-akismet.git
synced 2026-07-16 11:46:29 +08:00
This change aims to help reduce/prevent confusion with the NetEase provider which is a china-based service targeted towards chinese content.
35 lines
817 B
Ruby
35 lines
817 B
Ruby
# frozen_string_literal: true
|
|
|
|
module DiscourseAkismet
|
|
class AntiSpamService
|
|
NETEASE = "netease (Chinese)"
|
|
AKISMET = "akismet"
|
|
|
|
def self.client
|
|
return if !SiteSetting.akismet_enabled?
|
|
|
|
netease? ? Netease::Client.build_client : Akismet::Client.build_client
|
|
end
|
|
|
|
def self.args_manager
|
|
netease? ? Netease::RequestArgs : Akismet::RequestArgs
|
|
end
|
|
|
|
def self.api_secret_configured?
|
|
if netease?
|
|
SiteSetting.netease_secret_id.present? && SiteSetting.netease_secret_key.present? &&
|
|
SiteSetting.netease_business_id.present?
|
|
else
|
|
SiteSetting.akismet_api_key.present?
|
|
end
|
|
end
|
|
|
|
def self.api_secret_blank?
|
|
!api_secret_configured?
|
|
end
|
|
|
|
def self.netease?
|
|
SiteSetting.anti_spam_service == NETEASE
|
|
end
|
|
end
|
|
end
|