mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-22 21:50:13 +00:00
Fix realtime sync notifications
This commit is contained in:
@@ -174,7 +174,7 @@ function buildSignalRMessagePackInvocation(
|
||||
target: string = 'ReceiveMessage'
|
||||
): Uint8Array {
|
||||
// SignalR MessagePack hub protocol uses an array-based invocation shape:
|
||||
// [type, headers, invocationId, target, arguments]
|
||||
// [type, headers, invocationId, target, arguments, streamIds]
|
||||
const encodedPayload = encodeMsgPack([
|
||||
1,
|
||||
{},
|
||||
@@ -187,6 +187,7 @@ function buildSignalRMessagePackInvocation(
|
||||
Payload: messagePayload,
|
||||
},
|
||||
],
|
||||
[],
|
||||
]);
|
||||
return frameSignalRBinary(encodedPayload);
|
||||
}
|
||||
@@ -217,7 +218,9 @@ export class NotificationsHub extends DurableObject<Env> {
|
||||
const revisionDate = String(body?.revisionDate || '').trim() || new Date().toISOString();
|
||||
const userId = String(request.headers.get('X-NodeWarden-UserId') || body?.userId || '').trim();
|
||||
const contextId = String(body?.contextId || '').trim() || null;
|
||||
const updateType = Number(body?.updateType || SIGNALR_UPDATE_TYPE_SYNC_VAULT) || SIGNALR_UPDATE_TYPE_SYNC_VAULT;
|
||||
const rawUpdateType = body?.updateType;
|
||||
const parsedUpdateType = typeof rawUpdateType === 'number' ? rawUpdateType : Number(rawUpdateType);
|
||||
const updateType = Number.isFinite(parsedUpdateType) ? parsedUpdateType : SIGNALR_UPDATE_TYPE_SYNC_VAULT;
|
||||
const targetDeviceIdentifier = String(body?.targetDeviceIdentifier || '').trim() || null;
|
||||
const payload = body?.payload && typeof body.payload === 'object'
|
||||
? body.payload
|
||||
|
||||
+1
-2
@@ -1626,7 +1626,7 @@ export default function App() {
|
||||
continue;
|
||||
}
|
||||
if (contextId && contextId === getCurrentDeviceIdentifier()) continue;
|
||||
if (updateType === SIGNALR_UPDATE_TYPE_SYNC_CIPHERS) {
|
||||
if (updateType === SIGNALR_UPDATE_TYPE_SYNC_CIPHERS || updateType === SIGNALR_UPDATE_TYPE_SYNC_VAULT) {
|
||||
if (notificationRefreshTimerRef.current !== null) {
|
||||
window.clearTimeout(notificationRefreshTimerRef.current);
|
||||
}
|
||||
@@ -1660,7 +1660,6 @@ export default function App() {
|
||||
deleteSendLocally(resourceId, revisionStamp);
|
||||
continue;
|
||||
}
|
||||
if (updateType === SIGNALR_UPDATE_TYPE_SYNC_VAULT) continue;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user