chore: update version to 1.1.0 and improve two-factor provider validation

This commit is contained in:
shuaiplus
2026-02-20 18:39:18 +08:00
parent aaf5078c8a
commit b6f2882cdf
4 changed files with 6 additions and 5 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "nodewarden", "name": "nodewarden",
"version": "1.0.0", "version": "1.1.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "nodewarden", "name": "nodewarden",
"version": "1.0.0", "version": "1.1.0",
"license": "LGPL-3.0", "license": "LGPL-3.0",
"devDependencies": { "devDependencies": {
"@cloudflare/workers-types": "^4.20260131.0", "@cloudflare/workers-types": "^4.20260131.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "nodewarden", "name": "nodewarden",
"version": "1.0.0", "version": "1.1.0",
"description": "Minimal Bitwarden-compatible server running on Cloudflare Workers", "description": "Minimal Bitwarden-compatible server running on Cloudflare Workers",
"author": "shuaiplus", "author": "shuaiplus",
"license": "LGPL-3.0", "license": "LGPL-3.0",
+2 -1
View File
@@ -113,7 +113,8 @@ export async function handleToken(request: Request, env: Env): Promise<Response>
// Optional 2FA: enabled only when TOTP_SECRET is configured in Workers env. // Optional 2FA: enabled only when TOTP_SECRET is configured in Workers env.
let trustedTwoFactorTokenToReturn: string | undefined; let trustedTwoFactorTokenToReturn: string | undefined;
if (isTotpEnabled(env.TOTP_SECRET)) { if (isTotpEnabled(env.TOTP_SECRET)) {
if (twoFactorProvider !== undefined && String(twoFactorProvider) !== '0') { const normalizedTwoFactorProvider = String(twoFactorProvider ?? '').trim();
if (normalizedTwoFactorProvider !== '' && normalizedTwoFactorProvider !== '0') {
return identityErrorResponse('Unsupported two-factor provider', 'invalid_grant', 400); return identityErrorResponse('Unsupported two-factor provider', 'invalid_grant', 400);
} }
+1 -1
View File
@@ -122,7 +122,7 @@ export class StorageService {
// --- Database initialization --- // --- Database initialization ---
// Strategy: // Strategy:
// - Run only once per isolate. // - Run only once per isolate.
// - Execute idempotent schema SQL on first DB use in each isolate. // - Execute idempotent schema SQL on first request in each isolate.
// - Keep statements idempotent so updates are safe. // - Keep statements idempotent so updates are safe.
async initializeDatabase(): Promise<void> { async initializeDatabase(): Promise<void> {
if (StorageService.schemaVerified) return; if (StorageService.schemaVerified) return;