luceos/flarum-simple-spam-tools

此包已被废弃,不再维护。作者建议使用blomstra/spam-prevention包代替。

提供本地扩展程序,以实施一些垃圾邮件预防措施。

0.1.2 2022-09-01 06:30 UTC

This package is auto-updated.

Last update: 2022-09-01 12:57:46 UTC


README

此扩展为您的社区提供了针对垃圾邮件运行的某些高级保护。这不是一个扩展,而是一组本地扩展程序。本地扩展程序需要添加到您的Flarum安装根目录中的extend.php文件中(在flarumcomposer.json旁边,您将看到一个名为extend.php的文件)。

安装扩展

composer require luceos/flarum-simple-spam-tools

更新扩展

composer require luceos/flarum-simple-spam-tools

确保更新后所有本地扩展程序仍然正常工作。

配置

在您的extend.php中指定一些应该不言自明的设置

return [
    (new \Luceos\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'
        ])
        // 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
        ->moderateAsUser(2),
];

防止个人简介垃圾邮件

return [
    // ...
    new \Luceos\Spam\UserBio,
]

这将阻止基于配置中过滤器设置的任何不良内容等。

防止评论帖子垃圾邮件

return [
    // ..
    new \Luceos\Spam\CommentPost,
]

这将基于过滤器设置阻止帖子中的任何不良内容。

防止讨论主题垃圾邮件

return [
    // ..
    new \Luceos\Spam\Discussion,
]

阻止讨论主题/标题中的URL。

示例完整配置

这可以是一个示例本地extend.php文件

<?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.
 */

return [
    //.. some other extenders can come here, the last one needs to end with a comma.
    
        (new \Luceos\Spam\Filter)
        ->allowLinksFromDomain('luceos.com')
        ->allowLinksFromDomain('http://flarum.org')
        ->allowLinksFromDomain('discuss.flarum.org/d/26095')
        ->checkForUserUpToHoursSinceSignUp(24)
        ->checkForUserUpToPostContribution(10)
        ->moderateAsUser(10),
    new \Luceos\Spam\UserBio,
    new \Luceos\Spam\CommentPost,
    new \Luceos\Spam\Discussion,
];