Fix new side server URL scheme
Some checks failed
Node.js CI / build (22.x) (push) Has been cancelled

Mostly, this adds backwards compatibility with the
`localhost-[port].psim.us` URLs, which never stopped working.
This commit is contained in:
Guangcong Luo 2025-06-21 13:03:55 +00:00
parent 4b5830ff39
commit 87a8997278
2 changed files with 2 additions and 2 deletions

View File

@ -18,13 +18,12 @@ RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} ^http$
RewriteCond %{HTTP_HOST} ^play\.pokemonshowdown\.com$ [NC]
RewriteCond %{QUERY_STRING} !^insecure [NC]
RewriteRule ^([A-Za-z0-9-]*)$ https://play.pokemonshowdown.com/$1 [R=307,NE,L]
RewriteCond %{HTTP:X-Forwarded-Proto} ^https$
RewriteCond %{HTTP_HOST} ^play\.pokemonshowdown\.com$ [NC]
RewriteCond %{QUERY_STRING} ^insecure [NC]
RewriteRule ^([A-Za-z0-9-]*)$ http://play.pokemonshowdown.com/$1 [R=307,NE,L]
RewriteRule ^([A-Za-z0-9-]*)$ http://insecure.psim.us/$1 [R=307,NE,L]
# redirects (keep in sync with client.js)
RewriteRule ^appeals?\/?$ https://play.pokemonshowdown.com/view-help-request--appeal [R=302,L]

View File

@ -108,6 +108,7 @@ var yourOrigin = <?php echo json_encode($protocol . '//' . $host) ?>;
var myOrigin = 'https://<?php echo $psconfig['routes']['client'] ?>';
if (config.host) {
config.host = config.host.replace(/^localhost-([0-9]+)$/, 'localhost--$1');
if (!config.host.includes('.')) {
// parse
config.host = config.host.replace(/\b----\b/g, '::').replace(/---/g, '=').replace(/--/g, ':').replace(/-/g, '.').replace(/=/g, '-');