pokemon-showdown/server/static/index.html
Guangcong Luo e7b2be606a Fix client redirect
For a long time, connecting to non-localhost servers didn't work without
an HTTPS cert. But it's now once again possible. All you need is an
IP with an open port, and a dream.

Syntax is a little different than before. To go to `1.2.3.4` at port `5000`

- before: `http://1.2.3.4-5000.psim.us`
- after: `http://1-2-3-4--5000.insecure.psim.us`

Supporting multiple dots in the URL is too complicated, unfortunately.

The other way still works: `http://1.2.3.4:5000`

And yes, I would 100% recommend that one.
2025-06-15 07:25:04 -07:00

16 lines
858 B
HTML

<!DOCTYPE html>
<script>
var host = document.location.hostname.replace(/-/g, '=').replace(/\./g, '-').replace(/:/g, '--').replace(/=/g, '---');
var currentPort = document.location.port || (document.location.protocol === 'https:' ? '443' : '80');
var defaultPort = document.location.protocol === 'https:' ? '443' : '8000';
var suffix = (currentPort !== defaultPort ? '--' + currentPort : '');
var protocol = 'https:';
if (document.location.protocol !== 'https:' && host !== 'localhost') {
protocol = 'http:';
suffix += '.insecure';
}
document.location.replace(protocol + '//' + host + suffix + '.psim.us' + document.location.pathname);
</script>
<p>This is a <a href="http://www.pokemonshowdown.com">Pok&eacute;mon Showdown</a> server!</p>
<noscript><p>You'll need to <a href="http://enable-javascript.com/en/">enable JavaScript</a> to play.</p></noscript>