multi account large update

This commit is contained in:
2026-04-21 21:10:14 +03:00
parent c9da46a530
commit db78568340
7 changed files with 141 additions and 32 deletions

View File

@@ -4,7 +4,7 @@
window.fetchTowns = async function() {
try {
const res = await fetch('/dashboard/towns');
const res = await fetch('/dashboard/towns?player_id=' + window.PLAYER_ID);
window.towns = await res.json();
window.renderTowns();
window.updateServerStatus(true);
@@ -22,14 +22,14 @@ window.fetchTowns = async function() {
window.fetchClientStatus = async function() {
try {
const res = await fetch('/dashboard/client-status');
const res = await fetch('/dashboard/client-status?player_id=' + window.PLAYER_ID);
const data = await res.json();
const isOnline = data.online === true;
// Detect transition: online → offline
if (window.wasClientOnline === true && !isOnline) {
// Fail all queued commands immediately
await fetch('/dashboard/commands/fail-stale', { method: 'POST' });
await fetch('/dashboard/commands/fail-stale?player_id=' + window.PLAYER_ID, { method: 'POST' });
window.fetchLog();
}
@@ -43,7 +43,7 @@ window.fetchClientStatus = async function() {
window.fetchLog = async function() {
try {
const res = await fetch('/dashboard/commands');
const res = await fetch('/dashboard/commands?player_id=' + window.PLAYER_ID);
const cmds = await res.json();
window.renderLog(cmds);
} catch (e) {}
@@ -161,7 +161,8 @@ window.sendCommand = async function() {
town_id: town.town_id,
town_name: town.town_name,
type,
payload
payload,
player_id: window.PLAYER_ID
})
});
const data = await res.json();
@@ -184,7 +185,7 @@ window.cancelCommand = async function(id) {
window.fetchCaptchaStatus = async function() {
try {
const res = await fetch('/dashboard/captcha-status');
const res = await fetch('/dashboard/captcha-status?player_id=' + window.PLAYER_ID);
const data = await res.json();
const banner = document.getElementById('captcha-banner');
if (!banner) return;