Files
opengenesislinkserver/tools/ci/verify_worldapi_scifi_admin_center.py
T
OpenGenesis (MPL 2.0) c20cd5bb0a feat(worldapi): AdminLTE operator dashboard, OGL.API.dll, viewer statistics and OGL welcome page (#314)
* feat(http): add modern public OpenGenesisLINK welcome page with no private server metrics

* feat(http): serve OGL welcome only to HTML root GET, preserve viewer protocols and remove hippo 404

* refactor(build): emit and load OGL.API.dll as canonical World API assembly

* refactor(build): emit and load OGL.API.dll as canonical World API assembly

* refactor(build): emit and load OGL.API.dll as canonical World API assembly

* refactor(build): emit and load OGL.API.dll as canonical World API assembly

* refactor(build): emit and load OGL.API.dll as canonical World API assembly

* refactor(build): emit and load OGL.API.dll as canonical World API assembly

* refactor(build): emit and load OGL.API.dll as canonical World API assembly

* refactor(build): emit and load OGL.API.dll as canonical World API assembly

* refactor(build): emit and load OGL.API.dll as canonical World API assembly

* refactor(build): emit and load OGL.API.dll as canonical World API assembly

* feat(stats): log anonymized successful viewer channel/version for operator daily viewer report

* feat(worldapi): secure viewer name/version usage statistics from daily successful login logs

* feat(worldapi): expose registered ROBUST console commands to UserLevel 200 with confirmation and job state

* feat(worldapi): register secured ROBUST console and viewer-version statistics routes

* feat(worldapi): register secured ROBUST console and viewer-version statistics routes

* feat(worldapi): register secured ROBUST console and viewer-version statistics routes

* feat(ui): AdminLTE-style app header, viewer-version analytics, real ROBUST console and structured logs

* design(ui): replace neon card interface with AdminLTE-inspired light content, dark sidebar, clean topbar and severity logs

* ci(build): inspect canonical OGL.API project after assembly rename

* design(login): restyle protected OGL login to match modern AdminLTE operator console

* fix(operator): import LINQ and avoid recording sensitive console-command arguments

* docs(worldapi): AdminLTE redesign, OGL.API assembly, native ROBUST commands and viewer analytics

* test(worldapi): gate OGL.API rename, AdminLTE UI, viewer metrics, native console and browser root

* ci(worldapi): validate new OGL.API build output, AdminLTE admin, viewer analytics and root welcome

* test(worldapi): include viewer-analytics page in guarded admin navigation regression

* design(http): replace legacy hippo 404 example with consistent OGL error page
2026-10-26 09:16:06 +01:00

67 lines
3.6 KiB
Python

#!/usr/bin/env python3
"""Fail-closed checks for sci-fi protected World API admin center."""
from pathlib import Path
import base64, re, subprocess, shutil, tempfile
root=Path(__file__).resolve().parents[2]
page=(root/"NexVerse/Server/Api/NexApiDocsPage.cs").read_text()
login=(root/"NexVerse/Server/Api/OglApiDocsAccess.cs").read_text()
branding=(root/"NexVerse/Server/Api/NexOglBranding.cs").read_text()
assert "private static readonly string s_Html" in page
assert "private static readonly string s_LoginPage" in login
assert "NexOglBranding.DataUri" in page and "NexOglBranding.DataUri" in login
assert "OGL_LOGO_DATA_URI" in page and "OGL_LOGO_DATA_URI" in login
image=re.search(r'DataUri\s*=\s*"data:image/webp;base64,([A-Za-z0-9+/=]+)"',branding)
assert image, "Supplied logo must be stored as an inline WebP image"
data=base64.b64decode(image.group(1),validate=True)
assert data[:4]==b"RIFF" and data[8:12]==b"WEBP" and len(data)>2000
assert "frame-ancestors 'none'" in login
assert "m_Authenticator.TryAuthenticate" in login
assert "UserLevel < MinimumLevel" in login
assert 'adminIsActive()' in page
assert "connect-src 'self'" in page
assert "connect-src 'self' https://api.github.com" not in page
connector=(root/"NexVerse/Server/Api/NexVerseWorldApiConnector.cs").read_text()
github=(root/"NexVerse/Server/Api/NexGithubRepositoryStatusApi.cs").read_text()
openapi=(root/"NexVerse/Server/Api/NexVerseWorldApiHandlers.cs").read_text()
assert '"/api/v1/repository/status"' in connector and 'githubStatus.Handle' in connector
assert '"/api/v1/repository/status"' in openapi
assert "https://api.github.com/repos/opengenesislink/opengenesislinkserver" in github
assert '"/releases/latest"' in github and '"/commits/main"' in github
assert '"/actions/workflows/nexjast-ci.yml/runs?branch=main&per_page=1"' in github
assert "TimeSpan.FromMinutes(5)" in github
assert "JsonSerializer.SerializeToUtf8Bytes" in github
assert "fetch('/api/v1/repository/status'" in page
for name in ["overview","statistics","diagnostics","repository","grid","nodes",
"estates","console","users","groups","inventory","profiles","economy",
"marketplace","discovery","experiences","secrets","security","explorer",
"chatgpt","adminlogin","changes","versions","roadmap"]:
assert 'data-page="'+name+'"' in page,name
assert 'id="page-'+name+'"' in page,name
assert '<details class="navgroup"' in page
assert "oglRenderWorkspaces()" in page and "oglWorkspaceOpen(entry)" in page
assert "release?.tag_name||'Nicht verfügbar'" in page
assert "commit?.sha?" in page
assert "d.fail.length" in page
assert "data-workspace-search" in page
assert "secretKeySearch" in page and "secretKeyState" in page
assert "oglFilterKeys()" in page
assert "entries.filter(x=>prefixes.some(p=>x.path.startsWith(p)))" in page
assert "selectEntry(entry)" in page
assert "['secrets','nodes','grid','security','console'," in page
assert "'logs','audit','viewers','users','groups'" in page
assert "keine unbeschränkte Shell" in page or "Keine unbeschränkte Shell" in page
# Extract JS from the actual HTML page (do not create a separate, unused demo file).
script=re.search(r"<script>\s*('use strict';.*?)\s*</script>",page,re.S)
assert script,"Embedded dashboard JS unavailable"
if shutil.which("node") is None: raise RuntimeError("Node is required for World API UI validation")
with tempfile.TemporaryDirectory() as td:
f=Path(td)/"world-admin.mjs"
f.write_text(script.group(1))
result=subprocess.run(["node","--check",str(f)],capture_output=True,text=True)
assert result.returncode==0,result.stderr
print("OGL World API Sci-Fi dashboard: logo, navigation, auth boundaries, GitHub and browser syntax OK")