Integrate Antirion admin with FastAPI and htmx

Add the shared document API, constructor and expert editors, isolated preview, and fragment catalog metadata with typed block IDs.

Include design references, specification 001, QA scripts, project guidance, and cached Docker dependency installation. Leave example sites for a separate commit.
This commit is contained in:
2026-11-12 21:55:36 +03:00
parent 58cc8090a9
commit 88ac95dd19
260 changed files with 20395 additions and 320 deletions
+12 -7
View File
@@ -82,19 +82,19 @@ class AdminHandlersTest(SiteTestCase):
result = self.h.login_submit("admin", "super-secret-guess!!", ORIGIN, "1.1.1.1")
self.assertNotIn("super-secret-guess", result.body)
def test_dashboard_lists_pages_collections_and_validation(self):
def test_dashboard_shows_workspace_release_changes_and_validation(self):
result = self.h.dashboard(self.login())
self.assertEqual(result.status, 200)
for text in ("Acme Studio", "Главная", "Контакты", "Черновик новой страницы", "status-draft",
"опубликовано 3 из 3", "ошибок проверки: 0"):
for text in ("Acme Studio", "Главная", "Контакты", "Черновик новой страницы",
"Нет публикаций", "Последние изменения", "Ошибок проверки: 0"):
self.assertIn(text, result.body)
self.assertIn("name='csrf'", result.body)
self.assertIn("no-store", result.headers["Cache-Control"])
def test_dashboard_shows_the_absolute_paths_in_use(self):
def test_ordinary_dashboard_omits_developer_paths(self):
body = self.h.dashboard(self.login()).body
for path in (self.site.resolve(), (self.tmp / "dist").resolve(), (self.tmp / "state").resolve()):
self.assertIn(str(path), body)
self.assertNotIn(str(path), body)
def test_missing_site_error_names_the_absolute_path(self):
(self.site / "site.yaml").unlink()
@@ -126,16 +126,21 @@ class AdminHandlersTest(SiteTestCase):
result = self.h.login_page(self.login())
self.assertEqual((result.status, result.headers["Location"]), (303, "/admin/"))
def test_static_css_is_served(self):
def test_static_assets_are_served(self):
result = self.h.static_css()
self.assertEqual(result.status, 200)
self.assertTrue(result.content_type.startswith("text/css"))
self.assertIn(".login", result.body)
script = self.h.static_file("htmx.min.js")
self.assertEqual(script.status, 200)
self.assertTrue(script.content_type.startswith("text/javascript"))
self.assertIn('version:"2.0.11"', script.body)
self.assertEqual(script.headers["X-Content-Type-Options"], "nosniff")
def test_no_inline_scripts_or_styles_in_templates(self):
# CSP не разрешает inline: проверяем, что шаблоны её не нарушают
for body in (self.h.login_page(None).body, self.h.dashboard(self.login()).body):
self.assertNotIn("<script", body)
self.assertNotRegex(body, r"<script(?![^>]*\bsrc=)")
self.assertNotIn("style=", body)
self.assertNotIn("<style", body)