v0.0.10 - Working on auth system
This commit is contained in:
@@ -17,25 +17,29 @@ CREATE TABLE IF NOT EXISTS blobs (
|
||||
CHECK (uploaded_at > 0) -- Ensure valid timestamp
|
||||
);
|
||||
|
||||
-- Server configuration table for key-value settings
|
||||
CREATE TABLE IF NOT EXISTS server_config (
|
||||
-- Unified configuration table (replaces server_config and auth_config)
|
||||
CREATE TABLE IF NOT EXISTS config (
|
||||
key TEXT PRIMARY KEY NOT NULL, -- Configuration key
|
||||
value TEXT NOT NULL, -- Configuration value
|
||||
description TEXT, -- Human-readable description
|
||||
updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')) -- Last update timestamp
|
||||
created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')), -- Creation timestamp
|
||||
updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')) -- Last update timestamp
|
||||
);
|
||||
|
||||
-- Indexes for performance optimization
|
||||
CREATE INDEX IF NOT EXISTS idx_blobs_uploaded_at ON blobs(uploaded_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_blobs_uploader_pubkey ON blobs(uploader_pubkey);
|
||||
CREATE INDEX IF NOT EXISTS idx_blobs_type ON blobs(type);
|
||||
CREATE INDEX IF NOT EXISTS idx_config_updated_at ON config(updated_at);
|
||||
|
||||
-- Insert default server configuration
|
||||
-- Insert basic server configuration
|
||||
INSERT OR IGNORE INTO server_config (key, value, description) VALUES
|
||||
-- Insert default unified configuration
|
||||
INSERT OR IGNORE INTO config (key, value, description) VALUES
|
||||
('max_file_size', '104857600', 'Maximum file size in bytes (100MB)'),
|
||||
('require_auth', 'false', 'Whether authentication is required for uploads'),
|
||||
('server_name', 'ginxsom', 'Server name for responses');
|
||||
('auth_rules_enabled', 'false', 'Whether authentication rules are enabled for uploads'),
|
||||
('server_name', 'ginxsom', 'Server name for responses'),
|
||||
('admin_pubkey', '', 'Admin public key for API access'),
|
||||
('admin_enabled', 'false', 'Whether admin API is enabled'),
|
||||
('require_nip42_auth', 'optional', 'NIP-42 authentication mode (disabled, optional, required)');
|
||||
|
||||
-- View for storage statistics
|
||||
CREATE VIEW IF NOT EXISTS storage_stats AS
|
||||
|
||||
Reference in New Issue
Block a user