mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-20 22:49:18 +00:00
feat: allow redirecting to preset
This commit is contained in:
committed by
Carlos Valente
parent
88b8e83494
commit
b8d7324be0
@@ -34,12 +34,16 @@ export const connectSocket = () => {
|
||||
hasConnected = true;
|
||||
reconnectAttempts = 0;
|
||||
|
||||
socketSendJson('set-client-patch', {
|
||||
type: 'ontime',
|
||||
origin: window.location.origin,
|
||||
path: window.location.pathname + window.location.search,
|
||||
});
|
||||
setOnlineStatus(true);
|
||||
|
||||
if (preferredClientName) {
|
||||
socketSendJson('set-client-name', preferredClientName);
|
||||
}
|
||||
|
||||
socketSendJson('set-client-type', 'ontime');
|
||||
setOnlineStatus(true);
|
||||
};
|
||||
|
||||
websocket.onclose = () => {
|
||||
@@ -78,16 +82,14 @@ export const connectSocket = () => {
|
||||
updateDevTools({ ping: offset });
|
||||
break;
|
||||
}
|
||||
case 'client-id': {
|
||||
if (typeof payload === 'string') {
|
||||
setClientId(payload);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'client-name': {
|
||||
if (typeof payload === 'string') {
|
||||
setClientName(payload);
|
||||
case 'client': {
|
||||
if (typeof payload === 'object' || payload !== null) {
|
||||
if (payload.clientId && payload.clientName) {
|
||||
setClientId(payload.clientId);
|
||||
if (!preferredClientName) {
|
||||
setClientName(payload.clientName);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user