mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-08-05 14:50:11 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce3674669e | ||
|
|
aa7b87e041 | ||
|
|
e4215b4025 |
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "nodewarden",
|
"name": "nodewarden",
|
||||||
"version": "1.7.1",
|
"version": "1.7.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "nodewarden",
|
"name": "nodewarden",
|
||||||
"version": "1.7.1",
|
"version": "1.7.2",
|
||||||
"license": "LGPL-3.0",
|
"license": "LGPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@noble/hashes": "^2.2.0",
|
"@noble/hashes": "^2.2.0",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nodewarden",
|
"name": "nodewarden",
|
||||||
"version": "1.7.1",
|
"version": "1.7.2",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export const APP_VERSION = '1.7.1';
|
export const APP_VERSION = '1.7.2';
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ function buildDeviceResponse(device: Device): DeviceResponse {
|
|||||||
creationDate: device.createdAt,
|
creationDate: device.createdAt,
|
||||||
RevisionDate: device.updatedAt,
|
RevisionDate: device.updatedAt,
|
||||||
revisionDate: device.updatedAt,
|
revisionDate: device.updatedAt,
|
||||||
|
LastActivityDate: device.lastSeenAt,
|
||||||
|
lastActivityDate: device.lastSeenAt,
|
||||||
LastSeenAt: device.lastSeenAt,
|
LastSeenAt: device.lastSeenAt,
|
||||||
lastSeenAt: device.lastSeenAt,
|
lastSeenAt: device.lastSeenAt,
|
||||||
HasStoredDevice: true,
|
HasStoredDevice: true,
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
const EMPTY_FORMS_FILENAME = 'forms.v1.json';
|
||||||
|
const EMPTY_FORMS_BODY = JSON.stringify({
|
||||||
|
schemaVersion: '1.0.0',
|
||||||
|
hosts: {},
|
||||||
|
});
|
||||||
|
const EMPTY_MANIFEST_BODY = JSON.stringify({
|
||||||
|
maps: {
|
||||||
|
forms: {
|
||||||
|
v1: {
|
||||||
|
filename: EMPTY_FORMS_FILENAME,
|
||||||
|
cid: 'sha256:nodewarden-empty-fill-assist-v1',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function fillAssistJsonResponse(body: string): Response {
|
||||||
|
return new Response(body, {
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json; charset=utf-8',
|
||||||
|
'Cache-Control': 'public, max-age=3600',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function handleFillAssistManifest(): Response {
|
||||||
|
return fillAssistJsonResponse(EMPTY_MANIFEST_BODY);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function handleFillAssistForms(filename: string): Response {
|
||||||
|
if (String(filename || '').trim() !== EMPTY_FORMS_FILENAME) {
|
||||||
|
return new Response('Not found', { status: 404 });
|
||||||
|
}
|
||||||
|
return fillAssistJsonResponse(EMPTY_FORMS_BODY);
|
||||||
|
}
|
||||||
+18
-1
@@ -8,6 +8,7 @@ import {
|
|||||||
handleDownloadSendFile,
|
handleDownloadSendFile,
|
||||||
} from './handlers/sends';
|
} from './handlers/sends';
|
||||||
import { handleKnownDevice } from './handlers/devices';
|
import { handleKnownDevice } from './handlers/devices';
|
||||||
|
import { handleFillAssistForms, handleFillAssistManifest } from './handlers/fill-assist';
|
||||||
import { handleToken, handlePrelogin, handleRevocation } from './handlers/identity';
|
import { handleToken, handlePrelogin, handleRevocation } from './handlers/identity';
|
||||||
import { handleGetAccountPasskeyAssertionOptions } from './handlers/account-passkeys';
|
import { handleGetAccountPasskeyAssertionOptions } from './handlers/account-passkeys';
|
||||||
import {
|
import {
|
||||||
@@ -97,6 +98,7 @@ function buildIconServiceCsp(origin: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function buildConfigResponse(origin: string) {
|
function buildConfigResponse(origin: string) {
|
||||||
|
const fillAssistBase = `${origin}/fill-assist`;
|
||||||
return {
|
return {
|
||||||
version: LIMITS.compatibility.bitwardenServerVersion,
|
version: LIMITS.compatibility.bitwardenServerVersion,
|
||||||
gitHash: 'nodewarden',
|
gitHash: 'nodewarden',
|
||||||
@@ -109,7 +111,7 @@ function buildConfigResponse(origin: string) {
|
|||||||
notifications: origin + '/notifications',
|
notifications: origin + '/notifications',
|
||||||
icons: origin,
|
icons: origin,
|
||||||
sso: '',
|
sso: '',
|
||||||
fillAssistRules: null,
|
fillAssistRules: fillAssistBase,
|
||||||
},
|
},
|
||||||
push: {
|
push: {
|
||||||
pushTechnology: 0,
|
pushTechnology: 0,
|
||||||
@@ -125,8 +127,10 @@ function buildConfigResponse(origin: string) {
|
|||||||
'cipher-key-encryption': LIMITS.compatibility.cipherKeyEncryptionFeatureEnabled,
|
'cipher-key-encryption': LIMITS.compatibility.cipherKeyEncryptionFeatureEnabled,
|
||||||
'duo-redirect': true,
|
'duo-redirect': true,
|
||||||
'email-verification': true,
|
'email-verification': true,
|
||||||
|
'fill-assist-targeting-rules': true,
|
||||||
'pm-19051-send-email-verification': false,
|
'pm-19051-send-email-verification': false,
|
||||||
'pm-19148-innovation-archive': true,
|
'pm-19148-innovation-archive': true,
|
||||||
|
'pm-4516-devices-add-last-activity-date': true,
|
||||||
'pm-30529-webauthn-related-origins': true,
|
'pm-30529-webauthn-related-origins': true,
|
||||||
'unauth-ui-refresh': true,
|
'unauth-ui-refresh': true,
|
||||||
'web-push': false,
|
'web-push': false,
|
||||||
@@ -343,6 +347,19 @@ export async function handlePublicRoute(
|
|||||||
return jsonResponse(await buildWebBootstrapResponse(env));
|
return jsonResponse(await buildWebBootstrapResponse(env));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (path === '/fill-assist/manifest.json' && method === 'GET') {
|
||||||
|
const blocked = await enforcePublicRateLimit('public-read', LIMITS.rateLimit.publicReadRequestsPerMinute);
|
||||||
|
if (blocked) return blocked;
|
||||||
|
return handleFillAssistManifest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const fillAssistFormsMatch = path.match(/^\/fill-assist\/([^/]+)$/i);
|
||||||
|
if (fillAssistFormsMatch && method === 'GET') {
|
||||||
|
const blocked = await enforcePublicRateLimit('public-read', LIMITS.rateLimit.publicReadRequestsPerMinute);
|
||||||
|
if (blocked) return blocked;
|
||||||
|
return handleFillAssistForms(fillAssistFormsMatch[1]);
|
||||||
|
}
|
||||||
|
|
||||||
const iconMatch = path.match(/^\/icons\/([^/]+)\/icon\.png$/i);
|
const iconMatch = path.match(/^\/icons\/([^/]+)\/icon\.png$/i);
|
||||||
if (iconMatch && method === 'GET') {
|
if (iconMatch && method === 'GET') {
|
||||||
const blocked = await enforcePublicRateLimit('public-icon', LIMITS.rateLimit.publicIconRequestsPerMinute);
|
const blocked = await enforcePublicRateLimit('public-icon', LIMITS.rateLimit.publicIconRequestsPerMinute);
|
||||||
|
|||||||
@@ -307,6 +307,7 @@ export interface DeviceResponse {
|
|||||||
type: number;
|
type: number;
|
||||||
creationDate: string;
|
creationDate: string;
|
||||||
revisionDate: string;
|
revisionDate: string;
|
||||||
|
lastActivityDate?: string | null;
|
||||||
lastSeenAt?: string | null;
|
lastSeenAt?: string | null;
|
||||||
hasStoredDevice?: boolean;
|
hasStoredDevice?: boolean;
|
||||||
isTrusted: boolean;
|
isTrusted: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user