Preact: Fix offline friend requests

In oldclient, <button type="send"> would send a message globally.
Preact client has now been updated with this behavior.

We probably still want the server to be able to handle commands sent
to offline users at some later point, though.
This commit is contained in:
Guangcong Luo
2026-05-02 10:32:21 +00:00
parent 075ff28166
commit b9538a2eae
2 changed files with 4 additions and 6 deletions

View File

@@ -485,7 +485,7 @@ class NewsPanel extends PSRoomPanel {
change = (ev: Event) => {
const target = ev.currentTarget as HTMLInputElement;
if (target.value === '1') {
document.cookie = "preactalpha=1; expires=Thu, 1 Jun 2026 12:00:00 UTC; path=/";
document.cookie = "preactalpha=1; expires=Thu, 1 Jul 2026 12:00:00 UTC; path=/";
} else {
document.cookie = "preactalpha=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
}

View File

@@ -745,13 +745,11 @@ export class PSView extends preact.Component {
elem.innerText = 'Copied!';
return true;
case 'send':
PS.send(elem.value);
return true;
case 'cmd':
const room = PS.getRoom(elem) || PS.mainmenu;
if (elem.name === 'send') {
room.sendDirect(elem.value);
} else {
room.send(elem.value);
}
room.send(elem.value);
return true;
}
return false;