Remove usage of userInfo in app.js; make storage aware of connection status to avoid connecting to the server in offline mode; fix updateChaInList querying for non-existent elements and using them blindly; make websocket also check connection status on reload.

This commit is contained in:
天クマ 2026-07-16 19:36:25 -03:00
commit a021ca821f
4 changed files with 66 additions and 39 deletions

View file

@ -1,4 +1,5 @@
import { config } from "./config.js";
import { isOnline, updateOnlineStatus } from "./storage.js";
let socket = null;
let reconnectTimer = null;
@ -6,6 +7,7 @@ let currentOnMessageCallback = null;
export const websocket = {
connect(onMessageCallback) {
if (!isOnline) return;
currentOnMessageCallback = onMessageCallback;
this.disconnect(false);
@ -64,6 +66,7 @@ export const websocket = {
socket = null;
reconnectTimer = setTimeout(() => {
updateOnlineStatus();
this.connect(currentOnMessageCallback);
}, 5000);
};