From 3a8a7934784a659826486caae6deeb99ea4d2c7a Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Tue, 7 Nov 2023 20:56:33 +0000 Subject: [PATCH] Support old replay search API I completely missed that this was being used... --- replay.pokemonshowdown.com/.htaccess | 1 + replay.pokemonshowdown.com/replay.log.php | 2 +- .../search.json.php | 2 +- {old-replays => replay.pokemonshowdown.com}/search.notjson.php | 0 4 files changed, 3 insertions(+), 2 deletions(-) rename old-replays/search.yesjson.php => replay.pokemonshowdown.com/search.json.php (96%) rename {old-replays => replay.pokemonshowdown.com}/search.notjson.php (100%) diff --git a/replay.pokemonshowdown.com/.htaccess b/replay.pokemonshowdown.com/.htaccess index 92b3bd965b..da2677be0f 100644 --- a/replay.pokemonshowdown.com/.htaccess +++ b/replay.pokemonshowdown.com/.htaccess @@ -1,6 +1,7 @@ RewriteEngine on RewriteRule ^api(/.*)?$ http://localhost:9000/api$1 [P,L] +RewriteRule ^search\.json$ search.json.php [L,QSA] RewriteRule ^([A-Za-z0-9-]+)$ replay.php?name=$1 [L,QSA] RewriteRule ^([A-Za-z0-9-]+)/manage$ replay-manage.php?name=$1&manage [L,QSA] RewriteRule ^([A-Za-z0-9-]+)\.log$ replay.log.php?name=$1 [L,QSA] diff --git a/replay.pokemonshowdown.com/replay.log.php b/replay.pokemonshowdown.com/replay.log.php index aa5f3dc1c8..1d5e9d0642 100644 --- a/replay.pokemonshowdown.com/replay.log.php +++ b/replay.pokemonshowdown.com/replay.log.php @@ -60,7 +60,7 @@ $replay['log'] = str_replace("\r","",$replay['log']); -if ($replay['inputlog']) { +if (@$replay['inputlog']) { if (substr($replay['formatid'], -12) === 'randombattle' || substr($replay['formatid'], -19) === 'randomdoublesbattle' || $replay['formatid'] === 'gen7challengecup' || $replay['formatid'] === 'gen7challengecup1v1' || $replay['formatid'] === 'gen7battlefactory' || $replay['formatid'] === 'gen7bssfactory' || $replay['formatid'] === 'gen7hackmonscup' || $manage) { // ok } else { diff --git a/old-replays/search.yesjson.php b/replay.pokemonshowdown.com/search.json.php similarity index 96% rename from old-replays/search.yesjson.php rename to replay.pokemonshowdown.com/search.json.php index c714bea56e..ea91581205 100644 --- a/old-replays/search.yesjson.php +++ b/replay.pokemonshowdown.com/search.json.php @@ -10,7 +10,7 @@ header('Content-Type: application/json'); header('Access-Control-Allow-Origin: *'); -require_once '../../replays/replays.lib.php'; +require_once 'replays.lib.php'; $username = $Replays->toID($username); $isPrivateAllowed = false; diff --git a/old-replays/search.notjson.php b/replay.pokemonshowdown.com/search.notjson.php similarity index 100% rename from old-replays/search.notjson.php rename to replay.pokemonshowdown.com/search.notjson.php