feat: add cat identity rename flow

This commit is contained in:
nyan404 committed 2026-10-13 00:30:36 +03:00
1 parent a15c22b4a2
commit 546fa37fce
10 files changed
+203 -14

No files matched your search

+4 -2
View File
@@ -14,7 +14,7 @@ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
from urllib.parse import parse_qs, unquote, urlparse
from .belki.api import ApiError, calculate_and_store, calculate_payload, inspect_bulk_payload, resolve_identity_payload
from .belki.api import ApiError, calculate_and_store, calculate_payload, inspect_bulk_payload, rename_identity_payload, resolve_identity_payload
from .belki.history import CalculationStore
from .belki.applications import ApplicationError, ApplicationStore, validate_application
from .belki.admin_filters import WEB_TIMEZONE, matches_period, period_bounds
@@ -531,7 +531,7 @@ class Handler(BaseHTTPRequestHandler):
parsed = urlparse(self.path)
is_sudoku_create = parsed.path == "/api/sudoku/games"
is_sudoku_regenerate = parsed.path.startswith("/api/sudoku/games/") and parsed.path.endswith("/regenerate")
if self.path not in ("/api/admin/auth", "/api/admin/logout", "/api/web/upload", "/api/calculate", "/api/reports", "/api/inspect-bulk", "/api/resolve-identity",
if self.path not in ("/api/admin/auth", "/api/admin/logout", "/api/web/upload", "/api/calculate", "/api/reports", "/api/inspect-bulk", "/api/resolve-identity", "/api/rename-identity",
"/api/applications", "/api/admin/vk/templates", "/api/admin/vk/schedules") and not is_sudoku_create and not is_sudoku_regenerate:
self._json(404, {"error": "Не найдено"})
return
@@ -589,6 +589,8 @@ class Handler(BaseHTTPRequestHandler):
self._json(200, inspect_bulk_payload(payload))
elif self.path == "/api/resolve-identity":
self._json(200, resolve_identity_payload(payload))
elif self.path == "/api/rename-identity":
self._json(200, rename_identity_payload(payload))
elif self.path == "/api/applications":
payload["attachments"] = validate_web_report_attachments(payload)
application = validate_application(payload)