Template
Add invite links with admin-configurable config creation limits.
Admins can create shareable links that allow redeeming a VPN config a set number of times (or unlimited). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -72,5 +72,24 @@ CREATE TABLE IF NOT EXISTS tunnel_state (
|
||||
data JSONB NOT NULL DEFAULT '{}'::jsonb
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS invite_links (
|
||||
id UUID PRIMARY KEY,
|
||||
name TEXT NOT NULL DEFAULT '',
|
||||
token TEXT NOT NULL UNIQUE,
|
||||
enabled BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
max_uses INTEGER NOT NULL DEFAULT 1,
|
||||
used_count INTEGER NOT NULL DEFAULT 0,
|
||||
user_id UUID,
|
||||
protocol TEXT NOT NULL DEFAULT 'xui',
|
||||
server_id INTEGER NOT NULL DEFAULT 0,
|
||||
xui_inbound_id INTEGER NOT NULL DEFAULT 0,
|
||||
password_hash TEXT,
|
||||
expires_at TIMESTAMPTZ,
|
||||
note TEXT,
|
||||
created_at TIMESTAMPTZ
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_invite_links_token ON invite_links(token);
|
||||
|
||||
INSERT INTO settings (id, data) VALUES (1, '{}'::jsonb)
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
Reference in New Issue
Block a user