pokemon-showdown-client/play.pokemonshowdown.com/redirect-server.php
Guangcong Luo df301b5929 Improve support for unregistered servers
Client-side of e7b2be606a

Unregistered server URLs are now pretty different (see the source
of the link). Part of this is because of some weird change to the
web server config, part of this is because HTTPS wildcard certs don't
work infinitely deep, part of this is because Chrome now insists
on forcing HTTPS in a variety of scenarios...

Anyway, I'd love to keep supporting the old syntax but it's not
workable, and I'm really happy to have a new one that is.
2025-06-15 18:23:41 +00:00

17 lines
380 B
PHP

<?php
$host = $_REQUEST['host'] ?? '';
$roomid = $_REQUEST['roomid'] ?? '';
if (!$host) {
http_response_code(400);
die('No host specified');
}
$host = preg_replace('/-/', '=', $host);
$host = preg_replace('/\\./', '-', $host);
$host = preg_replace('/:/', '--', $host);
$host = preg_replace('/=/', '---', $host);
header('Location: https://' . $host . '.psim.us/' . $roomid);