mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-20 21:00:41 +00:00
Add functionality to hide setup page; implement disable setup endpoint and storage management
This commit is contained in:
@@ -2,6 +2,7 @@ import { Env, User, Cipher, Folder, Attachment } from '../types';
|
||||
|
||||
const KEYS = {
|
||||
CONFIG_REGISTERED: 'config:registered',
|
||||
CONFIG_SETUP_DISABLED: 'config:setup_disabled',
|
||||
USER_PREFIX: 'user:',
|
||||
CIPHER_PREFIX: 'cipher:',
|
||||
FOLDER_PREFIX: 'folder:',
|
||||
@@ -26,6 +27,16 @@ export class StorageService {
|
||||
await this.kv.put(KEYS.CONFIG_REGISTERED, 'true');
|
||||
}
|
||||
|
||||
// Setup page visibility
|
||||
async isSetupDisabled(): Promise<boolean> {
|
||||
const value = await this.kv.get(KEYS.CONFIG_SETUP_DISABLED);
|
||||
return value === 'true';
|
||||
}
|
||||
|
||||
async setSetupDisabled(): Promise<void> {
|
||||
await this.kv.put(KEYS.CONFIG_SETUP_DISABLED, 'true');
|
||||
}
|
||||
|
||||
// User operations
|
||||
async getUser(email: string): Promise<User | null> {
|
||||
const data = await this.kv.get(`${KEYS.USER_PREFIX}${email.toLowerCase()}`);
|
||||
|
||||
Reference in New Issue
Block a user