feat: add compatibility for fido2Credentials counter and implement no-op device token update handler

This commit is contained in:
shuaiplus
2026-02-23 23:29:00 +08:00
parent 1dfa96611a
commit 08114762bc
4 changed files with 55 additions and 1 deletions
+8 -1
View File
@@ -38,7 +38,7 @@ import { handleSync } from './handlers/sync';
// Setup handlers
import { handleSetupPage, handleSetupStatus, handleDisableSetup } from './handlers/setup';
import { handleKnownDevice, handleGetDevices } from './handlers/devices';
import { handleKnownDevice, handleGetDevices, handleUpdateDeviceToken } from './handlers/devices';
// Import handler
import { handleCiphersImport } from './handlers/import';
@@ -547,6 +547,13 @@ export async function handleRequest(request: Request, env: Env): Promise<Respons
return handleGetDevices(request, env, userId);
}
// Device push token endpoint (no-op compatibility handler)
const deviceTokenMatch = path.match(/^\/api\/devices\/identifier\/([^/]+)\/token$/i);
if (deviceTokenMatch && (method === 'PUT' || method === 'POST')) {
const deviceIdentifier = decodeURIComponent(deviceTokenMatch[1]);
return handleUpdateDeviceToken(request, env, userId, deviceIdentifier);
}
// Not found
return errorResponse('Not found', 404);