fix: invalidate tokens on permission change (medium), optimize create_user query, fix ws reconnect race

- update_permissions now calls blacklist_active_refresh_token and
  rotate_user_secret to immediately invalidate stale tokens
- create_user uses returned id from tx.run_one instead of redundant SELECT
- websocket reconnect explicitly closes old connection after token refresh
  to prevent onclose handler race condition
This commit is contained in:
2026-07-28 18:02:14 +00:00
parent 8bb3619ddc
commit a82578f342
2 changed files with 10 additions and 4 deletions
+2
View File
@@ -59,12 +59,14 @@ function _wsConnect() {
if (_wsFailCount >= 3 && !_wsRefreshing) {
_wsRefreshing = true;
const oldConn = _wsConn;
tryRefreshToken().then(ok => {
_wsRefreshing = false;
if (ok) {
_wsFailCount = 0;
_wsReconnectMs = 0;
_wsConn = null;
if (oldConn) oldConn.close();
setTimeout(_wsConnect, 100);
} else {
redirectLogin();