From 082b8343514efe28e2e5d7ecec71b3aa2d096077 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Sat, 18 Jul 2026 02:34:58 +0000 Subject: [PATCH] Update Replays for new loginserver endpoints This should drastically help with server performance, considering these are the URLs that keep getting hammered by scrapers. --- replay.pokemonshowdown.com/.htaccess | 11 ++++++++--- replay.pokemonshowdown.com/src/replays-battle.tsx | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/replay.pokemonshowdown.com/.htaccess b/replay.pokemonshowdown.com/.htaccess index 8dbe60f61..31d404415 100644 --- a/replay.pokemonshowdown.com/.htaccess +++ b/replay.pokemonshowdown.com/.htaccess @@ -6,9 +6,14 @@ RewriteRule ^recent\.json$ /api/replays/search.json [L,QSA] RewriteRule ^download$ download.html [L,QSA] RewriteRule ^([A-Za-z0-9-]+)$ index.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] -RewriteRule ^([A-Za-z0-9-]+)\.inputlog$ replay.log.php?inputlog&name=$1 [L,QSA] -RewriteRule ^([A-Za-z0-9-]+)\.json$ replay.log.php?json&name=$1 [L,QSA] + +# RewriteRule ^([A-Za-z0-9-]+)\.log$ replay.log.php?name=$1 [L,QSA] +# RewriteRule ^([A-Za-z0-9-]+)\.inputlog$ replay.log.php?inputlog&name=$1 [L,QSA] +# RewriteRule ^([A-Za-z0-9-]+)\.json$ replay.log.php?json&name=$1 [L,QSA] + +RewriteRule ^([A-Za-z0-9-]+)\.log$ /api/replays/get.log?id=$1 [L,QSA] +RewriteRule ^([A-Za-z0-9-]+)\.inputlog$ /api/replays/get.inputlog?id=$1 [L,QSA] +RewriteRule ^([A-Za-z0-9-]+)\.json$ /api/replays/get.json?id=$1 [L,QSA] DirectoryIndex index.php index.html /dirindex/dirindex.php ErrorDocument 404 /dirindex/404.html diff --git a/replay.pokemonshowdown.com/src/replays-battle.tsx b/replay.pokemonshowdown.com/src/replays-battle.tsx index 7a020bef6..aa5f1cf35 100644 --- a/replay.pokemonshowdown.com/src/replays-battle.tsx +++ b/replay.pokemonshowdown.com/src/replays-battle.tsx @@ -103,7 +103,7 @@ export class BattlePanel extends preact.Component<{ id: string }> { return; } - Net(`/${this.stripQuery(id)}.json`).get().then(result => { + Net(`/${this.stripQuery(id)}.json?countview`).get().then(result => { this.loadResult(result, id); }).catch(err => { this.loadResult(err.statusCode === 404 ? '' : String(err?.body || ''), id);