From 1b288a96e443e06c4f4e9ea374037d3b0af8a639 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Tue, 25 Mar 2025 13:48:52 +0300 Subject: [PATCH] =?UTF-8?q?revert:=20Added=20`IndexNow`=20protocol=20suppo?= =?UTF-8?q?rt=20=F0=9F=A4=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - composer.json | 1 - composer.lock | 48 +---------- library/config.php | 6 -- .../includes/cron/jobs/board_maintenance.php | 9 -- src/IndexNow.php | 86 ------------------- src/Legacy/Post.php | 7 -- 7 files changed, 3 insertions(+), 155 deletions(-) delete mode 100644 src/IndexNow.php diff --git a/.gitignore b/.gitignore index 2af16db7d..dd0e1f365 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ ### TorrentPier ### *.log -/*.txt install.php_* composer-setup.php .env diff --git a/composer.json b/composer.json index 82f829c9b..51b0f2780 100644 --- a/composer.json +++ b/composer.json @@ -57,7 +57,6 @@ "egulias/email-validator": "^4.0.1", "filp/whoops": "^2.15", "z4kn4fein/php-semver": "^v3.0.0", - "nemorize/indexnow": "^0.0.1", "gigablah/sphinxphp": "2.0.8", "google/recaptcha": "^1.3", "jacklul/monolog-telegram": "^3.1", diff --git a/composer.lock b/composer.lock index 5a139899e..917724db8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c1e345a7abe58feb13d951acfd499e95", + "content-hash": "ed0c6f72e121f5b35712c0855bc64a82", "packages": [ { "name": "arokettu/bencode", @@ -2057,48 +2057,6 @@ ], "time": "2025-03-24T10:02:05+00:00" }, - { - "name": "nemorize/indexnow", - "version": "0.0.1", - "source": { - "type": "git", - "url": "https://github.com/nemorize/php-indexnow.git", - "reference": "7602a8ae1de0cf1dd11692a7627f10111c55731a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nemorize/php-indexnow/zipball/7602a8ae1de0cf1dd11692a7627f10111c55731a", - "reference": "7602a8ae1de0cf1dd11692a7627f10111c55731a", - "shasum": "" - }, - "require": { - "guzzlehttp/guzzle": "^7.7", - "php": ">=8.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "Nemorize\\Indexnow\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ji Yong, Kim", - "email": "nemo@qroffle.com" - } - ], - "description": "PHP library for submitting website URLs using IndexNow to search engines.", - "support": { - "issues": "https://github.com/nemorize/php-indexnow/issues", - "source": "https://github.com/nemorize/php-indexnow/tree/0.0.1" - }, - "abandoned": true, - "time": "2023-07-31T17:08:12+00:00" - }, { "name": "nikic/iter", "version": "v2.4.1", @@ -3854,6 +3812,6 @@ "platform": { "php": "^8.1 | ^8.2 | ^8.3 | ^8.4" }, - "platform-dev": [], - "plugin-api-version": "2.3.0" + "platform-dev": {}, + "plugin-api-version": "2.6.0" } diff --git a/library/config.php b/library/config.php index 4a1792e2a..af87d3ace 100644 --- a/library/config.php +++ b/library/config.php @@ -144,12 +144,6 @@ $bb_cfg['torr_server'] = [ 'disable_for_guest' => true ]; -// IndexNow settings -$bb_cfg['indexnow_settings'] = [ - 'enabled' => false, - 'host' => 'bing', // Available: yandex, bing, seznam, naver -]; - // FAQ url help link $bb_cfg['how_to_download_url_help'] = 'viewtopic.php?t=1'; // How to download? $bb_cfg['what_is_torrent_url_help'] = 'viewtopic.php?t=2'; // What is a torrent? diff --git a/library/includes/cron/jobs/board_maintenance.php b/library/includes/cron/jobs/board_maintenance.php index 8c47d34fb..74b28809c 100644 --- a/library/includes/cron/jobs/board_maintenance.php +++ b/library/includes/cron/jobs/board_maintenance.php @@ -64,14 +64,5 @@ if (empty($bb_cfg['tp_instance_hash']) || ($bb_cfg['tp_instance_hash'] !== hash( bb_update_config(['tp_instance_hash' => hash('xxh128', FULL_URL)]); } -// Generate IndexNow key -if ($bb_cfg['indexnow_settings']['enabled'] && !is_file(BB_ROOT . $bb_cfg['indexnow_key'] . \TorrentPier\IndexNow::$keyFileExtension)) { - $randomIndexNowKey = empty($bb_cfg['indexnow_key']) ? make_rand_str(rand(64, 128)) : $bb_cfg['indexnow_key']; - if ($bb_cfg['indexnow_key'] !== $randomIndexNowKey) { - bb_update_config(['indexnow_key' => $randomIndexNowKey]); - } - file_write($randomIndexNowKey, (BB_ROOT . $randomIndexNowKey . \TorrentPier\IndexNow::$keyFileExtension)); -} - // Check for updates $datastore->update('check_updates'); diff --git a/src/IndexNow.php b/src/IndexNow.php deleted file mode 100644 index e0e2ad9a1..000000000 --- a/src/IndexNow.php +++ /dev/null @@ -1,86 +0,0 @@ - 'yandex.com', - 'bing' => 'bing.com', - 'seznam' => 'search.seznam.cz', - 'naver' => 'searchadvisor.naver.com' - ]; - - /** - * IndexNow constructor - */ - public function __construct() - { - global $bb_cfg; - - $this->indexNow = new \Nemorize\Indexnow\Indexnow(); - $this->indexNow->setKey($bb_cfg['indexnow_key']); - if (in_array($bb_cfg['indexnow_settings']['host'], array_keys($this->hosts))) { - $this->indexNow->setHost($this->hosts[$bb_cfg['indexnow_settings']['host']]); - } else { - bb_log("IndexNow (ERROR): Invalid host: {$bb_cfg['indexnow_settings']['host']}\n", self::$logFile); - bb_die('Invalid host: ' . $bb_cfg['indexnow_settings']['host']); - } - $this->indexNow->setKeyLocation(FULL_URL . $bb_cfg['indexnow_key'] . self::$keyFileExtension); - } - - /** - * Submit page to IndexNow - * - * @param string $url - * @return void - */ - public function submit(string $url): void - { - try { - $this->indexNow->submit($url); - } catch (IndexnowException $e) { - bb_log("IndexNow (ERROR) [$url]: Message: {$e->getMessage()}\n", self::$logFile); - bb_die($e->getMessage()); - } - } -} diff --git a/src/Legacy/Post.php b/src/Legacy/Post.php index b82a03d86..a44b147d3 100644 --- a/src/Legacy/Post.php +++ b/src/Legacy/Post.php @@ -10,7 +10,6 @@ namespace TorrentPier\Legacy; use TorrentPier\Emailer; -use TorrentPier\IndexNow; use TorrentPier\Legacy\Admin\Common; use TorrentPier\Validate; @@ -221,12 +220,6 @@ class Post } } - // Send IndexNow - if ($bb_cfg['indexnow_settings']['enabled'] && ($mode === 'newtopic' || $mode === 'editpost')) { - $indexNow = new IndexNow(); - $indexNow->submit(FULL_URL . POST_URL . "$post_id#$post_id"); - } - meta_refresh(POST_URL . "$post_id#$post_id"); set_die_append_msg($forum_id, $topic_id);