From 26c6e7771b784e958512ed683f94cc3b13730a25 Mon Sep 17 00:00:00 2001 From: Tris Forster Date: Fri, 3 Oct 2025 17:50:09 +1000 Subject: [PATCH] Read users from config! --- squirrel/auth.py | 10 ++-------- squirrel/cmd.py | 3 +-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/squirrel/auth.py b/squirrel/auth.py index 18f9ac1..8c14acb 100644 --- a/squirrel/auth.py +++ b/squirrel/auth.py @@ -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")) diff --git a/squirrel/cmd.py b/squirrel/cmd.py index 50aef2c..7827c33 100644 --- a/squirrel/cmd.py +++ b/squirrel/cmd.py @@ -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"))