Read users from config!

This commit is contained in:
Tris Forster 2025-10-03 17:50:09 +10:00
parent 7cca8cd232
commit 26c6e7771b
2 changed files with 3 additions and 10 deletions

View File

@ -10,6 +10,7 @@ from flask import (
)
from werkzeug.security import check_password_hash, generate_password_hash
from dataclasses import dataclass
from squirrel.conf import settings
import functools
bp = Blueprint("auth", __name__, url_prefix="/auth")
@ -22,14 +23,7 @@ class User:
repos: list[str] | None = None
users: dict[str, dict] = {
"guest": {"password": "x", "name": "Guest"},
"tris": {
"password": "scrypt:32768:8:1$4srkVJ5rxSAvZp8s$6a9b1bd9199ceb07a8e650897d6ca0c229330773a77728f83c110525c0cde5c9a019bcafbfd0274a2e532e6db03996ff34521d8f36758f4892bcc13107ac24e5",
"name": "Tris",
"repos": ["test"],
},
}
users = settings["users"]
@bp.route("/login", methods=("GET", "POST"))

View File

@ -1,5 +1,4 @@
from squirrel.repo import get_archive
import shutil
import sys
archive = get_archive()
@ -13,5 +12,5 @@ def reindex():
options = parser.parse_args()
p = archive.reindex(options.repo)
for line in p.stderr:
for line in p.stderr: # type:ignore
sys.stderr.write(line.decode("utf8"))