Upload files to "/"
This commit is contained in:
+506
@@ -0,0 +1,506 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sqlite3
|
||||
import threading
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent
|
||||
load_dotenv(BASE_DIR / "config.env")
|
||||
DB_PATH = Path(
|
||||
os.getenv("DB_PATH", str(BASE_DIR / "media_library.db"))
|
||||
).expanduser().resolve()
|
||||
|
||||
CACHE_JOB_POLL_SECONDS = max(
|
||||
0.25,
|
||||
float(os.getenv("CACHE_JOB_POLL_SECONDS", "1")),
|
||||
)
|
||||
CACHE_JOB_KEEP = max(
|
||||
20,
|
||||
int(os.getenv("CACHE_JOB_KEEP", "200")),
|
||||
)
|
||||
|
||||
_WORKER = None
|
||||
_STOP = threading.Event()
|
||||
|
||||
|
||||
def _db():
|
||||
db = sqlite3.connect(DB_PATH, timeout=30)
|
||||
db.row_factory = sqlite3.Row
|
||||
return db
|
||||
|
||||
|
||||
def init_cache_jobs_db():
|
||||
with _db() as db:
|
||||
db.executescript("""
|
||||
CREATE TABLE IF NOT EXISTS cache_jobs (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
user_id INTEGER,
|
||||
video_id TEXT NOT NULL,
|
||||
mode TEXT NOT NULL,
|
||||
title TEXT NOT NULL DEFAULT '',
|
||||
artist TEXT NOT NULL DEFAULT '',
|
||||
thumbnail TEXT NOT NULL DEFAULT '',
|
||||
duration_seconds REAL,
|
||||
status TEXT NOT NULL DEFAULT 'queued',
|
||||
progress REAL NOT NULL DEFAULT 0,
|
||||
message TEXT NOT NULL DEFAULT '',
|
||||
error TEXT NOT NULL DEFAULT '',
|
||||
output_path TEXT NOT NULL DEFAULT '',
|
||||
is_live INTEGER NOT NULL DEFAULT 0,
|
||||
cancel_requested INTEGER NOT NULL DEFAULT 0,
|
||||
created_at INTEGER NOT NULL,
|
||||
started_at INTEGER,
|
||||
finished_at INTEGER
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_cache_jobs_status
|
||||
ON cache_jobs(status, created_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_cache_jobs_video
|
||||
ON cache_jobs(video_id, mode);
|
||||
""")
|
||||
|
||||
columns = {
|
||||
row["name"]
|
||||
for row in db.execute("PRAGMA table_info(cache_jobs)").fetchall()
|
||||
}
|
||||
for name, ddl in (
|
||||
("is_live", "INTEGER NOT NULL DEFAULT 0"),
|
||||
("cancel_requested", "INTEGER NOT NULL DEFAULT 0"),
|
||||
):
|
||||
if name not in columns:
|
||||
db.execute(
|
||||
f"ALTER TABLE cache_jobs ADD COLUMN {name} {ddl}"
|
||||
)
|
||||
|
||||
# A finite VOD job can be retried after restart. A live recording
|
||||
# cannot be resumed continuously, so mark it interrupted instead.
|
||||
db.execute(
|
||||
"""UPDATE cache_jobs
|
||||
SET status='failed',
|
||||
message='interrupted by service restart',
|
||||
error='Live recording was interrupted by service restart.',
|
||||
finished_at=?,
|
||||
cancel_requested=0
|
||||
WHERE status='running' AND is_live=1""",
|
||||
(int(time.time()),),
|
||||
)
|
||||
db.execute(
|
||||
"""UPDATE cache_jobs
|
||||
SET status='queued',
|
||||
progress=0,
|
||||
message='requeued after service restart',
|
||||
started_at=NULL,
|
||||
cancel_requested=0
|
||||
WHERE status='running' AND is_live=0"""
|
||||
)
|
||||
db.commit()
|
||||
|
||||
|
||||
def enqueue_cache_job(
|
||||
*,
|
||||
user_id: int | None,
|
||||
video_id: str,
|
||||
mode: str,
|
||||
title: str = "",
|
||||
artist: str = "",
|
||||
thumbnail: str = "",
|
||||
duration_seconds=None,
|
||||
):
|
||||
mode = str(mode or "").strip().lower()
|
||||
if mode not in {"video", "music"}:
|
||||
raise ValueError("mode must be 'video' or 'music'")
|
||||
|
||||
video_id = str(video_id or "").strip()
|
||||
if not video_id:
|
||||
raise ValueError("video_id is required")
|
||||
|
||||
now = int(time.time())
|
||||
with _db() as db:
|
||||
existing = db.execute(
|
||||
"""SELECT * FROM cache_jobs
|
||||
WHERE video_id=? AND mode=?
|
||||
AND status IN ('queued','running')
|
||||
ORDER BY id DESC LIMIT 1""",
|
||||
(video_id, mode),
|
||||
).fetchone()
|
||||
|
||||
if existing:
|
||||
return dict(existing)
|
||||
|
||||
cur = db.execute(
|
||||
"""INSERT INTO cache_jobs(
|
||||
user_id,video_id,mode,title,artist,thumbnail,duration_seconds,
|
||||
status,progress,message,is_live,cancel_requested,created_at
|
||||
) VALUES(?,?,?,?,?,?,?,'queued',0,'queued',0,0,?)""",
|
||||
(
|
||||
user_id,
|
||||
video_id,
|
||||
mode,
|
||||
title,
|
||||
artist,
|
||||
thumbnail,
|
||||
duration_seconds,
|
||||
now,
|
||||
),
|
||||
)
|
||||
job_id = int(cur.lastrowid)
|
||||
db.commit()
|
||||
|
||||
return get_cache_job(job_id)
|
||||
|
||||
|
||||
def get_cache_job(job_id: int):
|
||||
with _db() as db:
|
||||
row = db.execute(
|
||||
"SELECT * FROM cache_jobs WHERE id=?",
|
||||
(int(job_id),),
|
||||
).fetchone()
|
||||
return dict(row) if row else None
|
||||
|
||||
|
||||
def list_cache_jobs(limit: int = 100):
|
||||
limit = max(1, min(int(limit or 100), 500))
|
||||
with _db() as db:
|
||||
rows = db.execute(
|
||||
"""SELECT * FROM cache_jobs
|
||||
ORDER BY
|
||||
CASE status
|
||||
WHEN 'running' THEN 0
|
||||
WHEN 'queued' THEN 1
|
||||
ELSE 2
|
||||
END,
|
||||
id DESC
|
||||
LIMIT ?""",
|
||||
(limit,),
|
||||
).fetchall()
|
||||
return [dict(row) for row in rows]
|
||||
|
||||
|
||||
def clear_cache_jobs(statuses=None):
|
||||
statuses = statuses or ("complete", "failed", "cancelled")
|
||||
allowed = {"complete", "failed", "cancelled"}
|
||||
statuses = [
|
||||
str(status).lower()
|
||||
for status in statuses
|
||||
if str(status).lower() in allowed
|
||||
]
|
||||
if not statuses:
|
||||
return 0
|
||||
|
||||
placeholders = ",".join("?" for _ in statuses)
|
||||
with _db() as db:
|
||||
cur = db.execute(
|
||||
f"DELETE FROM cache_jobs WHERE status IN ({placeholders})",
|
||||
statuses,
|
||||
)
|
||||
db.commit()
|
||||
return int(cur.rowcount or 0)
|
||||
|
||||
|
||||
def remove_cache_job(job_id: int):
|
||||
with _db() as db:
|
||||
row = db.execute(
|
||||
"SELECT status FROM cache_jobs WHERE id=?",
|
||||
(int(job_id),),
|
||||
).fetchone()
|
||||
if not row:
|
||||
return False
|
||||
if row["status"] not in {"complete", "failed", "cancelled"}:
|
||||
raise ValueError("Only finished jobs can be removed.")
|
||||
db.execute("DELETE FROM cache_jobs WHERE id=?", (int(job_id),))
|
||||
db.commit()
|
||||
return True
|
||||
|
||||
|
||||
def retry_cache_job(job_id: int):
|
||||
with _db() as db:
|
||||
row = db.execute(
|
||||
"SELECT * FROM cache_jobs WHERE id=?",
|
||||
(int(job_id),),
|
||||
).fetchone()
|
||||
if not row:
|
||||
raise ValueError("Cache job not found.")
|
||||
if row["status"] not in {"failed", "cancelled"}:
|
||||
raise ValueError("Only failed or cancelled jobs can be retried.")
|
||||
|
||||
db.execute(
|
||||
"""UPDATE cache_jobs SET
|
||||
status='queued',
|
||||
progress=0,
|
||||
message='queued',
|
||||
error='',
|
||||
output_path='',
|
||||
is_live=0,
|
||||
cancel_requested=0,
|
||||
started_at=NULL,
|
||||
finished_at=NULL
|
||||
WHERE id=?""",
|
||||
(int(job_id),),
|
||||
)
|
||||
db.commit()
|
||||
return get_cache_job(job_id)
|
||||
|
||||
|
||||
def cancel_cache_job(job_id: int):
|
||||
with _db() as db:
|
||||
row = db.execute(
|
||||
"SELECT * FROM cache_jobs WHERE id=?",
|
||||
(int(job_id),),
|
||||
).fetchone()
|
||||
if not row:
|
||||
raise ValueError("Cache job not found.")
|
||||
|
||||
if row["status"] == "queued":
|
||||
db.execute(
|
||||
"""UPDATE cache_jobs SET
|
||||
status='cancelled',
|
||||
progress=0,
|
||||
message='cancelled',
|
||||
cancel_requested=1,
|
||||
finished_at=?
|
||||
WHERE id=?""",
|
||||
(int(time.time()), int(job_id)),
|
||||
)
|
||||
elif row["status"] == "running":
|
||||
db.execute(
|
||||
"""UPDATE cache_jobs SET
|
||||
cancel_requested=1,
|
||||
message=CASE
|
||||
WHEN is_live=1 THEN 'stopping live recording…'
|
||||
ELSE 'cancelling…'
|
||||
END
|
||||
WHERE id=?""",
|
||||
(int(job_id),),
|
||||
)
|
||||
elif row["status"] in {"complete", "failed", "cancelled"}:
|
||||
return dict(row)
|
||||
db.commit()
|
||||
|
||||
return get_cache_job(job_id)
|
||||
|
||||
|
||||
def _update_job(job_id, **values):
|
||||
if not values:
|
||||
return
|
||||
columns = []
|
||||
args = []
|
||||
for key, value in values.items():
|
||||
columns.append(f"{key}=?")
|
||||
args.append(value)
|
||||
args.append(int(job_id))
|
||||
with _db() as db:
|
||||
db.execute(
|
||||
f"UPDATE cache_jobs SET {', '.join(columns)} WHERE id=?",
|
||||
args,
|
||||
)
|
||||
db.commit()
|
||||
|
||||
|
||||
def _cancel_requested(job_id):
|
||||
with _db() as db:
|
||||
row = db.execute(
|
||||
"SELECT cancel_requested FROM cache_jobs WHERE id=?",
|
||||
(int(job_id),),
|
||||
).fetchone()
|
||||
return bool(row and row["cancel_requested"])
|
||||
|
||||
|
||||
def _claim_next_job():
|
||||
with _db() as db:
|
||||
db.execute("BEGIN IMMEDIATE")
|
||||
row = db.execute(
|
||||
"""SELECT * FROM cache_jobs
|
||||
WHERE status='queued'
|
||||
ORDER BY id
|
||||
LIMIT 1"""
|
||||
).fetchone()
|
||||
if not row:
|
||||
db.commit()
|
||||
return None
|
||||
|
||||
if row["cancel_requested"]:
|
||||
db.execute(
|
||||
"""UPDATE cache_jobs
|
||||
SET status='cancelled',
|
||||
message='cancelled',
|
||||
finished_at=?
|
||||
WHERE id=?""",
|
||||
(int(time.time()), int(row["id"])),
|
||||
)
|
||||
db.commit()
|
||||
return None
|
||||
|
||||
now = int(time.time())
|
||||
updated = db.execute(
|
||||
"""UPDATE cache_jobs
|
||||
SET status='running',
|
||||
started_at=?,
|
||||
progress=0,
|
||||
message='starting',
|
||||
error='',
|
||||
cancel_requested=0
|
||||
WHERE id=? AND status='queued'""",
|
||||
(now, int(row["id"])),
|
||||
)
|
||||
db.commit()
|
||||
|
||||
if updated.rowcount != 1:
|
||||
return None
|
||||
|
||||
return get_cache_job(int(row["id"]))
|
||||
|
||||
|
||||
def _prune_jobs():
|
||||
with _db() as db:
|
||||
ids = [
|
||||
row["id"]
|
||||
for row in db.execute(
|
||||
"""SELECT id FROM cache_jobs
|
||||
WHERE status IN ('complete','failed','cancelled')
|
||||
ORDER BY id DESC
|
||||
LIMIT -1 OFFSET ?""",
|
||||
(CACHE_JOB_KEEP,),
|
||||
).fetchall()
|
||||
]
|
||||
if ids:
|
||||
placeholders = ",".join("?" for _ in ids)
|
||||
db.execute(
|
||||
f"DELETE FROM cache_jobs WHERE id IN ({placeholders})",
|
||||
ids,
|
||||
)
|
||||
db.commit()
|
||||
|
||||
|
||||
def _run_job(job):
|
||||
job_id = int(job["id"])
|
||||
|
||||
def progress(percent, message="caching"):
|
||||
values = {
|
||||
"progress": max(
|
||||
0.0,
|
||||
min(100.0, float(percent or 0)),
|
||||
),
|
||||
"message": str(message or ""),
|
||||
}
|
||||
if str(message or "").startswith("recording live"):
|
||||
values["is_live"] = 1
|
||||
_update_job(job_id, **values)
|
||||
|
||||
try:
|
||||
if job["mode"] == "video":
|
||||
from youtube_stream import (
|
||||
CacheJobCancelled,
|
||||
build_youtube_video_cache,
|
||||
)
|
||||
|
||||
try:
|
||||
path, _cached = build_youtube_video_cache(
|
||||
job["video_id"],
|
||||
progress_callback=progress,
|
||||
cancel_check=lambda: _cancel_requested(job_id),
|
||||
)
|
||||
except CacheJobCancelled as cancelled:
|
||||
_update_job(
|
||||
job_id,
|
||||
status="cancelled",
|
||||
progress=100 if cancelled.output_path else 0,
|
||||
message=(
|
||||
"live recording saved"
|
||||
if cancelled.output_path
|
||||
else "cancelled"
|
||||
),
|
||||
output_path=str(cancelled.output_path or ""),
|
||||
finished_at=int(time.time()),
|
||||
)
|
||||
return
|
||||
|
||||
else:
|
||||
from youtube_stream import (
|
||||
CacheJobCancelled,
|
||||
build_seekable_music_cache,
|
||||
)
|
||||
from music import register_cached_youtube_audio
|
||||
|
||||
try:
|
||||
path, duration, _cached = build_seekable_music_cache(
|
||||
job["video_id"],
|
||||
progress_callback=progress,
|
||||
cancel_check=lambda: _cancel_requested(job_id),
|
||||
)
|
||||
except CacheJobCancelled:
|
||||
_update_job(
|
||||
job_id,
|
||||
status="cancelled",
|
||||
progress=0,
|
||||
message="cancelled",
|
||||
finished_at=int(time.time()),
|
||||
)
|
||||
return
|
||||
|
||||
register_cached_youtube_audio(
|
||||
video_id=job["video_id"],
|
||||
path=path,
|
||||
title=job.get("title") or "",
|
||||
artist=job.get("artist") or "",
|
||||
thumbnail=job.get("thumbnail") or "",
|
||||
duration=duration or job.get("duration_seconds"),
|
||||
)
|
||||
|
||||
_update_job(
|
||||
job_id,
|
||||
status="complete",
|
||||
progress=100,
|
||||
message=(
|
||||
"live recording complete"
|
||||
if get_cache_job(job_id).get("is_live")
|
||||
else "complete"
|
||||
),
|
||||
output_path=str(path),
|
||||
finished_at=int(time.time()),
|
||||
)
|
||||
|
||||
except Exception as error:
|
||||
_update_job(
|
||||
job_id,
|
||||
status="failed",
|
||||
message="failed",
|
||||
error=str(error)[:4000],
|
||||
finished_at=int(time.time()),
|
||||
)
|
||||
print(
|
||||
"[CACHE] job failed",
|
||||
{
|
||||
"job_id": job_id,
|
||||
"mode": job.get("mode"),
|
||||
"video_id": job.get("video_id"),
|
||||
"error": str(error),
|
||||
},
|
||||
flush=True,
|
||||
)
|
||||
|
||||
|
||||
def _worker_loop():
|
||||
while not _STOP.is_set():
|
||||
job = _claim_next_job()
|
||||
if not job:
|
||||
_STOP.wait(CACHE_JOB_POLL_SECONDS)
|
||||
continue
|
||||
_run_job(job)
|
||||
_prune_jobs()
|
||||
|
||||
|
||||
def start_cache_worker():
|
||||
global _WORKER
|
||||
if _WORKER and _WORKER.is_alive():
|
||||
return
|
||||
_STOP.clear()
|
||||
_WORKER = threading.Thread(
|
||||
target=_worker_loop,
|
||||
daemon=True,
|
||||
name="media-cache-worker",
|
||||
)
|
||||
_WORKER.start()
|
||||
@@ -0,0 +1,59 @@
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from library_index import update_transcoded_media
|
||||
from transcode_planner import sanitize_filename
|
||||
|
||||
def safe_transcode_output(src_path, transcode_root):
|
||||
src = Path(src_path)
|
||||
dest = transcode_root / src.name
|
||||
|
||||
# If filename already ends with _dup.ext, don't double it
|
||||
if dest.stem.endswith("_dup"):
|
||||
base = dest.stem # keep the _dup
|
||||
suffix = dest.suffix
|
||||
dest_file = dest.parent / f"{base}{suffix}"
|
||||
else:
|
||||
dest_file = dest
|
||||
# Check if file exists and append _dup if needed
|
||||
while dest_file.exists():
|
||||
dest_file = dest_file.with_name(dest_file.stem + "_dup" + dest_file.suffix)
|
||||
return dest_file
|
||||
|
||||
def run_transcode(plan, transcode_root):
|
||||
input_path = Path(plan.input_path)
|
||||
|
||||
output_name = sanitize_filename(input_path.name)
|
||||
output_path = Path(transcode_root) / output_name
|
||||
output_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Fixed scale filter: ensure dimensions are divisible by 2
|
||||
ffmpeg_cmd = [
|
||||
'ffmpeg', '-i', str(input_path),
|
||||
'-vf', 'scale=trunc(iw/2)*2:trunc(ih/2)*2', # Simplified and reliable
|
||||
'-c:v', 'libx264', '-c:a', 'aac', str(output_path)
|
||||
]
|
||||
|
||||
print(f"Running FFmpeg: {' '.join(ffmpeg_cmd)}")
|
||||
|
||||
try:
|
||||
# Run FFmpeg with subprocess and capture output for debugging
|
||||
result = subprocess.run(
|
||||
ffmpeg_cmd, check=True, capture_output=True, text=True
|
||||
)
|
||||
print("FFmpeg output:", result.stdout)
|
||||
print("FFmpeg error:", result.stderr)
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error during transcoding: {e}")
|
||||
print(f"FFmpeg failed with error code: {e.returncode}")
|
||||
print(f"FFmpeg output: {e.output}")
|
||||
print(f"FFmpeg stderr: {e.stderr}")
|
||||
raise
|
||||
|
||||
update_transcoded_media({
|
||||
"source_path": str(input_path),
|
||||
"output_path": str(output_path),
|
||||
"codec_video": plan.video_codec,
|
||||
"codec_audio": plan.audio_codec,
|
||||
"resolution": None
|
||||
})
|
||||
+951
@@ -0,0 +1,951 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0"
|
||||
>
|
||||
|
||||
<title>Kronic Krusaders Chat</title>
|
||||
|
||||
<link rel="icon" href="data:,">
|
||||
<link rel="stylesheet" href="/css/screenshare.css?v=20261031-2">
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="/css/index.css?v=20261101-1"
|
||||
>
|
||||
|
||||
<script
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/livekit-client/2.15.7/livekit-client.umd.min.js"
|
||||
defer
|
||||
></script>
|
||||
|
||||
<script src="/js/install-config.js?v=20261031-2" defer></script>
|
||||
<script src="/js/app-config.js?v=20261102-bridge1" defer></script>
|
||||
<script src="/js/app-auth.js?v=20261031-1" defer></script>
|
||||
<script src="/js/utils.js?v=20261031-1" defer></script>
|
||||
<script src="/js/audio-settings.js?v=20261031-1" defer></script>
|
||||
<script src="/js/storage.js?v=20261031-1" defer></script>
|
||||
<script src="/js/tool-windows.js?v=20261102-bridge1" defer></script>
|
||||
<script src="/js/chat-controller.js?v=20261031-1" defer></script>
|
||||
<script src="/js/media-controller.js?v=20261102-bridge1" defer></script>
|
||||
<script src="/js/participants.js?v=20261031-1" defer></script>
|
||||
<script src="/js/screenshare.js?v=20261031-1" defer></script>
|
||||
<script src="/js/room-auth.js?v=20261031-1" defer></script>
|
||||
<script src="/js/livekit-controller.js?v=20261031-1" defer></script>
|
||||
<script src="/js/message-router.js?v=20261102-bridge1" defer></script>
|
||||
<script src="/js/app-init.js?v=20261102-bridge1" defer></script>
|
||||
<script src="/js/chat.js?v=20261031-1" defer></script>
|
||||
<script src="/js/ui-fixes.js?v=20261031-1" defer></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div
|
||||
id="roomAuthModal"
|
||||
class="room-auth-modal"
|
||||
hidden
|
||||
>
|
||||
<div
|
||||
class="room-auth-backdrop"
|
||||
data-room-auth-close
|
||||
></div>
|
||||
|
||||
<section
|
||||
class="room-auth-dialog"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="roomAuthTitle"
|
||||
>
|
||||
<header class="room-auth-header">
|
||||
<h2 id="roomAuthTitle">
|
||||
Join Room
|
||||
</h2>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="window-close-button"
|
||||
onclick="closeRoomAuthModal()"
|
||||
aria-label="Close"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<div class="room-auth-content">
|
||||
<p id="roomAuthMessage"></p>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="roomAuthPassword">
|
||||
Room Password
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="password"
|
||||
id="roomAuthPassword"
|
||||
autocomplete="off"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="roomAuthConfirmGroup"
|
||||
class="form-group"
|
||||
hidden
|
||||
>
|
||||
<label for="roomAuthPasswordConfirm">
|
||||
Confirm Password
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="password"
|
||||
id="roomAuthPasswordConfirm"
|
||||
autocomplete="off"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="roomAuthError"
|
||||
class="room-auth-error"
|
||||
role="alert"
|
||||
hidden
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<footer class="room-auth-actions">
|
||||
<button
|
||||
type="button"
|
||||
class="action-button secondary-button"
|
||||
onclick="closeRoomAuthModal()"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
id="roomAuthSubmitBtn"
|
||||
class="action-button primary-button"
|
||||
onclick="submitRoomAuthentication()"
|
||||
>
|
||||
Join Room
|
||||
</button>
|
||||
</footer>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- Internal avatar state: used by picker and LiveKit; not a sidebar setting. -->
|
||||
<input type="hidden" id="avatarUrl" value="">
|
||||
|
||||
<div class="app-shell">
|
||||
<header class="topbar">
|
||||
<div class="brand">
|
||||
<div class="brand-icon">
|
||||
KK
|
||||
</div>
|
||||
|
||||
<div class="brand-text">
|
||||
<h1>Kronic Krusaders</h1>
|
||||
<span>Hangout Chat Platform</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="windowTaskbar"
|
||||
class="window-taskbar"
|
||||
aria-label="Minimized windows"
|
||||
></div>
|
||||
|
||||
<div class="topbar-tools">
|
||||
<button
|
||||
type="button"
|
||||
id="mobileAudioMenuBtn"
|
||||
class="icon-button mobile-menu-button"
|
||||
onclick="Kronick.toggleMobileSidebar()"
|
||||
aria-controls="connectionPanel"
|
||||
aria-expanded="false"
|
||||
title="Audio settings"
|
||||
>
|
||||
<span class="button-icon">⚙</span>
|
||||
<span class="button-label">AUDIO</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="icon-button icon-only-button"
|
||||
onclick="openMusicBrowser()"
|
||||
title="Media"
|
||||
aria-label="Open media browser"
|
||||
>
|
||||
<span class="button-icon">🎵</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="icon-button icon-only-button"
|
||||
onclick="openGiphyBrowser()"
|
||||
title="GIF"
|
||||
aria-label="Open GIF browser"
|
||||
>
|
||||
<span class="button-icon">🙂</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
id="chatToolButton"
|
||||
class="icon-button icon-only-button"
|
||||
onclick="openChatWindow()"
|
||||
title="Chat"
|
||||
aria-label="Open chat"
|
||||
>
|
||||
<span class="button-icon">💬</span>
|
||||
|
||||
<span
|
||||
id="chatUnreadCount"
|
||||
class="chat-unread-count"
|
||||
data-count="0"
|
||||
hidden
|
||||
></span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
id="screenShareBtn"
|
||||
type="button"
|
||||
class="icon-button icon-only-button"
|
||||
onclick="toggleScreenShare()"
|
||||
title="Screen Share"
|
||||
aria-label="Start or stop screen sharing"
|
||||
disabled
|
||||
>
|
||||
<span class="button-icon screen-share-icon"></span>
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="workspace">
|
||||
<aside
|
||||
id="connectionPanel"
|
||||
class="connection-panel"
|
||||
>
|
||||
<section class="panel-section">
|
||||
<div class="section-heading">
|
||||
<span>Voice Connection</span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="roomName">
|
||||
Assigned Room
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
id="roomName"
|
||||
placeholder="Room name"
|
||||
list="savedRooms"
|
||||
autocomplete="on"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="userName">
|
||||
Account / Chat Name
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
id="userName"
|
||||
placeholder="Enter chat name"
|
||||
list="savedNames"
|
||||
autocomplete="nickname"
|
||||
>
|
||||
</div>
|
||||
|
||||
<datalist id="savedRooms"></datalist>
|
||||
<datalist id="savedNames"></datalist>
|
||||
|
||||
<div class="connection-actions">
|
||||
<button
|
||||
type="button"
|
||||
id="joinBtn"
|
||||
class="action-button primary-button"
|
||||
onclick="connect()"
|
||||
>
|
||||
<span>Join Voice</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
id="muteBtn"
|
||||
class="action-button secondary-button"
|
||||
onclick="toggleMute()"
|
||||
disabled
|
||||
>
|
||||
<span>Mute</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
id="leaveBtn"
|
||||
class="action-button danger-button"
|
||||
onclick="disconnect()"
|
||||
disabled
|
||||
>
|
||||
<span>Leave</span>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel-section audio-settings-section">
|
||||
<div class="section-heading audio-heading">
|
||||
<span>Mic & Audio Settings</span>
|
||||
<span class="settings-saved-note">
|
||||
Saved per device
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<details class="audio-setting-group audio-collapsible">
|
||||
<summary class="audio-group-title">
|
||||
Voice activation
|
||||
</summary>
|
||||
|
||||
<label
|
||||
class="compact-toggle"
|
||||
for="voiceActivationToggle"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
id="voiceActivationToggle"
|
||||
checked
|
||||
>
|
||||
<span>
|
||||
Only transmit when I speak
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<div class="audio-control">
|
||||
<div class="audio-control-label">
|
||||
<label for="vadThreshold">
|
||||
Voice activation level
|
||||
</label>
|
||||
|
||||
<span
|
||||
id="vadThresholdVal"
|
||||
class="audio-value"
|
||||
>
|
||||
-45 dB
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<input
|
||||
type="range"
|
||||
id="vadThreshold"
|
||||
min="-80"
|
||||
max="-10"
|
||||
value="-45"
|
||||
step="1"
|
||||
>
|
||||
|
||||
<div class="range-ends">
|
||||
<span>Picks up quiet voice</span>
|
||||
<span>Voice must be louder</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="voice-meter-wrap"
|
||||
aria-label="Current microphone activity"
|
||||
>
|
||||
<div class="voice-meter-labels">
|
||||
<span>No voice activity</span>
|
||||
|
||||
<span id="voiceMeterDb">
|
||||
-∞ dB
|
||||
</span>
|
||||
|
||||
<span>Max voice activity</span>
|
||||
</div>
|
||||
|
||||
<div class="voice-meter">
|
||||
<div
|
||||
id="voiceMeterFill"
|
||||
class="voice-meter-fill"
|
||||
></div>
|
||||
|
||||
<div
|
||||
id="voiceThresholdMarker"
|
||||
class="voice-threshold-marker"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="audio-control">
|
||||
<div class="audio-control-label">
|
||||
<label for="vadHold">
|
||||
Keep mic open after speech
|
||||
</label>
|
||||
|
||||
<span
|
||||
id="vadHoldVal"
|
||||
class="audio-value"
|
||||
>
|
||||
200 ms
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<input
|
||||
type="range"
|
||||
id="vadHold"
|
||||
min="0"
|
||||
max="1200"
|
||||
value="200"
|
||||
step="25"
|
||||
>
|
||||
|
||||
<div class="range-ends">
|
||||
<span>Snappy</span>
|
||||
<span>Natural pauses</span>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details class="audio-setting-group audio-collapsible">
|
||||
<summary class="audio-group-title">
|
||||
Noise suppression
|
||||
</summary>
|
||||
|
||||
<label
|
||||
class="compact-toggle"
|
||||
for="noiseSuppressionToggle"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
id="noiseSuppressionToggle"
|
||||
checked
|
||||
>
|
||||
|
||||
<span>
|
||||
Enable noise suppression
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<div class="audio-control">
|
||||
<label for="noiseSuppressionMode">
|
||||
Suppression system
|
||||
</label>
|
||||
|
||||
<select
|
||||
id="noiseSuppressionMode"
|
||||
class="audio-select"
|
||||
>
|
||||
<option value="browser">
|
||||
Browser — light / compatible
|
||||
</option>
|
||||
|
||||
<option value="rnnoise">
|
||||
RNNoise — stronger / natural voice
|
||||
</option>
|
||||
|
||||
<option value="hybrid" selected>
|
||||
Hybrid — browser + RNNoise
|
||||
</option>
|
||||
|
||||
<option value="off">
|
||||
Off — raw microphone
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<div
|
||||
id="noiseModeHelp"
|
||||
class="control-help"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<details
|
||||
class="audio-advanced"
|
||||
id="noiseAdvanced"
|
||||
>
|
||||
<summary>
|
||||
Fine tuning
|
||||
</summary>
|
||||
|
||||
<div class="advanced-content">
|
||||
<div
|
||||
class="audio-control"
|
||||
id="rnnoiseStrengthControl"
|
||||
>
|
||||
<div class="audio-control-label">
|
||||
<label for="rnnoiseStrength">
|
||||
RNNoise mix
|
||||
</label>
|
||||
|
||||
<span
|
||||
id="rnnoiseStrengthVal"
|
||||
class="audio-value"
|
||||
>
|
||||
100%
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<input
|
||||
type="range"
|
||||
id="rnnoiseStrength"
|
||||
min="0"
|
||||
max="100"
|
||||
value="100"
|
||||
step="5"
|
||||
>
|
||||
|
||||
<div class="range-ends">
|
||||
<span>
|
||||
More original mic
|
||||
</span>
|
||||
|
||||
<span>
|
||||
More cleaned audio
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label
|
||||
class="compact-toggle"
|
||||
for="echoCancellationToggle"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
id="echoCancellationToggle"
|
||||
checked
|
||||
>
|
||||
|
||||
<span>
|
||||
Echo cancellation
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<label
|
||||
class="compact-toggle"
|
||||
for="autoGainToggle"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
id="autoGainToggle"
|
||||
checked
|
||||
>
|
||||
|
||||
<span>
|
||||
Automatic microphone gain
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
id="applyAudioProcessingBtn"
|
||||
class="audio-apply-button"
|
||||
>
|
||||
Apply suppression changes
|
||||
</button>
|
||||
|
||||
<div
|
||||
id="audioRestartHint"
|
||||
class="control-help restart-hint"
|
||||
>
|
||||
Changes are saved automatically.
|
||||
Apply them now if you are already connected.
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details class="audio-setting-group audio-collapsible">
|
||||
<summary class="audio-group-title">
|
||||
Spatial audio
|
||||
</summary>
|
||||
|
||||
<label
|
||||
class="compact-toggle"
|
||||
for="spatialAudioToggle"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
id="spatialAudioToggle"
|
||||
checked
|
||||
>
|
||||
|
||||
<span>
|
||||
Position voices around me
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<div class="audio-control">
|
||||
<div class="audio-control-label">
|
||||
<label for="spatialWidth">
|
||||
Left / right separation
|
||||
</label>
|
||||
|
||||
<span
|
||||
id="spatialWidthVal"
|
||||
class="audio-value"
|
||||
>
|
||||
100%
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<input
|
||||
type="range"
|
||||
id="spatialWidth"
|
||||
min="0"
|
||||
max="200"
|
||||
value="100"
|
||||
step="5"
|
||||
>
|
||||
|
||||
<div class="range-ends">
|
||||
<span>Centered</span>
|
||||
<span>Wide</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<details class="audio-advanced">
|
||||
<summary>
|
||||
Fine tuning
|
||||
</summary>
|
||||
|
||||
<div class="advanced-content">
|
||||
<div class="audio-control">
|
||||
<div class="audio-control-label">
|
||||
<label for="spatialDepth">
|
||||
Front / back depth
|
||||
</label>
|
||||
|
||||
<span
|
||||
id="spatialDepthVal"
|
||||
class="audio-value"
|
||||
>
|
||||
100%
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<input
|
||||
type="range"
|
||||
id="spatialDepth"
|
||||
min="0"
|
||||
max="200"
|
||||
value="100"
|
||||
step="5"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="audio-control">
|
||||
<div class="audio-control-label">
|
||||
<label for="spatialFalloff">
|
||||
Distance volume effect
|
||||
</label>
|
||||
|
||||
<span
|
||||
id="spatialFalloffVal"
|
||||
class="audio-value"
|
||||
>
|
||||
100%
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<input
|
||||
type="range"
|
||||
id="spatialFalloff"
|
||||
min="0"
|
||||
max="200"
|
||||
value="100"
|
||||
step="5"
|
||||
>
|
||||
|
||||
<div class="range-ends">
|
||||
<span>Even volume</span>
|
||||
<span>Stronger distance</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</details>
|
||||
</section>
|
||||
|
||||
<section class="connection-status">
|
||||
<div
|
||||
id="statusIndicator"
|
||||
class="status-indicator"
|
||||
></div>
|
||||
|
||||
<div class="status-content">
|
||||
<span class="status-label">
|
||||
Connection status
|
||||
</span>
|
||||
|
||||
<span
|
||||
id="statusBar"
|
||||
class="status-bar"
|
||||
>
|
||||
Not connected
|
||||
</span>
|
||||
</div>
|
||||
</section>
|
||||
</aside>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
id="mobileSidebarBackdrop"
|
||||
class="mobile-sidebar-backdrop"
|
||||
onclick="Kronick.closeMobileSidebar()"
|
||||
aria-label="Close audio settings"
|
||||
tabindex="-1"
|
||||
></button>
|
||||
|
||||
<main class="main-content">
|
||||
<div class="content-header">
|
||||
<div>
|
||||
<span class="channel-label">
|
||||
VOICE CHANNEL
|
||||
</span>
|
||||
|
||||
<h2>
|
||||
Participants
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="room-state">
|
||||
<span class="room-state-dot"></span>
|
||||
LiveKit
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="participant-container"
|
||||
class="participant-grid"
|
||||
>
|
||||
<div class="empty-room-message">
|
||||
<div class="empty-room-icon">
|
||||
🎙️
|
||||
</div>
|
||||
|
||||
<h3>
|
||||
No participants connected
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
Enter a room and display name,
|
||||
then join the voice channel.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- =================================================
|
||||
Media browser
|
||||
================================================= -->
|
||||
|
||||
<div
|
||||
id="musicFrameWrap"
|
||||
class="tool-frame-wrap"
|
||||
data-window-title="Media"
|
||||
data-window-icon="🎵"
|
||||
>
|
||||
<div
|
||||
id="musicFrameHeader"
|
||||
class="tool-frame-header"
|
||||
>
|
||||
<div class="tool-frame-title">
|
||||
<span class="tool-frame-icon">
|
||||
🎵
|
||||
</span>
|
||||
|
||||
<span>
|
||||
Kronic Media
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="window-close-button"
|
||||
onclick="closeMusicBrowser()"
|
||||
aria-label="Close media browser"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<iframe
|
||||
id="musicFrame"
|
||||
class="tool-frame"
|
||||
src="https://media.kronickrusaders.ca/"
|
||||
title="Kronic Media"
|
||||
allow="autoplay; fullscreen; picture-in-picture"
|
||||
></iframe>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- =================================================
|
||||
GIF browser
|
||||
================================================= -->
|
||||
|
||||
<div
|
||||
id="giphyFrameWrap"
|
||||
class="tool-frame-wrap"
|
||||
data-window-title="GIF"
|
||||
data-window-icon="🙂"
|
||||
>
|
||||
<div
|
||||
id="giphyFrameHeader"
|
||||
class="tool-frame-header"
|
||||
>
|
||||
<div class="tool-frame-title">
|
||||
<span class="tool-frame-icon">
|
||||
🙂
|
||||
</span>
|
||||
|
||||
<span>
|
||||
GIF Browser
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="window-close-button"
|
||||
onclick="closeGiphyBrowser()"
|
||||
aria-label="Close GIF browser"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<iframe
|
||||
id="giphyFrame"
|
||||
class="tool-frame"
|
||||
src="/giphy.html"
|
||||
title="GIF Browser"
|
||||
allow="autoplay; fullscreen; clipboard-read; clipboard-write"
|
||||
></iframe>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- =================================================
|
||||
Chat
|
||||
================================================= -->
|
||||
|
||||
<div
|
||||
id="chatFrameWrap"
|
||||
class="tool-frame-wrap"
|
||||
data-window-title="Chat"
|
||||
data-window-icon="💬"
|
||||
>
|
||||
<div
|
||||
id="chatFrameHeader"
|
||||
class="tool-frame-header"
|
||||
>
|
||||
<div class="tool-frame-title">
|
||||
<span class="tool-frame-icon">
|
||||
💬
|
||||
</span>
|
||||
|
||||
<span>
|
||||
Chat
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="window-close-button"
|
||||
onclick="closeChatWindow()"
|
||||
aria-label="Close chat window"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<iframe
|
||||
id="chatFrame"
|
||||
class="tool-frame"
|
||||
src="/chat.html"
|
||||
title="Chat"
|
||||
></iframe>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- =================================================
|
||||
Screen share
|
||||
================================================= -->
|
||||
|
||||
<div
|
||||
id="screenShareFrameWrap"
|
||||
class="tool-frame-wrap screen-share-wrap"
|
||||
data-window-title="Screen Share"
|
||||
data-window-icon="▣"
|
||||
>
|
||||
<header
|
||||
id="screenShareFrameHeader"
|
||||
class="tool-frame-header screen-share-header"
|
||||
>
|
||||
<div class="screen-share-title-area">
|
||||
<div class="screen-share-live-badge">
|
||||
<span class="screen-share-live-dot"></span>
|
||||
Live
|
||||
</div>
|
||||
|
||||
<h3 id="screenShareTitle">
|
||||
Screen Share
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="screen-share-header-actions">
|
||||
<button
|
||||
id="screenShareStopBtn"
|
||||
type="button"
|
||||
class="screen-share-stop-button"
|
||||
onclick="stopScreenShare()"
|
||||
hidden
|
||||
>
|
||||
Stop Sharing
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="window-close-button"
|
||||
onclick="closeScreenShareWindow()"
|
||||
aria-label="Close screen share"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="screen-share-body screen-share-stage">
|
||||
<div
|
||||
id="screenShareEmpty"
|
||||
class="screen-share-empty"
|
||||
>
|
||||
<div class="screen-share-empty-icon">
|
||||
📺
|
||||
</div>
|
||||
|
||||
<h3>
|
||||
No Active Screen Share
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
When someone shares their screen in the room,
|
||||
it will appear here automatically.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="screenShareVideoContainer"
|
||||
class="screen-share-video-container"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<img
|
||||
id="sharedGif"
|
||||
class="shared-gif"
|
||||
alt="Shared GIF"
|
||||
>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,32 @@
|
||||
"""Explicitly link ONE existing Media account to its matching Chat account.
|
||||
|
||||
Usage: python link_existing_media_account.py USERNAME CHAT_USER_ID EMAIL
|
||||
Only do this after verifying the Chat account identity in the Chat admin UI.
|
||||
Back up kronick_accounts.sqlite3 first. Never use for admin accounts.
|
||||
"""
|
||||
import sys
|
||||
from media_accounts import open_database
|
||||
|
||||
if len(sys.argv) != 4:
|
||||
raise SystemExit('Usage: python link_existing_media_account.py USERNAME CHAT_USER_ID EMAIL')
|
||||
username, chat_id, email = sys.argv[1:]
|
||||
chat_id = int(chat_id)
|
||||
if chat_id < 1:
|
||||
raise SystemExit('Invalid Chat user ID')
|
||||
with open_database() as db:
|
||||
row = db.execute('SELECT * FROM users WHERE username=?', (username,)).fetchone()
|
||||
if not row or row['email'].lower() != email.lower():
|
||||
raise SystemExit('Media account username/email do not match supplied details')
|
||||
if row['is_platform_admin']:
|
||||
raise SystemExit('Refusing to link an existing Media administrator automatically')
|
||||
memberships = db.execute('SELECT role FROM group_memberships WHERE user_id=?', (row['id'],)).fetchall()
|
||||
if any(m['role'] != 'member' for m in memberships):
|
||||
raise SystemExit('Refusing to link an existing Media privileged group member')
|
||||
print(f"Link Media user {row['username']} ({row['email']}) to Chat ID {chat_id}?")
|
||||
if input('Type LINK to continue: ').strip() != 'LINK':
|
||||
raise SystemExit('Cancelled')
|
||||
db.execute('UPDATE users SET password_hash=? WHERE id=?',
|
||||
(f'!sso-managed:{chat_id}', row['id']))
|
||||
db.execute('DELETE FROM user_sessions WHERE user_id=?', (row['id'],))
|
||||
db.commit()
|
||||
print('Linked. This Media account now signs in through Chat only.')
|
||||
Reference in New Issue
Block a user