diff --git a/play.pokemonshowdown.com/.htaccess b/play.pokemonshowdown.com/.htaccess
index 717f9bfed..8f6a16fb7 100644
--- a/play.pokemonshowdown.com/.htaccess
+++ b/play.pokemonshowdown.com/.htaccess
@@ -108,6 +108,8 @@ RewriteCond %{DOCUMENT_ROOT}/$1 !-d
RewriteRule ^([A-Za-z0-9][A-Za-z0-9-]*)/$ /$1 [R=301,L]
# Anything that looks like a roomid: connect to the server
+RewriteCond %{HTTP_COOKIE} ^.*preactalpha=1.*$
+RewriteRule ^(|[A-Za-z0-9][A-Za-z0-9-]*)$ ./preactalpha.html [L,E=INDEX_PAGE:1]
RewriteRule ^$ - [E=INDEX_PAGE:1]
RewriteRule ^(preactalpha|login|users|(dm|challenge|user|viewuser|ladder)-[a-z0-9-]*)$ ./preactalpha.html [L,E=INDEX_PAGE:1]
RewriteRule ^([A-Za-z0-9][A-Za-z0-9-]*)$ ./ [L,E=INDEX_PAGE:1]
diff --git a/play.pokemonshowdown.com/js/client-chat-tournament.js b/play.pokemonshowdown.com/js/client-chat-tournament.js
index 101e5d11b..665cfc818 100644
--- a/play.pokemonshowdown.com/js/client-chat-tournament.js
+++ b/play.pokemonshowdown.com/js/client-chat-tournament.js
@@ -603,7 +603,8 @@
TournamentBox.prototype.cloneTree = function (node) {
var clonedNode = Object.assign({}, node);
if (node.children) {
- clonedNode.children = node.children.map(function (child) { return this.cloneTree(child); });
+ var self = this;
+ clonedNode.children = node.children.map(function (child) { return self.cloneTree(child); });
}
return clonedNode;
};
@@ -631,7 +632,6 @@
}
var name = app.user.get('name');
- var nodeSize = this.nodeSize;
var newTree = this.cloneTree(data.rootNode);
if (newTree.team) newTree.highlightLink = true;
@@ -685,7 +685,7 @@
var maxBreadth = numLeaves - (depthsWithLeaves - 1) / breadthCompression;
var maxDepth = hasLeafAtDepth.length;
- var nodeSize = Object.assign({}, this.nodeSize);
+ var nodeSize = Object.assign({}, TournamentBox.nodeSize);
nodeSize.realWidth = nodeSize.width;
nodeSize.realHeight = nodeSize.height;
nodeSize.smallRealHeight = nodeSize.height / 2;
@@ -747,7 +747,7 @@
if (ev.cmdKey || ev.metaKey || ev.ctrlKey) return;
ev.preventDefault();
ev.stopPropagation();
- var roomid = $(ev.currentTarget).getAttribute('href');
+ var roomid = ev.currentTarget.getAttribute('href');
app.tryJoinRoom(roomid);
});
}
@@ -759,7 +759,7 @@
var rect = elem.append('svg:rect').classed('tournament-bracket-tree-draw', true)
.attr('rx', nodeSize.radius)
.attr('x', -nodeSize.realWidth / 2).attr('width', nodeSize.realWidth);
- rect.attr('y', -nodeSize.smallRealHeight / 2).attr('height', node.smallRealHeight);
+ rect.attr('y', -nodeSize.smallRealHeight / 2).attr('height', nodeSize.smallRealHeight);
if (node.team === name) rect.attr('stroke-dasharray', '5,5').attr('stroke-width', 2);
elem.append('svg:text').classed('tournament-bracket-tree-node-team', true)
diff --git a/play.pokemonshowdown.com/src/battle-text-parser.ts b/play.pokemonshowdown.com/src/battle-text-parser.ts
index 1ba1fb1fc..201091995 100644
--- a/play.pokemonshowdown.com/src/battle-text-parser.ts
+++ b/play.pokemonshowdown.com/src/battle-text-parser.ts
@@ -47,7 +47,7 @@ export class BattleTextParser {
switch (cmd) {
case 'chatmsg': case 'chatmsg-raw': case 'raw': case 'error': case 'html':
case 'inactive': case 'inactiveoff': case 'warning':
- case 'fieldhtml': case 'controlshtml': case 'bigerror':
+ case 'fieldhtml': case 'controlshtml': case 'pagehtml': case 'bigerror':
case 'debug': case 'tier': case 'challstr': case 'popup': case '':
return [cmd, line.slice(index + 1)];
case 'c': case 'chat': case 'uhtml': case 'uhtmlchange': case 'queryresponse': case 'showteam':
diff --git a/play.pokemonshowdown.com/src/client-main.ts b/play.pokemonshowdown.com/src/client-main.ts
index 8b8380d64..63e2dd1fd 100644
--- a/play.pokemonshowdown.com/src/client-main.ts
+++ b/play.pokemonshowdown.com/src/client-main.ts
@@ -376,7 +376,7 @@ class PSUser extends PSStreamModel {
group = '';
userid = "" as ID;
named = false;
- registered = false;
+ registered: { name: string, userid: ID } | null = null;
avatar = "1";
challstr = '';
loggingIn: string | null = null;
@@ -464,7 +464,8 @@ class PSUser extends PSStreamModel {
this.loggingIn = null;
if (data?.curuser?.loggedin) {
// success!
- this.registered = true;
+ const username = data.curuser.loggedin.username;
+ this.registered = { name: username, userid: toID(username) };
this.handleAssertion(name, data.assertion);
} else {
// wrong password
@@ -530,7 +531,7 @@ class PSUser extends PSStreamModel {
this.group = '';
this.userid = "" as ID;
this.named = false;
- this.registered = false;
+ this.registered = null;
this.update(null);
}
@@ -1144,7 +1145,8 @@ export const PS = new class extends PSModel {
this.addRoom({
id: 'rooms' as RoomID,
title: "Rooms",
- });
+ }, true);
+ this.rightPanel = this.rooms['rooms']!;
if (this.newsHTML) {
this.addRoom({
diff --git a/play.pokemonshowdown.com/src/panel-mainmenu.tsx b/play.pokemonshowdown.com/src/panel-mainmenu.tsx
index 40ff02020..ee74e2abe 100644
--- a/play.pokemonshowdown.com/src/panel-mainmenu.tsx
+++ b/play.pokemonshowdown.com/src/panel-mainmenu.tsx
@@ -96,10 +96,15 @@ export class MainMenuRoom extends PSRoom {
PSLoginServer.query(
'upkeep', { challstr }
).then(res => {
- if (!res?.loggedin) {
+ if (!res?.username) {
PS.user.initializing = false;
return;
}
+ // | , ; are not valid characters in names
+ res.username = res.username.replace(/[|,;]+/g, '');
+ if (res.loggedin) {
+ PS.user.registered = { name: res.username, userid: toID(res.username) };
+ }
PS.user.handleAssertion(res.username, res.assertion);
});
return;
@@ -377,8 +382,37 @@ class NewsPanel extends PSRoomPanel {
static readonly routes = ['news'];
static readonly title = 'News';
static readonly location = 'mini-window';
+ change = (ev: Event) => {
+ const target = ev.currentTarget as HTMLInputElement;
+ if (target.value === '1') {
+ document.cookie = "preactalpha=1; expires=Thu, 1 May 2025 12:00:00 UTC; path=/";
+ } else {
+ document.cookie = "preactalpha=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
+ }
+ if (target.value === 'leave') {
+ document.location.href = `/`;
+ }
+ };
override render() {
+ const cookieSet = document.cookie.includes('preactalpha=1');
return
+
+ This is the Preact client alpha test.
+
+
;
}
diff --git a/play.pokemonshowdown.com/src/panel-popups.tsx b/play.pokemonshowdown.com/src/panel-popups.tsx
index 21531f999..926b41789 100644
--- a/play.pokemonshowdown.com/src/panel-popups.tsx
+++ b/play.pokemonshowdown.com/src/panel-popups.tsx
@@ -559,12 +559,12 @@ class OptionsPanel extends PSRoomPanel {
{}
{PS.user.name}
-
+
{this.state.showStatusInput ? (
@@ -575,12 +575,12 @@ class OptionsPanel extends PSRoomPanel {
) : (
+ {this.state.showStatusUpdated ? 'Status Updated' : 'Status...'}
)}
{PS.user.named && (PS.user.registered ?
- :
+ :
)}
@@ -600,65 +600,41 @@ class OptionsPanel extends PSRoomPanel {
-
-
-
-
+
+
+
+
Chat
-
+
-
+
-
+
-
+
-