ui: fix messages worker

This commit is contained in:
undefined committed 2024-04-01 19:29:09 +08:00
1 parent e25db178fd
commit b540412382
1 file changed
+4
@@ -40,6 +40,10 @@ function initConn(path: string, port: MessagePort, cookie: any) {
conn.onclose = (ev) => broadcastMsg({ type: 'close', error: ev.reason });
conn.onmessage = (message) => {
if (process.env.NODE_ENV !== 'production') console.log('SharedWorker.port.onmessage: ', message);
if (message.data === 'ping') {
conn.send('pong');
return;
}
const payload = JSON.parse(message.data);
if (payload.event === 'auth') {
if (['PermissionError', 'PrivilegeError'].includes(payload.error)) {