2026-06-12 01:58:46 +02:00
|
|
|
# retoor <retoor@molodetz.nl>
|
|
|
|
|
|
feat: add api key auth, devii agent, openai gateway, and admin service management
This commit introduces a comprehensive set of new features including API key authentication with CLI management commands (get, reset, backfill), a Devii agentic assistant with WebSocket terminal and session bootstrap, an OpenAI-compatible LLM gateway service, and an admin service management panel. It also adds Playwright browser automation for bot support, configures internal gateway URLs, refactors content editing/deletion to support JSON API responses, and updates documentation across AGENTS.md, README.md, and the developer docs site.
2026-06-08 17:38:33 +02:00
|
|
|
import logging
|
|
|
|
|
|
|
|
|
|
from fastapi import Request
|
|
|
|
|
from fastapi.responses import JSONResponse, RedirectResponse
|
feat: add router table entries for uploads, media, zips, forks, tools, proxy, push, docs, openai, devii, xmlrpc, devrant, dbapi, pubsub and add type annotations to cache, config, responses, schemas, seo, and stealth modules
2026-06-16 14:05:44 +02:00
|
|
|
from pydantic import BaseModel
|
feat: add api key auth, devii agent, openai gateway, and admin service management
This commit introduces a comprehensive set of new features including API key authentication with CLI management commands (get, reset, backfill), a Devii agentic assistant with WebSocket terminal and session bootstrap, an OpenAI-compatible LLM gateway service, and an admin service management panel. It also adds Playwright browser automation for bot support, configures internal gateway URLs, refactors content editing/deletion to support JSON API responses, and updates documentation across AGENTS.md, README.md, and the developer docs site.
2026-06-08 17:38:33 +02:00
|
|
|
|
|
|
|
|
from devplacepy.schemas import ActionResult
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def wants_json(request: Request) -> bool:
|
|
|
|
|
content_type = request.headers.get("content-type", "")
|
|
|
|
|
if content_type.startswith("application/json"):
|
|
|
|
|
return True
|
|
|
|
|
accept = request.headers.get("accept", "")
|
|
|
|
|
return "application/json" in accept and "text/html" not in accept
|
|
|
|
|
|
|
|
|
|
|
feat: add router table entries for uploads, media, zips, forks, tools, proxy, push, docs, openai, devii, xmlrpc, devrant, dbapi, pubsub and add type annotations to cache, config, responses, schemas, seo, and stealth modules
2026-06-16 14:05:44 +02:00
|
|
|
def respond(request: Request, template: str, context: dict, *, model: type[BaseModel]):
|
feat: add api key auth, devii agent, openai gateway, and admin service management
This commit introduces a comprehensive set of new features including API key authentication with CLI management commands (get, reset, backfill), a Devii agentic assistant with WebSocket terminal and session bootstrap, an OpenAI-compatible LLM gateway service, and an admin service management panel. It also adds Playwright browser automation for bot support, configures internal gateway URLs, refactors content editing/deletion to support JSON API responses, and updates documentation across AGENTS.md, README.md, and the developer docs site.
2026-06-08 17:38:33 +02:00
|
|
|
if wants_json(request):
|
|
|
|
|
try:
|
|
|
|
|
payload = model.model_validate(context).model_dump(mode="json")
|
|
|
|
|
except Exception as exc:
|
|
|
|
|
logger.warning("JSON serialization failed for %s: %s", template, exc)
|
|
|
|
|
return json_error(500, "Could not serialize response")
|
|
|
|
|
return JSONResponse(payload)
|
|
|
|
|
from devplacepy.templating import templates
|
2026-06-09 18:48:08 +02:00
|
|
|
|
feat: add api key auth, devii agent, openai gateway, and admin service management
This commit introduces a comprehensive set of new features including API key authentication with CLI management commands (get, reset, backfill), a Devii agentic assistant with WebSocket terminal and session bootstrap, an OpenAI-compatible LLM gateway service, and an admin service management panel. It also adds Playwright browser automation for bot support, configures internal gateway URLs, refactors content editing/deletion to support JSON API responses, and updates documentation across AGENTS.md, README.md, and the developer docs site.
2026-06-08 17:38:33 +02:00
|
|
|
return templates.TemplateResponse(request, template, context)
|
|
|
|
|
|
|
|
|
|
|
2026-06-09 18:48:08 +02:00
|
|
|
def action_result(
|
feat: add router table entries for uploads, media, zips, forks, tools, proxy, push, docs, openai, devii, xmlrpc, devrant, dbapi, pubsub and add type annotations to cache, config, responses, schemas, seo, and stealth modules
2026-06-16 14:05:44 +02:00
|
|
|
request: Request, redirect_url: str, *, data: dict | None = None, status_code: int = 302
|
|
|
|
|
) -> JSONResponse | RedirectResponse:
|
feat: add api key auth, devii agent, openai gateway, and admin service management
This commit introduces a comprehensive set of new features including API key authentication with CLI management commands (get, reset, backfill), a Devii agentic assistant with WebSocket terminal and session bootstrap, an OpenAI-compatible LLM gateway service, and an admin service management panel. It also adds Playwright browser automation for bot support, configures internal gateway URLs, refactors content editing/deletion to support JSON API responses, and updates documentation across AGENTS.md, README.md, and the developer docs site.
2026-06-08 17:38:33 +02:00
|
|
|
if wants_json(request):
|
2026-06-09 18:48:08 +02:00
|
|
|
return JSONResponse(
|
|
|
|
|
ActionResult(ok=True, redirect=redirect_url, data=data).model_dump(
|
|
|
|
|
mode="json"
|
|
|
|
|
)
|
|
|
|
|
)
|
feat: add api key auth, devii agent, openai gateway, and admin service management
This commit introduces a comprehensive set of new features including API key authentication with CLI management commands (get, reset, backfill), a Devii agentic assistant with WebSocket terminal and session bootstrap, an OpenAI-compatible LLM gateway service, and an admin service management panel. It also adds Playwright browser automation for bot support, configures internal gateway URLs, refactors content editing/deletion to support JSON API responses, and updates documentation across AGENTS.md, README.md, and the developer docs site.
2026-06-08 17:38:33 +02:00
|
|
|
return RedirectResponse(url=redirect_url, status_code=status_code)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def json_error(status_code: int, message: str, **extra) -> JSONResponse:
|
2026-06-09 18:48:08 +02:00
|
|
|
return JSONResponse(
|
|
|
|
|
{"error": {"status": status_code, "message": message, **extra}},
|
|
|
|
|
status_code=status_code,
|
|
|
|
|
)
|