feat: add wildcard token support for allowed extensions and access token CLI commands

Introduce WILDCARD_TOKENS set in attachments.py to treat "*", ".*", "*.*" as wildcards that fall back to ALLOWED_UPLOAD_TYPES. Add cmd_token_issue and cmd_token_list CLI commands for issuing and listing DevPlace access tokens. Register access_tokens table in SOFT_DELETE_TABLES and initialize its columns and indexes in init_db. Replace Form() with Depends(json_or_form(...)) in admin backup, container, notification, settings, and user routers to support both JSON and form data.
This commit is contained in:
2026-06-17 17:10:52 +00:00
parent 217210e02f
commit 9598a1b867
45 changed files with 436 additions and 284 deletions
+3 -4
View File
@@ -2,7 +2,7 @@
import logging
from typing import Annotated
from fastapi import APIRouter, Request, Form
from fastapi import Depends, APIRouter, Request
from fastapi.responses import HTMLResponse
from devplacepy.database import get_table, get_setting, get_int_setting
from devplacepy.templating import templates
@@ -17,11 +17,11 @@ from devplacepy.config import SECONDS_PER_DAY
from devplacepy.responses import respond, action_result, wants_json, json_error
from devplacepy.schemas import AuthPageOut
from devplacepy.services.audit import record as audit
from devplacepy.dependencies import json_or_form
logger = logging.getLogger(__name__)
router = APIRouter()
@router.get("/signup", response_class=HTMLResponse)
async def signup_page(request: Request):
user = get_current_user(request)
@@ -46,9 +46,8 @@ async def signup_page(request: Request):
model=AuthPageOut,
)
@router.post("/signup")
async def signup(request: Request, data: Annotated[SignupForm, Form()]):
async def signup(request: Request, data: Annotated[SignupForm, Depends(json_or_form(SignupForm))]):
username = data.username
email = data.email.strip().lower()
password = data.password