feat: implement turbo mode functionality with proxy support and dashboard display
CI / lint-and-test (push) Has been cancelled
CI / lint-and-test (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import asyncpg
|
||||
|
||||
|
||||
async def ensure_app_settings(pool: asyncpg.Pool) -> None:
|
||||
await pool.execute(
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS app_settings (
|
||||
key text PRIMARY KEY,
|
||||
value text NOT NULL,
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
async def get_turbo_mode(pool: asyncpg.Pool) -> bool:
|
||||
await ensure_app_settings(pool)
|
||||
raw = await pool.fetchval("SELECT value FROM app_settings WHERE key = 'turbo_mode'")
|
||||
return str(raw).lower() in {"1", "true", "yes", "on"}
|
||||
|
||||
|
||||
async def set_turbo_mode(pool: asyncpg.Pool, enabled: bool) -> None:
|
||||
await ensure_app_settings(pool)
|
||||
await pool.execute(
|
||||
"""
|
||||
INSERT INTO app_settings (key, value, updated_at)
|
||||
VALUES ('turbo_mode', $1, now())
|
||||
ON CONFLICT (key)
|
||||
DO UPDATE SET value = EXCLUDED.value, updated_at = now()
|
||||
""",
|
||||
"true" if enabled else "false",
|
||||
)
|
||||
Reference in New Issue
Block a user