blomstra / spam-prevention
为您的Flarum社区提供垃圾邮件预防。
1.7.0
2024-08-03 16:27 UTC
Requires
- php: >= 8.0
- flarum/core: ^1.0.0
- patrickschur/language-detection: ^5.2.0
Requires (Dev)
- phpunit/phpunit: ^9.5
- symfony/var-dumper: ^6.1
README
垃圾邮件预防是基于我们在官方Flarum社区讨论中的垃圾邮件战斗经验开发的扩展。安装后,它可以很好地防止任何形式的垃圾邮件。如果您社区中的垃圾邮件令人烦恼,不妨试试它!
要求
- flarum/approval - 这是必需的
- flarum/flags - 这是推荐的
- fof/spamblock - 可选,启用后立即删除以垃圾邮件为主题的讨论的打开者
安装
composer require blomstra/spam-prevention
现在从您的管理员区域启用此扩展,它将开始工作。无需进一步配置。
就这么多。下面将介绍此软件包的功能以及如何自定义其行为。
垃圾邮件预防逻辑
它是如何尝试识别垃圾邮件的?
- 它扫描电话号码
- 它扫描电子邮件地址
- 它扫描不在允许列表中的链接
- 它将使用的语言与已安装的语言包进行对比
- 它忽略高级用户(版主和管理员)
它在何处扫描垃圾邮件?
- 它扫描(首先)帖子
- 它扫描用户简介
它是如何采取行动的?
- 如果启用flarum/flags,它将标记帖子
- 如果启用flarum/approval,它将标记帖子为未批准
- 如果它识别到垃圾邮件,它将覆盖用户简介
- 如果讨论主题包含垃圾邮件且启用了fof/spamblock,则标记用户为垃圾邮件发送者
自定义
<?php /* * This file is part of Flarum. * * For detailed copyright and license information, please view the * LICENSE file that was distributed with this source code. */ use Flarum\Extend; use Blomstra\Spam; use Laminas\Diactoros\Uri; use Flarum\User\User; return [ (new Spam\Filter) // use domain name ->allowLinksFromDomain('luceos.com') // or just a full domain with protocol, only the host name is used ->allowLinksFromDomain('http://flarum.org') // even a link works, only the domain will be used ->allowLinksFromDomain('discuss.flarum.org/d/26095') // Alternatively, use an array of domains ->allowLinksFromDomains([ 'luceos.com', 'flarum.org', 'discuss.flarum.org' ]) // Use custom (expert) logic. // Return true to ignore further checking this link for validity. ->allowLink(function (Uri $uri, User $actor = null) { if ($uri->getHost() === '127.0.0.1') return true; }) // How long after sign up all posts are scrutinized for bad content ->checkForUserUpToHoursSinceSignUp(5) // How many of the first posts of a user to scrutinize for bad content ->checkForUserUpToPostContribution(5) // Specify the user Id of the moderator raising flags for some actions, otherwise the first admin is used ->moderateAsUser(2) // Disable specific spam prevention components ->disable(\Blomstra\Spam\Filters\UserBio::class), ];
常见问题解答
为什么没有管理员设置页面?
为扩展构建ux需要很多时间,尤其是在代码还不够成熟的情况下。对内部工作的更改可能会无数次影响设置页面。我们将在对工具中的功能满意后构建设置页面。