revert: restore the original pre-redesign web console

Revert 688aad3, 39ac03a, c84dc36, and ff6a828 in reverse chronological order. Restore the exact tracked tree from 99aff42 while preserving history.

Validation: 29 authentication and base-path tests passed offline. All 23 prior UI browser tests ran in system Edge: 22 passed initially; the fake-login test passed on an unchanged isolated retry. Live game HTTP was blocked throughout browser validation.
This commit is contained in:
AttilaNet
2026-11-11 10:08:02 +08:00
parent 688aad37c1
commit e26d37e9c5
46 changed files with 748 additions and 4554 deletions
+4 -22
View File
@@ -11,7 +11,7 @@ from fastapi.testclient import TestClient
from ranch_web.app import create_app
from ranch_web.config import COOKIE_NAME, WebConfig
from ranch_web.tests.test_api import FakeManager, FakeUpdates, FrontendAssets
from ranch_web.tests.test_api import FakeManager, FakeUpdates
BASE = "/myrzx_bot"
@@ -97,9 +97,6 @@ class BasePathTests(unittest.TestCase):
self.assertEqual(response.headers["location"], BASE + "/login")
def test_login_html_assets_and_authenticated_workbench(self):
entry = Path(__file__).resolve().parents[1] / "static" / "index.html"
built_assets = FrontendAssets(entry.read_text(encoding="utf-8"))
self.assertTrue(built_assets.scripts)
for strip in (False, True):
with self.subTest(strip=strip):
client = self.client(strip)
@@ -110,14 +107,12 @@ class BasePathTests(unittest.TestCase):
self.assertEqual(document.prefixes, [BASE])
self.assertIn(("action", BASE + "/api/auth/login"), document.urls)
self.assertIn(("src", BASE + "/static/login.js"), document.urls)
self.assertEqual(FrontendAssets(response.text).scripts,
[(BASE + "/static/login.js", "module")])
for name, url in document.urls:
self.assertTrue(url.startswith(BASE + "/"), url)
self.assertNotIn(BASE + BASE, url)
if name != "action":
self.assertEqual(client.get(url).status_code, 200, url)
for path in ("/", "/static/index.html", *(url for url, _ in built_assets.scripts)):
for path in ("/", "/static/index.html", "/static/app.js"):
response = client.get(BASE + path, follow_redirects=False)
self.assertEqual(response.status_code, 303)
self.assertEqual(response.headers["location"], BASE + "/login")
@@ -131,22 +126,9 @@ class BasePathTests(unittest.TestCase):
self.assertEqual(response.status_code, 200)
document = _Document(response.text)
self.assertEqual(document.prefixes, [BASE])
assets = FrontendAssets(response.text)
self.assertEqual(assets.scripts, [(BASE + url, kind) for url, kind in built_assets.scripts])
self.assertEqual(assets.urls, [BASE + url for url in built_assets.urls])
self.assertIn(("src", BASE + "/static/app.js"), document.urls)
self.assertEqual(response.headers["cache-control"], "no-store")
for url in assets.urls:
self.assertTrue(url.startswith(BASE + "/static/"), url)
self.assertNotIn(BASE + BASE, url)
asset = client.get(url)
self.assertEqual(asset.status_code, 200, url)
if url not in assets.stylesheets:
self.assertEqual(asset.headers["cache-control"], "no-store")
client.cookies.clear()
for url, _ in built_assets.scripts:
response = client.get(BASE + url, follow_redirects=False)
self.assertEqual(response.status_code, 303)
self.assertEqual(response.headers["location"], BASE + "/login")
self.assertEqual(client.get(BASE + "/static/app.js").status_code, 200)
self.assertEqual(self.manager.calls, [])
def test_secure_cookie_scope_logout_and_revoked_session(self):