From 6a1932313801e55fbcfb047fdcef87266f472c33 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Thu, 16 Jan 2025 15:25:58 +0300 Subject: [PATCH] feat(announcer): Added `event` verifying (#1765) --- bt/announce.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bt/announce.php b/bt/announce.php index 6d3523146..5e531d9af 100644 --- a/bt/announce.php +++ b/bt/announce.php @@ -94,6 +94,16 @@ if (!isset($info_hash)) { msg_die('info_hash was not provided'); } +/** + * Verify event + * + * @see https://github.com/HDInnovations/UNIT3D-Community-Edition/blob/c64275f0b5dcb3c4c845d5204871adfe24f359d6/app/Http/Controllers/AnnounceController.php#L275 + */ +$event = strtolower($event); +if (!in_array($event, ['started', 'completed', 'stopped', 'paused', ''])) { + msg_die('Invalid event: ' . $event); +} + // Store info hash in hex format $info_hash_hex = bin2hex($info_hash);