[blockbot] add ChatGPT crawler

This PR adds an option to the admin settings of the blockbot addon to choose if the ChatGPT crawler should be blocked or not.
This commit is contained in:
Tobias Diekershoff 2023-08-09 07:12:22 +02:00
parent 5d13889f2c
commit ab6669a2b1
2 changed files with 16 additions and 2 deletions

View File

@ -30,6 +30,7 @@ function blockbot_addon_admin(string &$o)
'$submit' => DI::l10n()->t('Save Settings'),
'$good_crawlers' => ['good_crawlers', DI::l10n()->t('Allow "good" crawlers'), DI::config()->get('blockbot', 'good_crawlers'), DI::l10n()->t("Don't block fediverse crawlers, relay servers and other bots with good purposes.")],
'$block_gab' => ['block_gab', DI::l10n()->t('Block GabSocial'), DI::config()->get('blockbot', 'block_gab'), DI::l10n()->t('Block the software GabSocial. This will block every access for that software. You can block dedicated gab instances in the blocklist settings in the admin section.')],
'$block_gpt' => ['block_gpt', DI::l10n()->t('Block ChatGPT'), DI::config()->get('blockbot', 'block_gpt'), DI::l10n()->t('Block the ChatGPT crawler. This will block every access for that software.')],
'$training' => ['training', DI::l10n()->t('Training mode'), DI::config()->get('blockbot', 'training'), DI::l10n()->t("Activates the training mode. This is only meant for developing purposes. Don't activate this on a production machine. This can cut communication with some systems.")],
]);
}
@ -38,6 +39,7 @@ function blockbot_addon_admin_post()
{
DI::config()->set('blockbot', 'good_crawlers', $_POST['good_crawlers'] ?? false);
DI::config()->set('blockbot', 'block_gab', $_POST['block_gab'] ?? false);
DI::config()->set('blockbot', 'block_gpt', $_POST['block_gpt'] ?? false);
DI::config()->set('blockbot', 'training', $_POST['training'] ?? false);
}
@ -96,6 +98,9 @@ function blockbot_init_1()
if (DI::config()->get('blockbot', 'block_gab')) {
$agents[] = 'GabSocial/';
}
if (DI::config()->get('blockbot', 'block_gpt')) {
$agents[] = 'GPTBot/';
}
foreach ($agents as $agent) {
if (stristr($_SERVER['HTTP_USER_AGENT'], $agent)) {

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-13 06:17+0000\n"
"POT-Creation-Date: 2023-08-09 07:10+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -43,11 +43,20 @@ msgid ""
msgstr ""
#: blockbot.php:33
msgid "Training mode"
msgid "Block ChatGPT"
msgstr ""
#: blockbot.php:33
msgid ""
"Block the ChatGPT crawler. This will block every access for that software."
msgstr ""
#: blockbot.php:34
msgid "Training mode"
msgstr ""
#: blockbot.php:34
msgid ""
"Activates the training mode. This is only meant for developing purposes. "
"Don't activate this on a production machine. This can cut communication with "
"some systems."