mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-22 07:42:41 +00:00
Add AutospamCustomTokens model + migration
This commit is contained in:
parent
127343ccda
commit
75db5116b7
3 changed files with 82 additions and 0 deletions
11
app/Models/AutospamCustomTokens.php
Normal file
11
app/Models/AutospamCustomTokens.php
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class AutospamCustomTokens extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
}
|
37
config/autospam.php
Normal file
37
config/autospam.php
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Enable Autospam
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Autospam uses NLP and other techniques to detect and mitigate potential
|
||||||
|
| spam posts from users on your server.
|
||||||
|
| We recommend enabling this when you have open registrations, regardless
|
||||||
|
| of how many users you have.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'enabled' => env('PF_BOUNCER_ENABLED', false),
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Ignored Tokens
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Ignored tokens are for commonly used words that may impact the detection.
|
||||||
|
| These tokens should be lowercase and not contain spaces or non alpha-
|
||||||
|
| numerical characters and be in comma-separated format.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'ignored_tokens' => env('PF_AUTOSPAM_IGNORED_TOKENS', 'the,a,of,and'),
|
||||||
|
|
||||||
|
'nlp' => [
|
||||||
|
'enabled' => false,
|
||||||
|
'spam_sample_limit' => env('PF_AUTOSPAM_NLP_SPAM_SAMPLE_LIMIT', 200),
|
||||||
|
]
|
||||||
|
];
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('autospam_custom_tokens', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->string('token')->index();
|
||||||
|
$table->integer('weight')->default(1)->index();
|
||||||
|
$table->boolean('is_spam')->default(true)->index();
|
||||||
|
$table->text('note')->nullable();
|
||||||
|
$table->string('category')->nullable()->index();
|
||||||
|
$table->boolean('active')->default(false)->index();
|
||||||
|
$table->unique(['token', 'category']);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('autospam_custom_tokens');
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in a new issue