From 818240aa0c8548499d8901886838b1a75673ee0a Mon Sep 17 00:00:00 2001 From: xiaomlove <353856593@qq.com> Date: Tue, 15 Jun 2021 19:05:38 +0800 Subject: [PATCH] takeupload.php check torrent exists or not --- include/cleanup_cli.php | 8 ++++++-- public/takeupload.php | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/cleanup_cli.php b/include/cleanup_cli.php index 8b1fd705..eaa5cabb 100644 --- a/include/cleanup_cli.php +++ b/include/cleanup_cli.php @@ -27,9 +27,13 @@ try { } else { $result = autoclean(); } - do_log("[CLEANUP_CLI DONE!] $result"); + $log = "[CLEANUP_CLI DONE!] $result"; + do_log($log); + printProgress($log); } catch (\Exception $exception) { - do_log("ERROR: " . $exception->getMessage()); + $log = "ERROR: " . $exception->getMessage(); + do_log($log); + printProgress($log); throw new \RuntimeException($exception->getMessage()); } diff --git a/public/takeupload.php b/public/takeupload.php index 4f6f22e5..5a891b58 100644 --- a/public/takeupload.php +++ b/public/takeupload.php @@ -166,6 +166,10 @@ unset ($dict['nodes']); // remove cached peers (Bitcomet & Azareus) $infohash = pack("H*", sha1(\Rhilip\Bencode\Bencode::encode($dict['info']))); // double up on the becoding solves the occassional misgenerated infohash +if (\App\Models\Torrent::query()->where('info_hash', $infohash)->exists()) { + bark($lang_takeupload['std_torrent_existed']); +} + // ------------- start: check upload authority ------------------// $allowtorrents = user_can_upload("torrents"); $allowspecial = user_can_upload("music");