From 4dcecc9fc8002ec5ab1cc24615f3e7c59080c199 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Thu, 3 Apr 2025 15:47:46 -0700 Subject: [PATCH] Preact: Make client usable again A few updates seem to have made the Preact client stop working, but this restores it to working state again. --- .vscode/tasks.json | 5 ++++- play.pokemonshowdown.com/preactalpha.template.html | 2 +- play.pokemonshowdown.com/src/client-connection.ts | 4 ++++ play.pokemonshowdown.com/style/client2.css | 2 +- play.pokemonshowdown.com/testclient-beta.html | 3 ++- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a88115149..ca8fddc27 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -4,7 +4,10 @@ { "type": "npm", "script": "build", - "group": "build", + "group": { + "kind": "build", + "isDefault": true + }, "problemMatcher": [], "label": "npm: build", "detail": "node build" diff --git a/play.pokemonshowdown.com/preactalpha.template.html b/play.pokemonshowdown.com/preactalpha.template.html index 74a06014d..2f4b91b54 100644 --- a/play.pokemonshowdown.com/preactalpha.template.html +++ b/play.pokemonshowdown.com/preactalpha.template.html @@ -55,6 +55,7 @@ + @@ -81,7 +82,6 @@ - diff --git a/play.pokemonshowdown.com/src/client-connection.ts b/play.pokemonshowdown.com/src/client-connection.ts index 9bda6f874..cd951fb20 100644 --- a/play.pokemonshowdown.com/src/client-connection.ts +++ b/play.pokemonshowdown.com/src/client-connection.ts @@ -162,9 +162,13 @@ class NetRequest { } export function Net(uri: string) { + if (uri.startsWith('/') && !uri.startsWith('//') && Net.defaultRoute) uri = Net.defaultRoute + uri; + if (uri.startsWith('//') && document.location.protocol === 'file:') uri = 'https:' + uri; return new NetRequest(uri); } +Net.defaultRoute = ''; + Net.encodeQuery = function (data: string | PostData) { if (typeof data === 'string') return data; let urlencodedData = ''; diff --git a/play.pokemonshowdown.com/style/client2.css b/play.pokemonshowdown.com/style/client2.css index b116d854e..2dde43b75 100644 --- a/play.pokemonshowdown.com/style/client2.css +++ b/play.pokemonshowdown.com/style/client2.css @@ -1359,7 +1359,7 @@ a.ilink.yours { -webkit-overflow-scrolling: touch; overflow-scrolling: touch; } -.userlist-count { +.userlist-count, .userlist .userlist-count { text-align: center; padding: 2px 0; } diff --git a/play.pokemonshowdown.com/testclient-beta.html b/play.pokemonshowdown.com/testclient-beta.html index 11b3b5979..fa022f6b1 100644 --- a/play.pokemonshowdown.com/testclient-beta.html +++ b/play.pokemonshowdown.com/testclient-beta.html @@ -97,11 +97,13 @@ + + @@ -124,7 +126,6 @@ -