feat(gen1): OGL Health Center, anonymisierte Login-Diagnose und DLL-Startschutz

Integrates administrator-only health endpoints, privacy-preserving ROBUST login diagnostics, validated DLL preflight sources, WebInterface runtime UI and required assets. Verified with .NET 10 builds, synthetic log tests and responsive browser tests. Live rollout on NexTopia; main simulator awaits its next controlled restart.
This commit is contained in:
OpenGenesis (EULA) authored and GitHub committed 2026-11-21 23:19:34 +01:00
1 parent b54b8069ff
commit a9880cf2e4
17 files changed
+2243 -245

No files matched your search

+321 -12
View File
@@ -23,6 +23,175 @@ internal sealed class AdminHttpServer : IDisposable
private static readonly ILog Log = LogManager.GetLogger(typeof(AdminHttpServer));
private static readonly JsonSerializerOptions JsonOptions = new(JsonSerializerDefaults.Web);
private static object DllCompatibilityStatus()
{
// Only readable from an authenticated OGL.WebInterface admin session.
// Reports are written by the offline startup gate with private file mode.
string basePath = Path.Combine(AppContext.BaseDirectory, "ops-data");
var reports = new List<object>();
foreach (string mode in new[] { "simulator", "robust" })
{
string file = Path.Combine(basePath, "compatibility-" + mode + ".json");
if (!File.Exists(file)) continue;
try
{
var info = new FileInfo(file);
if (info.Length is < 10 or > 131072) continue;
using JsonDocument doc = JsonDocument.Parse(File.ReadAllText(file));
JsonElement r = doc.RootElement;
var errors = r.GetProperty("errors").EnumerateArray()
.Take(25).Select(x => x.GetString() ?? "").ToArray();
var warnings = r.GetProperty("warnings").EnumerateArray()
.Take(25).Select(x => x.GetString() ?? "").ToArray();
reports.Add(new
{
instance=mode,
status=r.GetProperty("status").GetString() ?? "unknown",
checkedAtUtc=r.GetProperty("checkedAtUtc").GetString(),
frameworkVersion=r.GetProperty("frameworkVersion").GetString(),
errors, warnings,
checkCount=r.GetProperty("checks").GetArrayLength()
});
}
catch (Exception e) when (e is IOException or UnauthorizedAccessException or JsonException
or KeyNotFoundException or InvalidOperationException)
{
reports.Add(new { instance=mode,status="unknown", checkedAtUtc=(string?)null,
frameworkVersion=(string?)null,errors=new[] { "Prüfbericht nicht lesbar." },
warnings=Array.Empty<string>(),checkCount=0 });
}
}
return new
{
reports,
currentState=reports.Count>0?"Verfügbare DLL-Dateien wurden geprüft.":
"Noch keine DLL-Startprüfung vorhanden.",
note="Der Offline-Prüfer kontrolliert die lokalen DLL-Dateien. " +
"Geänderte Dateien werden erst nach einem Neustart in den Prozess geladen. " +
"Ein grüner Prüfbericht allein ersetzt keinen echten Login- oder Regionstest."
};
}
private static readonly HttpClient NetworkClient = new(
new HttpClientHandler { AllowAutoRedirect = false })
{ Timeout = TimeSpan.FromSeconds(5) };
// Read-only admin endpoint. Only the OGL service sees the node credential;
// the browser receives the external observer's port statuses, never tokens.
private static async Task<object> ExternalNetworkStatusAsync()
{
string endpoint = Environment.GetEnvironmentVariable("OGL_UPDATE_CENTRAL_URL") ?? "";
string token = Environment.GetEnvironmentVariable("OGL_UPDATE_NODE_TOKEN") ?? "";
string nodeId = Environment.GetEnvironmentVariable("OGL_UPDATE_NODE_ID") ?? "";
if (endpoint.Length == 0 || token.Length < 32 || nodeId.Length == 0)
return new { configured = false, reachable = false, fresh = false,
checkedAtUtc = (string?)null, ageSeconds = (int?)null,
nodeId, checks = Array.Empty<object>(),
message = "Externer Prüfstandort noch nicht für diesen Simulator konfiguriert." };
if (!Uri.TryCreate(endpoint, UriKind.Absolute, out Uri? uri) ||
uri.Scheme != Uri.UriSchemeHttps || uri.UserInfo.Length != 0 ||
uri.AbsolutePath != "/" || uri.Query.Length != 0 || uri.Fragment.Length != 0)
return new { configured = false, reachable = false, fresh = false,
checkedAtUtc = (string?)null, ageSeconds = (int?)null,
nodeId, checks = Array.Empty<object>(),
message = "Adresse des Prüfstandorts ist nicht gültig." };
try
{
using var req = new HttpRequestMessage(HttpMethod.Get,
new Uri(uri,"/v1/network"));
req.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(
"Bearer", token);
using var response = await NetworkClient.SendAsync(req);
if (!response.IsSuccessStatusCode)
throw new HttpRequestException("HTTP " + (int)response.StatusCode);
using var doc = JsonDocument.Parse(await response.Content.ReadAsStreamAsync());
JsonElement result = doc.RootElement;
bool fresh = result.GetProperty("fresh").GetBoolean();
JsonElement sample = result.GetProperty("checks").Clone();
return new {
configured = true, reachable = true, fresh,
checkedAtUtc = result.GetProperty("checkedAtUtc").ValueKind == JsonValueKind.String
? result.GetProperty("checkedAtUtc").GetString() : null,
ageSeconds = result.GetProperty("ageSeconds").ValueKind == JsonValueKind.Number
? (int?)result.GetProperty("ageSeconds").GetInt32() : null,
nodeId, checks = sample,
message = fresh ? "Externe TCP-Messung erfolgreich aktualisiert."
: "Externe Messung ist veraltet oder der Prüfstandort ist offline."
};
}
catch (Exception error)
{
Log.Warn("[OS WEBINTERFACE] External network monitor unavailable: " +
error.GetType().Name);
return new { configured = true, reachable = false, fresh = false,
checkedAtUtc = (string?)null, ageSeconds = (int?)null,
nodeId, checks = Array.Empty<object>(),
message = "Externer Prüfstandort ist momentan nicht erreichbar." };
}
}
private static readonly HttpClient TranslatorClient = new(
new HttpClientHandler { AllowAutoRedirect = false })
{ Timeout = TimeSpan.FromSeconds(5) };
// Admin-only: central translation health without disclosing per-node tokens.
private static async Task<object> TranslatorStatusAsync()
{
string node = Environment.GetEnvironmentVariable("OGL_TRANSLATOR_NODE_ID") ?? "";
string url = Environment.GetEnvironmentVariable("OGL_TRANSLATOR_CENTRAL_URL") ?? "";
string token = Environment.GetEnvironmentVariable("OGL_TRANSLATOR_NODE_TOKEN") ?? "";
DateTimeOffset checkedAtUtc = DateTimeOffset.UtcNow;
if (node.Length == 0 || url.Length == 0 || token.Length < 32)
return new { configured = false, connected = false, available = false,
nodeId = node.Length > 0 ? node : "–", endpoint = "",
chat = false, directIm = false, groupIm = false,
providerKeyOnNode = false, checkedAtUtc,
message = "Auf diesem Simulator ist der Global Translater nicht aktiviert." };
if (!Uri.TryCreate(url, UriKind.Absolute, out Uri? parsed) ||
parsed.Scheme != Uri.UriSchemeHttps || parsed.UserInfo.Length > 0 ||
parsed.AbsolutePath != "/" || parsed.Query.Length > 0 || parsed.Fragment.Length > 0)
return new { configured = true, connected = false, available = false,
nodeId = node, endpoint = "", chat = false, directIm = false,
groupIm = false, providerKeyOnNode = false, checkedAtUtc,
message = "Zentrale HTTPS-Adresse ungültig." };
string endpoint = parsed.GetLeftPart(UriPartial.Authority);
try
{
using var req = new HttpRequestMessage(HttpMethod.Get,
new Uri(parsed, "/v1/status"));
req.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(
"Bearer", token);
using var res = await TranslatorClient.SendAsync(req);
if (!res.IsSuccessStatusCode)
return new { configured = true, connected = false, available = false,
nodeId = node, endpoint, chat = false, directIm = false,
groupIm = false, providerKeyOnNode = false, checkedAtUtc,
message = "Node-Anmeldung beim zentralen Dienst fehlgeschlagen (HTTP " +
(int)res.StatusCode + ")." };
using JsonDocument doc = JsonDocument.Parse(
await res.Content.ReadAsStreamAsync());
JsonElement status = doc.RootElement;
bool online = status.TryGetProperty("available", out JsonElement a) && a.GetBoolean();
bool chat = status.TryGetProperty("chat", out JsonElement ch) && ch.GetBoolean();
bool directIm = status.TryGetProperty("directIm", out JsonElement im) && im.GetBoolean();
bool groupIm = status.TryGetProperty("groupIm", out JsonElement gr) && gr.GetBoolean();
return new { configured = true, connected = true, available = online,
nodeId = node, endpoint, chat, directIm, groupIm,
providerKeyOnNode = false, checkedAtUtc,
message = online ? "OGL Translater: einsatzbereit."
: "Zentraler Dienst antwortet, Übersetzung derzeit nicht verfügbar." };
}
catch (Exception e)
{
Log.Warn("[OS WEBINTERFACE] Central translation status unavailable: " +
e.GetType().Name);
return new { configured = true, connected = false, available = false,
nodeId = node, endpoint, chat = false, directIm = false,
groupIm = false, providerKeyOnNode = false, checkedAtUtc,
message = "Zentraler Übersetzungsdienst nicht erreichbar." };
}
}
private readonly ConcurrentDictionary<UUID, Scene> _scenes;
private readonly ConcurrentDictionary<string, Session> _sessions = new();
private readonly ConcurrentDictionary<string, Attempt> _attempts = new();
@@ -32,12 +201,15 @@ internal sealed class AdminHttpServer : IDisposable
private readonly LiveUpdateBridge _liveUpdate;
private readonly Uri? _publicOrigin;
private readonly string _loopbackHost;
// Cookies are shared by hostname, NOT by port; give each service its own name.
private readonly string _cookieName;
private Task? _acceptTask;
private readonly DateTimeOffset _started = DateTimeOffset.UtcNow;
public AdminHttpServer(ConcurrentDictionary<UUID, Scene> scenes, string storage, int port, int retention, List<(string Name, Uri Uri)> services, LiveUpdateBridge liveUpdate, string publicOrigin)
{
_loopbackHost = $"127.0.0.1:{port}";
_cookieName = $"ogl_admin_{port}";
if (!string.IsNullOrWhiteSpace(publicOrigin))
{
if (!Uri.TryCreate(publicOrigin, UriKind.Absolute, out Uri? parsed) ||
@@ -138,7 +310,7 @@ internal sealed class AdminHttpServer : IDisposable
private bool TrySession(HttpListenerRequest request, out Session? session)
{
session = null;
string? id = request.Cookies["ogl_admin"]?.Value;
string? id = request.Cookies[_cookieName]?.Value;
if (id is null || !_sessions.TryGetValue(id, out Session? s)) return false;
if (s.Expires <= DateTimeOffset.UtcNow)
{
@@ -151,7 +323,7 @@ internal sealed class AdminHttpServer : IDisposable
try
{
UserAccount? account = scene.UserAccountService?.GetUserAccount(UUID.Zero, s.Principal);
if (account is null || account.UserLevel <= 0 || !account.LoginAllowed) return false;
if (account is null || account.UserLevel < 200 || !account.LoginAllowed) return false;
}
catch (Exception e) { Log.Warn("[OS WEBINTERFACE] Account revalidation failed", e); return false; }
session = s;
@@ -210,7 +382,7 @@ internal sealed class AdminHttpServer : IDisposable
}
try { scene.AuthenticationService.Release(account.PrincipalID, token); }
catch (Exception e) { Log.Warn("[OS WEBINTERFACE] Token cleanup failed", e); }
if (account.UserLevel <= 0)
if (account.UserLevel < 200)
{
await SendAsync(ctx.Response, 403, new { error = "Access Denied – Keine Berechtigung." });
return;
@@ -220,7 +392,7 @@ internal sealed class AdminHttpServer : IDisposable
var session = new Session(account.PrincipalID, account.Name, Token(), DateTimeOffset.UtcNow.AddHours(1));
_sessions[sid] = session;
bool secure = ctx.Request.IsSecureConnection || IsTrustedProxyRequest(ctx.Request);
ctx.Response.AppendHeader("Set-Cookie", "ogl_admin=" + sid +
ctx.Response.AppendHeader("Set-Cookie", _cookieName + "=" + sid +
"; Path=/; HttpOnly; SameSite=Strict; Max-Age=3600" + (secure ? "; Secure" : ""));
await SendAsync(ctx.Response, 200, new { name = session.Name, csrf = session.Csrf, expires = session.Expires });
Log.Info("[OS WEBINTERFACE] Administrative session established");
@@ -263,6 +435,31 @@ internal sealed class AdminHttpServer : IDisposable
await ServeResourceAsync(ctx.Response, "style.css", "text/css; charset=utf-8");
return;
}
if (method == "GET" && route == "/ogl-simulator-logo.webp")
{
await ServeResourceAsync(ctx.Response, "ogl-simulator-logo.webp", "image/webp");
return;
}
if (method == "GET" && route == "/ogl-simulator-favicon.png")
{
await ServeResourceAsync(ctx.Response, "ogl-simulator-favicon.png", "image/png");
return;
}
if (method == "GET" && route == "/ogl-simulator-apple-icon.png")
{
await ServeResourceAsync(ctx.Response, "ogl-simulator-apple-icon.png", "image/png");
return;
}
if (method == "GET" && route == "/oar-live.css")
{
await ServeResourceAsync(ctx.Response, "oar-live.css", "text/css; charset=utf-8");
return;
}
if (method == "GET" && route == "/oar-live.js")
{
await ServeResourceAsync(ctx.Response, "oar-live.js", "text/javascript; charset=utf-8");
return;
}
if (method == "GET" && route == "/app.js")
{
await ServeResourceAsync(ctx.Response, "app.js", "text/javascript; charset=utf-8");
@@ -287,15 +484,42 @@ internal sealed class AdminHttpServer : IDisposable
}
if (method == "POST" && route == "/api/logout")
{
string? sid = request.Cookies["ogl_admin"]?.Value;
string? sid = request.Cookies[_cookieName]?.Value;
if (sid is not null) _sessions.TryRemove(sid, out _);
ctx.Response.AppendHeader("Set-Cookie", "ogl_admin=; Path=/; HttpOnly; SameSite=Strict; Max-Age=0");
ctx.Response.AppendHeader("Set-Cookie", _cookieName + "=; Path=/; HttpOnly; SameSite=Strict; Secure; Max-Age=0");
await SendAsync(ctx.Response, 200, new { ok = true }); return;
}
if (method == "GET" && route == "/api/me")
{
await SendAsync(ctx.Response, 200, new { name = session.Name, csrf = session.Csrf }); return;
}
if (method == "GET" && route == "/api/translator/status")
{
await SendAsync(ctx.Response, 200, await TranslatorStatusAsync());
return;
}
if (method == "GET" && route == "/api/network/external")
{
await SendAsync(ctx.Response, 200, await ExternalNetworkStatusAsync());
return;
}
if (method == "GET" && route == "/api/health-center/summary")
{
await SendAsync(ctx.Response, 200,
await OglHealthDiagnostics.SummaryAsync(_operations, _stop.Token));
return;
}
if (method == "GET" && route == "/api/health-center/login-diagnostics")
{
await SendAsync(ctx.Response, 200,
OglHealthDiagnostics.LoginDiagnostics());
return;
}
if (method == "GET" && route == "/api/system/compatibility")
{
await SendAsync(ctx.Response, 200, DllCompatibilityStatus());
return;
}
if (method == "GET" && route == "/api/overview")
{
await SendAsync(ctx.Response, 200, new
@@ -326,6 +550,15 @@ internal sealed class AdminHttpServer : IDisposable
else await SendAsync(ctx.Response, 202, new { message = "Region-Neustart angefordert" });
return;
}
if (method == "GET" && route == "/api/oar/status")
{
object? status = _operations.OarStatus(request.QueryString["id"] ?? "");
if (status is null)
await SendAsync(ctx.Response, 404, new { error = "OAR-Auftrag nicht gefunden" });
else
await SendAsync(ctx.Response, 200, status);
return;
}
if (method == "POST" && route == "/api/oar/export")
{
var payload = await ReadJsonAsync<RegionRequest>(request);
@@ -348,24 +581,100 @@ internal sealed class AdminHttpServer : IDisposable
string id = request.QueryString["id"] ?? "";
string? file = _operations.ExportFile(id);
if (file is null) { await SendAsync(ctx.Response, 404, new { error = "Archiv nicht verfügbar" }); return; }
using var input = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read);
long size = input.Length;
if (size == 0)
{
await SendAsync(ctx.Response, 503, new { error = "Archiv ist leer" });
return;
}
long first = 0, last = size - 1;
string? range = request.Headers["Range"];
if (!string.IsNullOrWhiteSpace(range))
{
// Single-range HTTP downloads allow large archives to resume
// after a browser/proxy connection drops.
if (!range.StartsWith("bytes=", StringComparison.OrdinalIgnoreCase)
|| range.Contains(',', StringComparison.Ordinal))
{
ctx.Response.Headers["Content-Range"] = $"bytes */{size}";
await SendAsync(ctx.Response, 416, new { error = "Ungültiger Downloadbereich" });
return;
}
string[] parts = range["bytes=".Length..].Split('-', 2);
bool valid = parts.Length == 2;
if (valid && parts[0].Length > 0)
{
valid = long.TryParse(parts[0], out first) && first >= 0 && first < size;
if (valid && parts[1].Length > 0)
valid = long.TryParse(parts[1], out last) && last >= first;
else if (valid) last = size - 1;
if (last >= size) last = size - 1;
}
else if (valid && parts[1].Length > 0)
{
valid = long.TryParse(parts[1], out long suffix) && suffix > 0;
if (valid) first = Math.Max(0, size - suffix);
}
else valid = false;
if (!valid)
{
ctx.Response.Headers["Content-Range"] = $"bytes */{size}";
await SendAsync(ctx.Response, 416, new { error = "Ungültiger Downloadbereich" });
return;
}
}
ctx.Response.ContentType = "application/octet-stream";
ctx.Response.Headers["Content-Disposition"] = "attachment; filename=\"region-" + id + ".oar\"";
using var input = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read);
ctx.Response.ContentLength64 = input.Length;
await input.CopyToAsync(ctx.Response.OutputStream);
ctx.Response.Headers["Accept-Ranges"] = "bytes";
if (range is not null)
{
ctx.Response.StatusCode = 206;
ctx.Response.Headers["Content-Range"] = $"bytes {first}-{last}/{size}";
}
ctx.Response.ContentLength64 = last - first + 1;
input.Position = first;
try
{
byte[] buffer = new byte[64 * 1024];
long remaining = last - first + 1;
while (remaining > 0)
{
int count = await input.ReadAsync(buffer.AsMemory(0, (int)Math.Min(remaining, buffer.Length)));
if (count == 0) throw new IOException("OAR-Datei endete vorzeitig");
await ctx.Response.OutputStream.WriteAsync(buffer.AsMemory(0, count));
remaining -= count;
}
}
catch (HttpListenerException)
{
// Browser cancelled/resumed the download. The saved OAR on
// disk is unaffected; do not generate another error response.
Log.Info("[OS WEBINTERFACE] OAR download connection closed by client: " + id);
}
catch (IOException e)
{
Log.Warn("[OS WEBINTERFACE] OAR download interrupted: " + id, e);
}
return;
}
if (method == "GET" && route == "/api/updates/check")
{
await SendAsync(ctx.Response, 200, await _operations.CheckGitAsync(_stop.Token)); return;
await SendAsync(ctx.Response, 200, await _operations.CheckUpdatesAsync(_stop.Token)); return;
}
if (method == "GET" && route == "/api/updates/live-status")
{
await SendAsync(ctx.Response, 200, await _liveUpdate.StatusAsync(_stop.Token)); return;
await SendAsync(ctx.Response, 200,
new { enabled = false, reachable = false,
message = "Historischer Git-Quellcode-Updater im Closed-Code-Modell deaktiviert." });
return;
}
if (method == "POST" && route == "/api/updates/live-start")
{
await SendAsync(ctx.Response, 202, await _liveUpdate.StartAsync(_stop.Token)); return;
await SendAsync(ctx.Response, 410, new {
error = "Der historische Git-Updater ist deaktiviert. Es werden nur geprüfte OGL-Binärpakete bereitgestellt."
});
return;
}
if (method == "POST" && route == "/api/updates/stage")
{
+127 -110
View File
@@ -33,6 +33,9 @@ internal sealed class AdminOperations : IDisposable
public long Bytes;
public long Total;
public string File = "";
public DateTimeOffset? Finished;
public bool FileObserved;
public List<(DateTimeOffset Time, string Text)> Events = new();
}
private readonly ConcurrentDictionary<UUID, Scene> _scenes;
private readonly ConcurrentDictionary<string, Job> _jobs = new();
@@ -43,7 +46,7 @@ internal sealed class AdminOperations : IDisposable
private readonly List<(string Name, Uri Uri)> _services;
private readonly UpdateStager _updateStager;
private static readonly ILog Log = LogManager.GetLogger(typeof(AdminOperations));
private static readonly HttpClient GitClient = CreateGitClient();
public AdminOperations(ConcurrentDictionary<UUID, Scene> scenes, string storage, int retention, List<(string Name, Uri Uri)> services)
{
@@ -55,15 +58,6 @@ internal sealed class AdminOperations : IDisposable
_archiveDir = Path.Combine(storage, "archives");
Directory.CreateDirectory(_archiveDir);
}
private static HttpClient CreateGitClient()
{
var h = new HttpClientHandler { AllowAutoRedirect = false };
var client = new HttpClient(h) { Timeout = TimeSpan.FromSeconds(12) };
client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("OpenGenesisLINK-Admin", "0.1"));
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/vnd.github+json"));
return client;
}
private Scene Region(string id)
{
if (!UUID.TryParse(id, out UUID uid) || !_scenes.TryGetValue(uid, out Scene? s))
@@ -85,15 +79,107 @@ internal sealed class AdminOperations : IDisposable
if (!_busy.TryAdd(scene.RegionInfo.RegionID, jobId))
throw new OperationException(409, "Diese Region führt bereits einen Archivauftrag aus");
_jobs[jobId] = job;
Record(job, "Archivauftrag angelegt");
return job;
}
private static void Record(Job job, string message)
{
lock (job)
{
job.Events.Add((DateTimeOffset.UtcNow, message));
if (job.Events.Count > 12) job.Events.RemoveAt(0);
}
}
private void Complete(UUID regionId, Job job, string? error)
{
job.Message = error ?? "";
job.State = string.IsNullOrWhiteSpace(error) ? "completed" : "failed";
lock (job)
{
if (job.State is "completed" or "failed") return;
if (string.IsNullOrWhiteSpace(error) && job.Kind == "export")
{
try
{
if (!File.Exists(job.File))
error = "OAR-Datei wurde nicht erstellt.";
else
{
job.Bytes = new FileInfo(job.File).Length;
if (job.Bytes == 0) error = "OAR-Datei ist leer.";
}
}
catch (IOException e) { error = "OAR-Datei konnte nicht geprüft werden: " + e.Message; }
}
job.Message = error ?? "";
job.State = string.IsNullOrWhiteSpace(error) ? "completed" : "failed";
job.Finished = DateTimeOffset.UtcNow;
job.Events.Add((job.Finished.Value, job.State == "completed"
? (job.Kind == "export" ? "OAR-Datei vollständig erstellt" : "Import abgeschlossen")
: "Archivauftrag fehlgeschlagen: " + job.Message));
}
_busy.TryRemove(new KeyValuePair<UUID, string>(regionId, job.Id));
}
// Status is derived from the actual archive file and the archiver
// completion event. A percent value cannot be determined by this API.
private object Snapshot(Job job)
{
lock (job)
{
if (job.Kind == "export" && job.State == "saving")
{
try
{
if (File.Exists(job.File))
{
long bytes = new FileInfo(job.File).Length;
if (bytes > job.Bytes) job.Bytes = bytes;
if (bytes > 0 && !job.FileObserved)
{
job.FileObserved = true;
job.Events.Add((DateTimeOffset.UtcNow,
"OAR-Datei wird geschrieben"));
}
}
}
catch (IOException) { /* Transient write; next poll retries. */ }
}
string stage = job.State switch
{
"queued" => "Auftrag angenommen",
"saving" => job.Bytes > 0 ? "Archivdaten werden geschrieben"
: "Region wird für das OAR gesichert",
"uploading" => "OAR-Datei wird hochgeladen",
"importing" => "OAR-Datei wird importiert",
"completed" => "OAR-Auftrag abgeschlossen",
"failed" => "OAR-Auftrag fehlgeschlagen",
_ => "Archivauftrag wird bearbeitet"
};
var now = DateTimeOffset.UtcNow;
return new
{
id=job.Id,region=job.Region,kind=job.Kind,state=job.State,
stage,message=job.Message,created=job.Created,
finishedAtUtc=job.Finished,
elapsedSeconds=Math.Max(0,(long)((job.Finished??now)-job.Created).TotalSeconds),
bytes=job.Bytes,bytesWritten=job.Bytes,total=job.Total,
percent=job.Kind=="import" && job.Total>0
? (int?)Math.Min(100,100*job.Bytes/job.Total) : null,
download=job.Kind=="export" && job.State=="completed",
events=job.Events.Select(e=>new{timeUtc=e.Time,message=e.Text}).ToArray()
};
}
}
public object? OarStatus(string id)
{
if (!Guid.TryParseExact(id, "N", out _) ||
!_jobs.TryGetValue(id, out Job? job) || job.Kind != "export")
return null;
return Snapshot(job);
}
public object[] RegionSummary()
{
return _scenes.Values.OrderBy(s => s.RegionInfo.RegionName).Select(s =>
@@ -135,16 +221,16 @@ internal sealed class AdminOperations : IDisposable
{
name = r.RegionName, protocol = "UDP", port = udpPort,
local = udpPort > 0 && udp.Any(x => x.Port == udpPort),
publicStatus = "Nicht extern geprüft – Router/NAT/Firewall unbekannt",
hint = "Fritz!Box: UDP-Port an die lokale Simulator-IP weiterleiten"
publicStatus = "UDP: kein externer Protokoll-Handshake geprüft",
hint = "Ein TCP-Verbindungstest bestätigt keine UDP-Erreichbarkeit."
});
int httpPort = (int)r.HttpPort;
rows.Add(new
{
name = r.RegionName, protocol = "TCP", port = httpPort,
local = httpPort > 0 && tcp.Any(x => x.Port == httpPort),
publicStatus = "Nicht extern geprüft – Router/NAT/Firewall unbekannt",
hint = "Fritz!Box: TCP-Port beziehungsweise HTTPS-Proxy prüfen"
publicStatus = "Externe TCP-Prüfung wird geladen",
hint = "Messung erfolgt von einem unabhängigen Standort."
});
}
return rows.ToArray();
@@ -217,40 +303,40 @@ internal sealed class AdminOperations : IDisposable
}
public object[] Jobs() => _jobs.Values.OrderByDescending(x => x.Created).Take(30)
.Select(x => (object)new
{
id = x.Id, region = x.Region, kind = x.Kind, state = x.State,
message = x.Message, created = x.Created, bytes = x.Bytes, total = x.Total,
download = x.Kind == "export" && x.State == "completed"
}).ToArray();
.Select(Snapshot).ToArray();
public object Export(string regionId)
{
var (scene, archive) = GetArchiver(regionId);
Job job = Begin(regionId, "export");
job.File = Path.Combine(_archiveDir, job.Id + ".oar");
Guid requestId = Guid.ParseExact(job.Id, "N");
EventManager.OarFileSaved? complete = null;
complete = (requestId, message) =>
complete = (id, message) =>
{
if (requestId != Guid.ParseExact(job.Id, "N")) return;
if (id != requestId) return;
scene.EventManager.OnOarFileSaved -= complete;
if (string.IsNullOrWhiteSpace(message) && !File.Exists(job.File))
message = "OAR-Datei wurde nicht erstellt";
Complete(scene.RegionInfo.RegionID, job, message);
if (job.State == "completed") job.Bytes = new FileInfo(job.File).Length;
};
scene.EventManager.OnOarFileSaved += complete;
try
// Return the identifier immediately: writing the archive can take
// minutes, and the UI must be able to poll while it is running.
_ = Task.Run(() =>
{
job.State = "saving";
archive.ArchiveRegion(job.File, Guid.ParseExact(job.Id, "N"), new Dictionary<string, object>());
}
catch (Exception e)
{
scene.EventManager.OnOarFileSaved -= complete;
Complete(scene.RegionInfo.RegionID, job, e.Message);
}
return new { id = job.Id, state = job.State };
try
{
lock (job) job.State = "saving";
Record(job, "Archivierung für " + job.Region + " gestartet");
archive.ArchiveRegion(job.File, requestId, new Dictionary<string, object>());
}
catch (Exception e)
{
scene.EventManager.OnOarFileSaved -= complete;
Log.Error("[OS WEBINTERFACE] OAR export failed for " + job.Region, e);
Complete(scene.RegionInfo.RegionID, job, e.Message);
}
});
return new { id = job.Id, state = "queued" };
}
public async Task<object> ImportAsync(string regionId, Stream source, long contentLength, CancellationToken stop)
@@ -315,81 +401,12 @@ internal sealed class AdminOperations : IDisposable
j.Kind != "export" || j.State != "completed")
return null;
string expected = Path.Combine(_archiveDir, id + ".oar");
return j.File == expected && File.Exists(expected) ? expected : null;
lock (j)
return j.File == expected && File.Exists(expected) ? expected : null;
}
public async Task<object> CheckGitAsync(CancellationToken stop)
{
const string endpoint = "https://api.github.com/repos/opengenesislink/opengenesislinkserver/commits?sha=main&per_page=12";
string? local = null;
try { local = await GitShaAsync(stop); } catch { }
try
{
using var response = await GitClient.GetAsync(endpoint, stop);
response.EnsureSuccessStatusCode();
using var document = JsonDocument.Parse(await response.Content.ReadAsStringAsync(stop));
var entries = document.RootElement.EnumerateArray().Select(c => new
{
sha = c.GetProperty("sha").GetString(),
title = (c.GetProperty("commit").GetProperty("message").GetString() ?? "").Split('\n')[0],
date = c.GetProperty("commit").GetProperty("committer").GetProperty("date").GetString()
}).ToArray();
string? remote = entries.FirstOrDefault()?.sha;
int? newCommitCount = null;
if (local is not null && remote is not null && local != remote &&
local.Length == 40 && local.All(Uri.IsHexDigit))
{
try
{
string compare = "https://api.github.com/repos/opengenesislink/opengenesislinkserver/compare/" +
local + "..." + remote;
using var compared = await GitClient.GetAsync(compare, stop);
if (compared.IsSuccessStatusCode)
{
using var detail = JsonDocument.Parse(await compared.Content.ReadAsStringAsync(stop));
newCommitCount = detail.RootElement.GetProperty("total_commits").GetInt32();
entries = detail.RootElement.GetProperty("commits").EnumerateArray().Select(c => new
{
sha = c.GetProperty("sha").GetString(),
title = (c.GetProperty("commit").GetProperty("message").GetString() ?? "").Split('\n')[0],
date = c.GetProperty("commit").GetProperty("committer").GetProperty("date").GetString()
}).ToArray();
}
}
catch (Exception e) { Log.Warn("[OS WEBINTERFACE] GitHub compare unavailable", e); }
}
return new
{
local, remote, upToDate = local is not null && local == remote,
newCommitCount, commits = entries,
note = newCommitCount > entries.Length
? "Es gibt weitere neue Commits; GitHub liefert in dieser Abfrage nur eine Teilmenge."
: "Git-Commits sind Quellcode-Stände, keine geprüften Binär-Releases. Ein Update muss gebaut und vor Aktivierung getestet werden."
};
}
catch (Exception e)
{
return new { local, error = "GitHub nicht erreichbar: " + e.GetType().Name };
}
}
private static async Task<string?> GitShaAsync(CancellationToken stop)
{
string? root = Directory.GetParent(AppContext.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar))?.FullName;
if (root is null || !Directory.Exists(Path.Combine(root, ".git"))) return null;
var start = new ProcessStartInfo("git")
{
WorkingDirectory = root, RedirectStandardOutput = true,
RedirectStandardError = true, UseShellExecute = false
};
start.ArgumentList.Add("rev-parse");
start.ArgumentList.Add("HEAD");
using Process? p = Process.Start(start);
if (p is null) return null;
string output = (await p.StandardOutput.ReadToEndAsync(stop)).Trim();
await p.WaitForExitAsync(stop);
return p.ExitCode == 0 && output.Length == 40 ? output : null;
}
public Task<object> CheckUpdatesAsync(CancellationToken stop) =>
_updateStager.CheckAsync(stop);
public Task<object> StageUpdateAsync(string sha, CancellationToken stop) => _updateStager.StageAsync(sha, stop);
@@ -0,0 +1,347 @@
// SPDX-License-Identifier: LicenseRef-OpenGenesisLINK-EULA
// OpenGenesisLINK Gen1 Health Center and privacy-preserving grid login diagnostics.
using System.Globalization;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
namespace OpenGenesisLINK.Addons.OSWebInterface;
/// <summary>
/// Read-only diagnostics for administrator sessions. No avatar names, UUIDs,
/// passwords, IP addresses, raw log lines or private node tokens leave this class.
/// </summary>
internal static class OglHealthDiagnostics
{
private const int MaxLogBytes = 2 * 1024 * 1024;
private const int WindowMinutes = 60;
private static readonly HttpClient ProbeClient = new(
new HttpClientHandler { AllowAutoRedirect = false })
{ Timeout = TimeSpan.FromSeconds(4) };
private sealed record Finding(string Code, string Label, string Severity,
string Explanation, string Action, DateTimeOffset Time);
private sealed record Component(string Id, string Title, string Status,
string Detail, string Action);
private sealed record CauseInfo(string Code, string Label, string Severity,
string Explanation, string Action);
private static readonly CauseInfo[] Causes =
[
new("missing_dll_type", "Fehlende Kernkomponente", "critical",
"Das Loginmodul erwartet eine Klasse, die in der geladenen DLL nicht vorhanden ist.",
"DLL-Startschutz prüfen und zusammengehörige OGL-Binärdateien bereitstellen."),
new("incompatible_dll_method", "Inkompatible DLL-Schnittstelle", "critical",
"Eine erforderliche Login- oder Framework-Methode ist nicht vorhanden.",
"DLL-Startschutz prüfen; Framework und Loginmodul aus demselben Build bereitstellen."),
new("destination_not_found", "Ankunftsregion nicht verfügbar", "warning",
"Die angeforderte Zielregion konnte nicht aufgelöst oder erreicht werden.",
"Home-Region, Regionseintrag, Grid-Service und Ziel-Simulator prüfen."),
new("credentials_rejected", "Zugangsdaten abgelehnt", "warning",
"Das Grid hat die Anmeldung mit den angegebenen Zugangsdaten abgewiesen.",
"Konto- und Authentifizierungsdienst prüfen, ohne Passwörter zu protokollieren."),
new("viewer_rejected", "Viewer abgewiesen", "warning",
"Die Viewer-Zugangsprüfung hat eine Anmeldung zurückgewiesen.",
"Viewer-Freigabeliste und OGL-Zugangsrichtlinien kontrollieren."),
new("access_policy", "Zugangsrichtlinie", "warning",
"Eine serverseitige Zugangs- oder Bürgerordnungsrichtlinie verhindert den Login.",
"Aktive Richtlinie und notwendige Zustimmung kontrollieren."),
new("login_timeout", "Zeitüberschreitung beim Login", "warning",
"Ein notwendiger Grid-/Simulator-Dienst hat nicht rechtzeitig geantwortet.",
"Netzwerkpfad, Grid-Dienste, Logs und Auslastung kontrollieren."),
new("login_exception", "Interner Loginfehler", "critical",
"Bei der Verarbeitung der Login-Anfrage ist eine Serverausnahme aufgetreten.",
"ROBUST-Loginmodul und aktuelle Serverprotokolle untersuchen."),
new("login_rejected_other", "Anmeldung abgewiesen", "warning",
"Das Loginmodul hat die Anmeldung abgelehnt; weitere Details bleiben im geschützten ROBUST-Protokoll.",
"ROBUST-Logdatei mit Zugriff für Serveradministratoren prüfen.")
];
private static CauseInfo Lookup(string code) =>
Causes.First(x => x.Code == code);
private static string? LatestRobustLog()
{
// Only the local operator can configure the directory.
// Foreign nodes without shared ROBUST logs display "not available".
string? configured = Environment.GetEnvironmentVariable("OGL_HEALTH_ROBUST_LOG_DIR");
string folder = !string.IsNullOrWhiteSpace(configured)
? configured : Path.Combine(AppContext.BaseDirectory, "logs");
if (!Path.IsPathFullyQualified(folder) || !Directory.Exists(folder))
return null;
try
{
return Directory.EnumerateFiles(folder,"Robust_*.log",SearchOption.TopDirectoryOnly)
.OrderByDescending(File.GetLastWriteTimeUtc)
.FirstOrDefault();
}
catch (Exception e) when(e is IOException or UnauthorizedAccessException)
{
return null;
}
}
private static string LastLogChunk(string file)
{
using var stream = new FileStream(file, FileMode.Open, FileAccess.Read,
FileShare.ReadWrite|FileShare.Delete);
long count = Math.Min(stream.Length, MaxLogBytes);
stream.Seek(-count,SeekOrigin.End);
byte[] buffer = new byte[(int)count];
int read = 0;
while (read < buffer.Length)
{
int n = stream.Read(buffer,read,buffer.Length-read);
if (n == 0) break;
read += n;
}
// The first line might be truncated when reading the tail.
string content=Encoding.UTF8.GetString(buffer,0,read);
if (stream.Length > MaxLogBytes)
{
int newline=content.IndexOf('\n');
if (newline>=0) content=content[(newline+1)..];
}
return content;
}
private static bool TryLogTime(string line,out DateTimeOffset time)
{
time=default;
if (line.Length<23) return false;
if (!DateTime.TryParseExact(line[..23],"yyyy-MM-dd HH:mm:ss,fff",
CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal,out DateTime date))
return false;
time=new DateTimeOffset(date.ToUniversalTime(),TimeSpan.Zero);
return true;
}
private static string? Classify(string line,out bool success)
{
success=false;
// Match only known login-specific events; never return the raw line.
bool exception=line.Contains("login_to_simulator",StringComparison.OrdinalIgnoreCase)
&& line.Contains("threw exception",StringComparison.OrdinalIgnoreCase);
bool loginFailure=line.Contains("[LLOGIN SERVICE]",StringComparison.OrdinalIgnoreCase) &&
line.Contains("Login failed",StringComparison.OrdinalIgnoreCase);
bool passed=line.Contains("[LLOGIN SERVICE]",StringComparison.OrdinalIgnoreCase) &&
line.Contains("All clear. Sending login response",StringComparison.OrdinalIgnoreCase);
if(passed){success=true;return null;}
if(!exception&&!loginFailure)return null;
if(line.Contains("Could not load type",StringComparison.OrdinalIgnoreCase))
return "missing_dll_type";
if(line.Contains("Method not found",StringComparison.OrdinalIgnoreCase)||
line.Contains("MissingMethodException",StringComparison.OrdinalIgnoreCase))
return "incompatible_dll_method";
if(line.Contains("destination not found",StringComparison.OrdinalIgnoreCase)||
line.Contains("region not found",StringComparison.OrdinalIgnoreCase))
return "destination_not_found";
if(line.Contains("password",StringComparison.OrdinalIgnoreCase)||
line.Contains("authentication failed",StringComparison.OrdinalIgnoreCase)||
line.Contains("incorrect credentials",StringComparison.OrdinalIgnoreCase))
return "credentials_rejected";
if(line.Contains("viewer",StringComparison.OrdinalIgnoreCase)||
line.Contains("channel not allowed",StringComparison.OrdinalIgnoreCase))
return "viewer_rejected";
if(line.Contains("citizen rules",StringComparison.OrdinalIgnoreCase)||
line.Contains("access policy",StringComparison.OrdinalIgnoreCase)||
line.Contains("terms",StringComparison.OrdinalIgnoreCase)||
line.Contains("blocked",StringComparison.OrdinalIgnoreCase))
return "access_policy";
if(line.Contains("timed out",StringComparison.OrdinalIgnoreCase)||
line.Contains("timeout",StringComparison.OrdinalIgnoreCase))
return "login_timeout";
return exception?"login_exception":"login_rejected_other";
}
public static object LoginDiagnostics()
{
var now=DateTimeOffset.UtcNow;
var findings=new List<Finding>();
string? path=LatestRobustLog();
if (path is null)
{
return new {
available=false, status="unknown", checkedAtUtc=now, lookbackMinutes=WindowMinutes,
source="ROBUST-Protokoll hier nicht verfügbar", sampleLimited=true,
successes=0, failures=0, critical=0,
causes=Array.Empty<object>(), recent=Array.Empty<object>(),
message="Die ROBUST-Logdatei ist für diese Simulatorinstanz nicht eingebunden.",
note="Ein fehlender Diagnosebericht bedeutet nicht, dass Avatar-Logins fehlschlagen."
};
}
try
{
var info=new FileInfo(path);
string text=LastLogChunk(path);
int successes=0;
foreach(string line in text.Split('\n'))
{
if(!TryLogTime(line,out var timestamp) ||
timestamp<now.AddMinutes(-WindowMinutes) ||
timestamp>now.AddMinutes(5)) continue;
string? code=Classify(line,out bool passed);
if(passed){successes++;continue;}
if(code is null)continue;
CauseInfo c=Lookup(code);
findings.Add(new(c.Code,c.Label,c.Severity,c.Explanation,c.Action,timestamp));
}
int severe=findings.Count(x=>x.Severity=="critical");
string status=severe>0?"critical":findings.Count>0?"warning":
successes>0?"ok":"unknown";
var summaries=findings.GroupBy(x=>x.Code)
.OrderByDescending(g=>g.Count())
.Select(g=>new{
code=g.Key,label=g.First().Label,severity=g.First().Severity,
count=g.Count(),lastSeenUtc=g.Max(x=>x.Time),
explanation=g.First().Explanation,action=g.First().Action
}).ToArray();
var recent=findings.OrderByDescending(x=>x.Time).Take(18)
.Select(x=>new{timeUtc=x.Time,code=x.Code,label=x.Label,
severity=x.Severity,explanation=x.Explanation,
action=x.Action}).ToArray();
long age=Math.Max(0,(long)(now-info.LastWriteTimeUtc).TotalSeconds);
return new{
available=true,status,checkedAtUtc=now,lookbackMinutes=WindowMinutes,
source="Lokales ROBUST-Protokoll (anonymisierte Ereignisse)",
sampleLimited=info.Length>MaxLogBytes,logAgeSeconds=age,
successes,failures=findings.Count,critical=severe,
causes=summaries,recent,
message=severe>0?"Kritischer Loginfehler im ausgewerteten Zeitraum erkannt.":
findings.Count>0?"Einzelne abgewiesene Loginversuche protokolliert.":
successes>0?"Erfolgreiche Loginantworten im Protokoll erkannt.":
"Keine auswertbaren Loginereignisse im aktuellen Protokollausschnitt.",
note="Nur der letzte Protokollausschnitt (höchstens 2 MiB) wird für die letzten "+
WindowMinutes+" Minuten ausgewertet. Keine Namen, IDs, IP-Adressen oder Rohprotokolle "+
"in dieser Ansicht. Ein protokollierter Erfolg ist kein vollständiger Viewer-End-to-End-Test."
};
}
catch(Exception e) when(e is IOException or UnauthorizedAccessException or ArgumentException)
{
return new {
available=false,status="unknown",checkedAtUtc=now,
lookbackMinutes=WindowMinutes,source="ROBUST-Protokoll nicht lesbar",
sampleLimited=true,successes=0,failures=0,critical=0,
causes=Array.Empty<object>(),recent=Array.Empty<object>(),
message="Die lokale ROBUST-Protokollauswertung ist derzeit nicht möglich.",
note="Logzugriff prüfen; es wurden keine Zugangsdaten offengelegt."
};
}
}
private static async Task<Component> Probe(string id,string title,string? address,
CancellationToken stop)
{
if (string.IsNullOrWhiteSpace(address))
return new(id,title,"unknown","Auf dieser Node nicht konfiguriert.",
"Dienstkonfiguration prüfen, falls dieser Dienst verwendet werden soll.");
if (!Uri.TryCreate(address,UriKind.Absolute,out Uri? uri) ||
uri.Scheme!=Uri.UriSchemeHttps||uri.UserInfo.Length>0 ||
uri.Query.Length>0 ||uri.Fragment.Length>0)
return new(id,title,"unknown","Keine gültige HTTPS-Dienstadresse konfiguriert.",
"HTTPS-Ziel der Node prüfen.");
try
{
// Only site owners can set this environment variable. No user-provided URLs.
using var cancel=CancellationTokenSource.CreateLinkedTokenSource(stop);
cancel.CancelAfter(TimeSpan.FromSeconds(3));
using var response=await ProbeClient.GetAsync(new Uri(uri,"/v1/health"),cancel.Token);
return response.IsSuccessStatusCode?
new(id,title,"ok","HTTPS-Healthcheck erfolgreich.",
"Keine Maßnahme erforderlich."):
new(id,title,"warning","Zentrale antwortet mit HTTP "+(int)response.StatusCode+".",
"Dienststatus und HTTPS-Reverse-Proxy prüfen.");
}
catch(Exception ex) when(ex is HttpRequestException or OperationCanceledException)
{
return new(id,title,"warning","Zentraler Dienst reagiert nicht auf die HTTPS-Prüfung.",
"Netzwerkverbindung und zentralen Dienst kontrollieren.");
}
}
public static async Task<object> SummaryAsync(AdminOperations operations,CancellationToken stop)
{
var now=DateTimeOffset.UtcNow;
var components=new List<Component>();
object[] regions=operations.RegionSummary();
int notReady=0;
int avatars=0;
foreach(var obj in regions)
{
JsonElement value=JsonSerializer.SerializeToElement(obj);
if(!value.GetProperty("ready").GetBoolean())notReady++;
avatars+=value.GetProperty("agents").GetInt32();
}
components.Add(new("regions","Simulator und Regionen",
regions.Length==0?"warning":notReady>0?"critical":"ok",
regions.Length+" lokal geladene Regionen, "+(regions.Length-notReady)+
" bereit, "+avatars+" Root-Avatare online.",
regions.Length==0?"Simulatorstart und Regionskonfiguration prüfen.":
notReady>0?"Nicht bereite Regionen im Regionsmenü untersuchen.":
"Keine Maßnahme erforderlich."));
object[] services=await operations.ServiceSummaryAsync(stop);
int down=0;
foreach(object item in services)
{
var value=JsonSerializer.SerializeToElement(item);
bool reachable=value.GetProperty("reachable").GetBoolean();
if(!reachable)down++;
}
components.Add(new("grid_services","ROBUST-/Grid-Service-Endpunkte",
services.Length==0?"unknown":down>0?"warning":"ok",
services.Length==0?"Keine Grid-Service-Ports konfiguriert.":
(services.Length-down)+" von "+services.Length+
" konfigurierten TCP-Endpunkten erreichbar.",
down>0?"Routing, DNS, Firewall und Dienstports prüfen.":
"TCP bestätigt nur die Erreichbarkeit; keine Login-Funktionsgarantie."));
var baseDir=Path.Combine(AppContext.BaseDirectory,"ops-data");
var preflight=Path.Combine(baseDir,"compatibility-simulator.json");
bool loaded=File.Exists(preflight);
string preflightStatus="unknown",preflightDetail="Kein aktueller DLL-Prüfbericht.";
if(loaded)
{
try
{
using var json=JsonDocument.Parse(File.ReadAllText(preflight));
preflightStatus=json.RootElement.GetProperty("status").GetString()=="ok"?"ok":"critical";
preflightDetail=preflightStatus=="ok"?
"Kern-DLLs auf dem Datenträger als kompatibel geprüft.":
"DLL-Kompatibilitätsproblem auf dem Datenträger erkannt.";
}
catch(Exception e) when(e is IOException or JsonException or UnauthorizedAccessException)
{
preflightDetail="Prüfbericht ist derzeit nicht lesbar.";
}
}
components.Add(new("preflight","DLL-Startschutz",preflightStatus,
preflightDetail,"Einzelheiten unter System & Integrität ansehen."));
// Never infer login success from healthy TCP ports or process uptime.
JsonElement login=JsonSerializer.SerializeToElement(LoginDiagnostics());
string loginStatus=login.GetProperty("status").GetString()??"unknown";
components.Add(new("login","Avatar-Loginprotokoll",loginStatus,
login.GetProperty("message").GetString()??"Keine Daten.",
"Für genaue Ursachen die anonymisierte Login-Diagnose öffnen."));
string? updates=Environment.GetEnvironmentVariable("OGL_UPDATE_CENTRAL_URL");
string? translator=Environment.GetEnvironmentVariable("OGL_TRANSLATOR_CENTRAL_URL");
var probes=await Task.WhenAll(
Probe("update_center","OGL Update Center",updates,stop),
Probe("translator","OGL Global Translater",translator,stop));
components.AddRange(probes);
var active=components.Where(x=>x.Status!="unknown").ToArray();
string state=active.Any(x=>x.Status=="critical")?"critical":
active.Any(x=>x.Status=="warning")?"warning":
active.Length==0?"unknown":"ok";
return new {
status=state,
checkedAtUtc=now,
components=components.Select(x=>new{
id=x.Id,title=x.Title,status=x.Status,
detail=x.Detail,action=x.Action
}).ToArray(),
evaluated=active.Length,
attention=components.Count(x=>x.Status is "critical" or "warning"),
note="Live-Checks der lokalen Simulatorinstanz und konfigurierter Endpunkte. "+
"TCP-/HTTPS-Erreichbarkeit und Logauswertung ersetzen keine echte Avatar-Anmeldung."
};
}
}
+204 -94
View File
@@ -1,147 +1,265 @@
// SPDX-License-Identifier: MPL-2.0
// SPDX-License-Identifier: LicenseRef-OpenGenesisLINK-EULA
using System.IO.Compression;
using System.Net;
using System.Net.Http.Headers;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text.Json;
namespace OpenGenesisLINK.Addons.OSWebInterface;
/// <summary>
/// Safe download-only update stage: verifies advertised SHA, saves the GitHub
/// source snapshot, and backs up configuration BEFORE any future installation.
/// Does not execute downloaded source or replace running simulator assemblies.
/// Closed-code OGL update client. Fetches only reviewed binary releases from
/// the central OGL Update Center. Does not access git or execute installer code.
/// </summary>
internal sealed class UpdateStager
{
private static readonly HttpClient GitHub = CreateClient();
private readonly string _data;
private readonly int _retention;
private readonly SemaphoreSlim _lock = new(1, 1);
public const long MaxSnapshot = 256L * 1024 * 1024;
private readonly HttpClient _client = new(
new HttpClientHandler { AllowAutoRedirect = false })
{ Timeout = TimeSpan.FromMinutes(5) };
private const long MaxArchive = 768L * 1024 * 1024;
private sealed record Release(string Id, string Version, string TargetOs,
string TargetArch, string Sha256, long Size, string Notes, string PublishedAtUtc);
private sealed record Snapshot(bool Configured, bool Connected, bool Available,
string Node, string Message, Release? Release);
private static HttpClient CreateClient()
{
var client = new HttpClient(new HttpClientHandler { AllowAutoRedirect = false })
{
Timeout = TimeSpan.FromMinutes(5)
};
client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("OpenGenesisLINK-UpdateStage", "0.1"));
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/vnd.github+json"));
return client;
}
public UpdateStager(string data, int retention)
{
_data = data;
_retention = retention;
}
private static void PrivateDirectory(string dir)
private static (Uri? Base, string Node, string Token) Settings()
{
string url = Environment.GetEnvironmentVariable("OGL_UPDATE_CENTRAL_URL")?.Trim() ?? "";
string node = Environment.GetEnvironmentVariable("OGL_UPDATE_NODE_ID")?.Trim() ?? "";
string token = Environment.GetEnvironmentVariable("OGL_UPDATE_NODE_TOKEN") ?? "";
if (!Uri.TryCreate(url, UriKind.Absolute, out Uri? parsed) ||
parsed.Scheme != Uri.UriSchemeHttps || parsed.UserInfo.Length != 0 ||
parsed.AbsolutePath != "/" || parsed.Query.Length != 0 || parsed.Fragment.Length != 0 ||
token.Length < 32 || node.Length < 3 || node.Length > 64)
return (null, node, "");
return (parsed, node, token);
}
private static string OsName =>
OperatingSystem.IsLinux() ? "linux" :
OperatingSystem.IsWindows() ? "windows" :
OperatingSystem.IsMacOS() ? "macos" : "unsupported";
private static string ArchName => RuntimeInformation.OSArchitecture switch
{
Architecture.X64 => "x64", Architecture.Arm64 => "arm64",
Architecture.X86 => "x86", _ => "unsupported"
};
private async Task<Snapshot> GetAsync(CancellationToken stop)
{
var (baseUri, node, token) = Settings();
if (baseUri is null)
return new(false, false, false, node,
"Dieser Simulator ist noch nicht beim OGL Update Center registriert.", null);
try
{
using var req = new HttpRequestMessage(HttpMethod.Get,
new Uri(baseUri, "/v1/releases/latest?os=" + OsName + "&arch=" + ArchName));
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
using var linked = CancellationTokenSource.CreateLinkedTokenSource(stop);
linked.CancelAfter(TimeSpan.FromSeconds(8));
using HttpResponseMessage res = await _client.SendAsync(req, linked.Token);
if (!res.IsSuccessStatusCode)
return new(true, false, false, node,
"OGL Update Center: Node-Anmeldung oder Verbindung fehlgeschlagen (HTTP " +
(int)res.StatusCode + ").", null);
using var document = JsonDocument.Parse(await res.Content.ReadAsStreamAsync(linked.Token));
JsonElement root = document.RootElement;
bool available = root.GetProperty("available").GetBoolean();
if (!available)
return new(true, true, false, node,
root.TryGetProperty("message", out var msg)
? (msg.GetString() ?? "Keine neue Version freigegeben.")
: "Keine neue Version freigegeben.", null);
JsonElement item = root.GetProperty("release");
var release = new Release(
item.GetProperty("id").GetString() ?? "",
item.GetProperty("version").GetString() ?? "",
item.GetProperty("targetOs").GetString() ?? "",
item.GetProperty("targetArch").GetString() ?? "",
item.GetProperty("sha256").GetString() ?? "",
item.GetProperty("size").GetInt64(),
item.TryGetProperty("notes", out var notes) ? notes.GetString() ?? "" : "",
item.TryGetProperty("publishedAtUtc", out var published)
? published.GetString() ?? "" : "");
bool compatible = release.TargetOs == OsName && release.TargetArch == ArchName;
return new(true, true, compatible, node,
compatible ? "Ein geprüftes Update steht zum Herunterladen bereit." :
"Ein neues Release ist vorhanden, jedoch nicht für diese Plattform/Architektur.",
release);
}
catch (Exception ex) when (ex is not OperationCanceledException || !stop.IsCancellationRequested)
{
return new(true, false, false, node,
"OGL Update Center derzeit nicht erreichbar (" + ex.GetType().Name + ").", null);
}
}
public async Task<object> CheckAsync(CancellationToken stop)
{
Snapshot snap = await GetAsync(stop);
string local = OpenSim.VersionInfo.VersionNumber;
return new
{
configured = snap.Configured,
connected = snap.Connected,
nodeId = snap.Node,
currentVersion = local,
available = snap.Available &&
snap.Release is not null &&
!string.Equals(snap.Release.Version, local, StringComparison.OrdinalIgnoreCase),
release = snap.Release is null ? null : new
{
id = snap.Release.Id, version = snap.Release.Version,
targetOs = snap.Release.TargetOs, targetArch = snap.Release.TargetArch,
sha256 = snap.Release.Sha256, size = snap.Release.Size,
notes = snap.Release.Notes, publishedAtUtc = snap.Release.PublishedAtUtc
},
message = snap.Release?.Version == local ?
"Diese OGL-Version ist bereits installiert." : snap.Message,
checkedAtUtc = DateTimeOffset.UtcNow
};
}
private static bool ReleaseId(string id) =>
id.Length is >= 3 and <= 71 && char.IsLetterOrDigit(id[0]) &&
id.All(c => char.IsLetterOrDigit(c) || c is '-' or '_' or '.');
private static void PrivateDir(string dir)
{
Directory.CreateDirectory(dir);
if (!OperatingSystem.IsWindows())
File.SetUnixFileMode(dir, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
File.SetUnixFileMode(dir,
UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
}
private static void PrivateFile(string file)
{
if (!OperatingSystem.IsWindows())
File.SetUnixFileMode(file, UnixFileMode.UserRead | UnixFileMode.UserWrite);
}
private static bool Sha(string sha) =>
sha.Length == 40 && sha.All(Uri.IsHexDigit);
private static async Task<HttpResponseMessage> RequestSnapshot(string sha, CancellationToken stop)
public async Task<object> StageAsync(string id, CancellationToken stop)
{
var first = await GitHub.GetAsync(
"https://api.github.com/repos/opengenesislink/opengenesislinkserver/tarball/" + sha,
HttpCompletionOption.ResponseHeadersRead, stop);
if (first.StatusCode is HttpStatusCode.MovedPermanently or HttpStatusCode.Redirect or
HttpStatusCode.RedirectMethod or HttpStatusCode.TemporaryRedirect or HttpStatusCode.PermanentRedirect)
{
Uri? target = first.Headers.Location;
first.Dispose();
if (target is null || target.Scheme != Uri.UriSchemeHttps ||
!string.Equals(target.Host, "codeload.github.com", StringComparison.OrdinalIgnoreCase) ||
!target.AbsolutePath.StartsWith("/opengenesislink/opengenesislinkserver/", StringComparison.Ordinal))
throw new IOException("GitHub-Snapshot verweist auf eine unerwartete Adresse.");
return await GitHub.GetAsync(target, HttpCompletionOption.ResponseHeadersRead, stop);
}
return first;
}
public async Task<object> StageAsync(string sha, CancellationToken stop)
{
if (!Sha(sha)) throw new AdminOperations.OperationException(400, "Ungültiger Commit SHA");
if (OperatingSystem.IsWindows()) throw new AdminOperations.OperationException(501, "Windows-Update-Backup benötigt zuerst geprüfte NTFS-ACL-Berechtigungen; Update-Staging deaktiviert.");
if (!_lock.Wait(0)) throw new AdminOperations.OperationException(409, "Ein Update-Download läuft bereits");
if (!ReleaseId(id))
throw new AdminOperations.OperationException(400, "Ungültige OGL-Releasekennung.");
if (OperatingSystem.IsWindows())
throw new AdminOperations.OperationException(501,
"Windows-Staging erfordert zuerst geprüfte NTFS-ACLs.");
if (!_lock.Wait(0))
throw new AdminOperations.OperationException(409, "Ein Update-Download läuft bereits.");
try
{
using var latestResponse = await GitHub.GetAsync(
"https://api.github.com/repos/opengenesislink/opengenesislinkserver/commits/main", stop);
latestResponse.EnsureSuccessStatusCode();
using var latestDocument = JsonDocument.Parse(await latestResponse.Content.ReadAsStringAsync(stop));
string latest = latestDocument.RootElement.GetProperty("sha").GetString() ?? "";
if (!string.Equals(latest, sha, StringComparison.OrdinalIgnoreCase))
throw new AdminOperations.OperationException(409, "Commit ist nicht mehr die aktuelle main-Version. Bitte neu prüfen.");
string stage = Path.Combine(_data, "updates");
Snapshot snap = await GetAsync(stop);
if (!snap.Connected || !snap.Available || snap.Release is null)
throw new AdminOperations.OperationException(503, snap.Message);
Release release = snap.Release;
if (release.Id != id ||
release.Version == OpenSim.VersionInfo.VersionNumber ||
release.Size is < 1 or > MaxArchive ||
release.Sha256.Length != 64 || !release.Sha256.All(Uri.IsHexDigit))
throw new AdminOperations.OperationException(409,
"Dieses Release ist nicht für den Simulator freigegeben.");
var (baseUri, _, token) = Settings();
if (baseUri is null)
throw new AdminOperations.OperationException(503,"Node-Verbindung fehlt.");
string staging = Path.Combine(_data, "updates");
string backups = Path.Combine(_data, "configuration-backups");
PrivateDirectory(stage);
PrivateDirectory(backups);
string filename = Path.Combine(stage, sha.ToLowerInvariant() + ".tar.gz");
PrivateDir(staging); PrivateDir(backups);
string filename = Path.Combine(staging, release.Id + ".zip");
if (File.Exists(filename))
return new { state = "staged", sha, path = "updates/" + Path.GetFileName(filename), note = "Quellcode bereits heruntergeladen. Keine Binärdateien verändert." };
string tmp = filename + ".partial";
{
await using var existing = File.OpenRead(filename);
string localSha = Convert.ToHexString(await SHA256.HashDataAsync(existing, stop));
if (localSha.Equals(release.Sha256,StringComparison.OrdinalIgnoreCase))
return new { state = "staged", release = release.Id, path = "updates/" +
Path.GetFileName(filename), note = "Bereits geprüft heruntergeladen; keine Installation ausgeführt." };
File.Delete(filename);
}
string temp = filename + ".partial";
if (File.Exists(temp)) File.Delete(temp);
try
{
using var response = await RequestSnapshot(sha, stop);
response.EnsureSuccessStatusCode();
if (response.Content.Headers.ContentLength > MaxSnapshot)
throw new IOException("Quellcode-Snapshot überschreitet das Downloadlimit.");
await using (var input = await response.Content.ReadAsStreamAsync(stop))
await using (var output = new FileStream(tmp, FileMode.CreateNew, FileAccess.Write,
FileShare.None, 128 * 1024, true))
using var request = new HttpRequestMessage(HttpMethod.Get,
new Uri(baseUri, "/v1/releases/" + release.Id + "/download"));
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
using HttpResponseMessage res = await _client.SendAsync(request,
HttpCompletionOption.ResponseHeadersRead, stop);
if (!res.IsSuccessStatusCode)
throw new IOException("Das Updatepaket wurde nicht freigegeben (HTTP " +
(int)res.StatusCode + ").");
if (res.Content.Headers.ContentLength != release.Size)
throw new IOException("Paketgröße entspricht nicht der geprüften Freigabe.");
await using (Stream input = await res.Content.ReadAsStreamAsync(stop))
await using (var output = new FileStream(temp, FileMode.CreateNew,
FileAccess.Write, FileShare.None, 128*1024, true))
{
byte[] buffer = new byte[128 * 1024];
long copied = 0;
byte[] buf = new byte[128*1024];
int count;
while ((count = await input.ReadAsync(buffer, stop)) > 0)
while ((count = await input.ReadAsync(buf, stop)) > 0)
{
copied += count;
if (copied > MaxSnapshot) throw new IOException("Quellcode-Snapshot zu groß");
await output.WriteAsync(buffer.AsMemory(0, count), stop);
if (copied > release.Size || copied > MaxArchive)
throw new IOException("Ungültige Paketgröße.");
await output.WriteAsync(buf.AsMemory(0,count),stop);
}
if (copied != release.Size)
throw new IOException("Unvollständiger Download.");
}
PrivateFile(temp);
await using (var verify = File.OpenRead(temp))
{
string hash = Convert.ToHexString(await SHA256.HashDataAsync(verify,stop));
if (!hash.Equals(release.Sha256,StringComparison.OrdinalIgnoreCase))
throw new IOException("SHA-256-Prüfung fehlgeschlagen.");
}
PrivateFile(tmp);
// Config and secret backup is local only, restricted to the service account.
string stamp = DateTimeOffset.UtcNow.ToString("yyyyMMddTHHmmssfffZ");
string backup = Path.Combine(backups, stamp + "-" + sha[..12] + ".zip");
string backup = Path.Combine(backups, stamp+"-"+release.Id+".zip");
BackupConfigs(backup);
File.Move(tmp, filename);
File.Move(temp, filename);
PrivateFile(filename);
Prune(backups);
return new
{
state = "staged", sha, path = "updates/" + Path.GetFileName(filename),
state = "staged", release = release.Id,
path = "updates/" + Path.GetFileName(filename),
backup = "configuration-backups/" + Path.GetFileName(backup),
note = "Quellcode heruntergeladen und Konfiguration gesichert. Noch KEIN Build, KEINE Installation und KEIN Neustart erfolgt."
note = "Geprüftes OGL-Binärupdate heruntergeladen; lokale Konfiguration gesichert. " +
"Keine Installation oder Simulatorunterbrechung ausgeführt."
};
}
finally { try { if (File.Exists(tmp)) File.Delete(tmp); } catch { } }
finally { try { if (File.Exists(temp)) File.Delete(temp); } catch { } }
}
catch (AdminOperations.OperationException) { throw; }
catch (Exception e) { throw new AdminOperations.OperationException(502, "Update konnte nicht vorbereitet werden: " + e.Message); }
catch (Exception error)
{
throw new AdminOperations.OperationException(502,
"OGL Update Center: Paket konnte nicht vorbereitet werden (" +
error.GetType().Name + ").");
}
finally { _lock.Release(); }
}
private static void BackupConfigs(string backup)
private static void BackupConfigs(string target)
{
string root = AppContext.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar);
// Never allow a backup root provided by the browser.
string[] direct = ["OpenSim.ini", "OpenSimDefaults.ini", "nexverse.local.env"];
string[] dirs = ["Regions", "config-include"];
using var zip = new ZipArchive(File.Open(backup, FileMode.CreateNew), ZipArchiveMode.Create);
PrivateFile(backup);
using var zip = new ZipArchive(File.Open(target, FileMode.CreateNew), ZipArchiveMode.Create);
PrivateFile(target);
foreach (string f in direct)
{
string path = Path.Combine(root, f);
@@ -156,16 +274,9 @@ internal sealed class UpdateStager
{
if ((File.GetAttributes(f) & FileAttributes.ReparsePoint) != 0) continue;
string relative = Path.GetRelativePath(root, f);
if (relative.EndsWith(".ini", StringComparison.OrdinalIgnoreCase) ||
relative.EndsWith(".xml", StringComparison.OrdinalIgnoreCase) ||
relative.EndsWith(".pem", StringComparison.OrdinalIgnoreCase) ||
relative.EndsWith(".env", StringComparison.OrdinalIgnoreCase) ||
relative.EndsWith(".p12", StringComparison.OrdinalIgnoreCase) ||
relative.EndsWith(".pfx", StringComparison.OrdinalIgnoreCase) ||
relative.EndsWith(".key", StringComparison.OrdinalIgnoreCase) ||
relative.EndsWith(".crt", StringComparison.OrdinalIgnoreCase) ||
relative.EndsWith(".json", StringComparison.OrdinalIgnoreCase))
zip.CreateEntryFromFile(f, relative.Replace('\\', '/'), CompressionLevel.Optimal);
if (new[]{".ini",".xml",".pem",".env",".p12",".pfx",".key",".crt",".json"}
.Any(ext => relative.EndsWith(ext,StringComparison.OrdinalIgnoreCase)))
zip.CreateEntryFromFile(f, relative.Replace('\\','/'), CompressionLevel.Optimal);
}
}
}
@@ -173,10 +284,9 @@ internal sealed class UpdateStager
private void Prune(string backupDir)
{
foreach (string old in Directory.EnumerateFiles(backupDir, "*.zip")
.OrderByDescending(File.GetCreationTimeUtc).Skip(_retention))
.OrderByDescending(File.GetCreationTimeUtc).Skip(_retention))
{
if (Path.GetFileName(old).Length > 30)
File.Delete(old);
if (Path.GetFileName(old).Length > 30) File.Delete(old);
}
}
}
+9 -6
View File
@@ -6,9 +6,9 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../OpenSim/Framework/OpenSim.Framework.csproj" />
<ProjectReference Include="../../OpenSim/Region/Framework/OpenSim.Region.Framework.csproj" />
<ProjectReference Include="../../OpenSim/Services/Interfaces/OpenSim.Services.Interfaces.csproj" />
<Reference Include="OpenSim.Framework"><HintPath>../../bin/OpenSim.Framework.dll</HintPath><Private>false</Private></Reference>
<Reference Include="OpenSim.Region.Framework"><HintPath>../../bin/OpenSim.Region.Framework.dll</HintPath><Private>false</Private></Reference>
<Reference Include="OpenSim.Services.Interfaces"><HintPath>../../bin/OpenSim.Services.Interfaces.dll</HintPath><Private>false</Private></Reference>
<Reference Include="Mono.Addins"><HintPath>../../bin/Mono.Addins.dll</HintPath><Private>false</Private></Reference>
<Reference Include="Nini"><HintPath>../../bin/Nini.dll</HintPath><Private>false</Private></Reference>
<Reference Include="OpenMetaverse"><HintPath>../../bin/OpenMetaverse.dll</HintPath><Private>false</Private></Reference>
@@ -19,8 +19,11 @@
<EmbeddedResource Include="www/index.html" />
<EmbeddedResource Include="www/app.js" />
<EmbeddedResource Include="www/style.css" />
<EmbeddedResource Include="www/oar-live.css" />
<EmbeddedResource Include="www/oar-live.js" />
<EmbeddedResource Include="www/ogl-simulator-logo.webp" />
<EmbeddedResource Include="www/ogl-simulator-favicon.png" />
<EmbeddedResource Include="www/ogl-simulator-apple-icon.png" />
</ItemGroup>
<Target Name="CopyAddonToSimulatorBin" AfterTargets="Build" Condition="'$(DesignTimeBuild)' != 'true'">
<Copy SourceFiles="$(TargetPath)" DestinationFiles="$(MSBuildThisFileDirectory)../../bin/$(TargetFileName)" SkipUnchangedFiles="true" />
</Target>
</Project>
+276 -13
View File
@@ -1,6 +1,6 @@
"use strict";
const $ = id => document.getElementById(id);
let csrf="",overview=null,jobsTimer=null,modalAction=null,latestSha=null;
let csrf="",overview=null,jobsTimer=null,modalAction=null,latestReleaseId=null;
const money = size => (size/(1024**2)).toFixed(1)+" MiB";
const sleepTime = s => {const h=Math.floor(s/3600),m=Math.floor((s%3600)/60);return h+"h "+m+"m"};
function notice(message, title="Hinweis", action=null) { $("modal-title").textContent=title; $("modal-message").textContent=message; $("modal").hidden=false; modalAction=action; $("modal-cancel").hidden=!action; }
@@ -38,28 +38,291 @@ function renderOverview(d) {
});
const sel=$("archive-region"),v=sel.value;sel.replaceChildren();
regs.forEach(r=>{const o=document.createElement("option");o.value=r.id;o.textContent=r.name;sel.append(o)});if(regs.some(r=>r.id===v))sel.value=v;
table("ports-table",["Region","Protokoll","Port","Lokaler Listener","Öffentlicher Zugang"],(d.endpoints||[]).map(p=>{const x=row(p.name,p.protocol,p.port,p.local?"OK":"Nicht aktiv",p.publicStatus);return x}));
if(!$("network").hidden)loadNetworkStatus();
}
async function refresh(){try{renderOverview(await api("/api/overview"));}catch(e){notice(e.message,"Verbindung fehlgeschlagen")}}
async function loadJobs(){try{const data=await api("/api/jobs");const rows=(data.jobs||[]).map(j=>{const x=row(j.region,j.kind,j.state,j.total?(100*j.bytes/j.total).toFixed(0)+"%":"–",j.message||"–","");
if(j.download){const a=document.createElement("a");a.href="/api/oar/download?id="+encodeURIComponent(j.id);a.textContent="OAR herunterladen";a.style.color="#69c7fb";x.lastElementChild.replaceChildren(a)}return x});
table("job-table",["Region","Art","Status","Upload","Meldung","Download"],rows)}catch(e){notice(e.message,"Aufträge")}}
if(j.download){const a=document.createElement("a");a.href="/api/oar/download?id="+encodeURIComponent(j.id);a.textContent="OAR herunterladen";a.style.color="#69c7fb";x.lastElementChild.replaceChildren(a)}
if(j.kind==="export"){
const action=document.createElement("button");
action.type="button";action.className="ghost";
action.textContent=j.state==="completed"?"Details ansehen":"Live-Status ansehen";
action.addEventListener("click",()=>window.openOarLiveModal(j.id));
const cell=document.createElement("td");cell.append(action);x.append(cell);
}else{x.append(document.createElement("td"))}
return x});
table("job-table",["Region","Art","Status","Upload","Meldung","Download","Live-Status"],rows)}catch(e){notice(e.message,"Aufträge")}}
async function loadLogs(){try{$("log-text").textContent=(await api("/api/logs")).content;}catch(e){$("log-text").textContent=e.message}}
async function loadUpdates(){try{const live=await api("/api/updates/live-status");const status=live.update||{};$("update-live-status").textContent=live.enabled?(live.reachable?("Status: "+(status.state||"unbekannt")+" · Schritt "+(status.phase||0)+"/7 · "+(status.message||"")):live.message):"Nicht aktiviert – AllowLiveUpdates, NodeAgent und externer Updater müssen konfiguriert werden.";$("update-live-start").hidden=!(live.enabled&&live.reachable&&status.state!=="running"&&status.state!=="queued");const d=await api("/api/updates/check");latestSha=d.remote||null;$("local-sha").textContent=d.local||"Kein lokaler Git-Checkout erkannt";$("remote-sha").textContent=d.remote||"–";$("version-note").textContent=(d.newCommitCount!=null?d.newCommitCount+" Commits seit deinem Stand. ":"")+(d.error||d.note||"");const box=$("commits");box.replaceChildren();(d.commits||[]).forEach(c=>{const x=document.createElement("article");x.className="commit";const b=document.createElement("b");b.textContent=c.title;const sm=document.createElement("small");sm.textContent=c.sha.slice(0,12)+" · "+new Date(c.date).toLocaleString("de-DE");x.append(b,sm);box.append(x)})}catch(e){notice(e.message,"GitHub")}}
function showView(name){document.querySelectorAll(".view").forEach(v=>v.hidden=v.id!==name);document.querySelectorAll("nav a").forEach(v=>v.classList.toggle("active",v.dataset.view===name));const titles={overview:"Übersicht",regions:"Regionen & Aktionen",archives:"OAR-Archive",network:"Netzwerk & Ports",logs:"Simulator-Logs",updates:"Updates & GitHub"};$("page-title").textContent=titles[name]||"Übersicht";if(name==="logs")loadLogs();if(name==="archives")loadJobs();if(name==="updates")loadUpdates();}
function showUpdateNotification(d){
const release=d?.release||null;
const available=Boolean(d?.available&&release);
const nav=document.querySelector('nav a[data-view="updates"]');
if(nav){
nav.textContent=available?"OGL Server-Updates · NEU":"OGL Server-Updates";
nav.dataset.updateAvailable=available?"true":"false";
}
const noticeBox=$("ogl-update-notice");
noticeBox.hidden=!available;
if(available){
$("ogl-update-notice-text").textContent=
"Version "+release.version+" für "+release.targetOs+" / "+release.targetArch+
" wurde zentral freigegeben und kann sicher heruntergeladen werden.";
}
}
async function checkUpdateNotification(){
if($("dashboard").hidden)return;
try{showUpdateNotification(await api("/api/updates/check"));}
catch{ /* Keep the last known status; an offline service is not a new release. */ }
}
async function loadUpdates(){
$("update-connection").textContent="Wird geprüft";
try{
const d=await api("/api/updates/check");
showUpdateNotification(d);
const release=d.release||null;
latestReleaseId=d.available&&release?release.id:null;
$("local-version").textContent=d.currentVersion||"Nicht verfügbar";
$("remote-version").textContent=release?.version||"Keine Freigabe";
$("update-connection").textContent=d.connected?"Verbunden":
d.configured?"Nicht erreichbar":"Nicht eingerichtet";
$("update-availability").textContent=d.available?"Update verfügbar":
d.connected?"Keine neue Version":"Prüfung ausstehend";
$("version-note").textContent=d.message||"OGL-Server-Updatecenter.";
$("release-details").textContent=release?
"Version "+release.version+" · "+release.targetOs+" / "+release.targetArch+
" · "+(release.size/(1024**2)).toFixed(1)+" MiB":"Derzeit kein geprüftes Release veröffentlicht.";
$("release-notes").textContent=release?.notes||"";
$("update-stage").hidden=!Boolean(latestReleaseId);
}catch(error){
latestReleaseId=null;
$("update-connection").textContent="Nicht erreichbar";
$("update-availability").textContent="Prüfung fehlgeschlagen";
$("version-note").textContent=error.message;
$("update-stage").hidden=true;
}
}
async function loadNetworkStatus(){
const status=$("network-test-status"),when=$("network-test-time");
const rows=overview?.endpoints||[];
if(!rows.length){status.textContent="Noch keine aktiven Regionen gemeldet.";return}
try{
const probe=await api("/api/network/external");
const checks=Array.isArray(probe.checks)?probe.checks:[];
const measured=probe.reachable&&probe.fresh;
status.textContent=measured?"Externe TCP-Prüfung aktiv":
probe.connected?"Prüfung veraltet":"Externer Prüfstandort nicht verfügbar";
if(!measured)status.textContent=probe.message||"Externe Messung momentan nicht verfügbar";
when.textContent=probe.checkedAtUtc?
"Letzte externe Messung: "+new Date(probe.checkedAtUtc).toLocaleString("de-DE",{
timeZone:"Europe/Berlin"})+(probe.fresh?" · Aktuell":" · Veraltet"):
"Noch kein gültiger externer Prüfbericht vorhanden.";
table("ports-table",["Region","Protokoll","Port","Lokaler Listener","Externe Messung"],
rows.map(p=>{
const checked=checks.find(c=>c.port===p.port&&c.protocol===p.protocol);
let publicState;
if(p.protocol==="UDP")
publicState="UDP: Protokoll-Handshake nicht verfügbar";
else if(!measured)
publicState="Externe Messung ausstehend";
else if(!checked)
publicState="TCP: keine externe Messung zu diesem Port";
else publicState=checked.reachable?
"Extern erreichbar ("+checked.latencyMs+" ms)":"Extern nicht erreichbar";
return row(p.name,p.protocol,p.port,p.local?"Aktiv":"Nicht aktiv",publicState);
}));
}catch(e){
status.textContent="Externer Prüfstandort nicht erreichbar";
when.textContent=e.message;
table("ports-table",["Region","Protokoll","Port","Lokaler Listener","Externe Messung"],
rows.map(p=>row(p.name,p.protocol,p.port,p.local?"Aktiv":"Nicht aktiv",
p.protocol==="UDP"?"UDP: Handshake nicht geprüft":"Externe Messung ausstehend")));
}
}
async function loadTranslatorStatus(){
const state=$("translator-health"),message=$("translator-message");
try{
const d=await api("/api/translator/status");
const enabled=Boolean(d.configured),ready=Boolean(d.connected&&d.available);
state.textContent=!enabled?"Nicht aktiviert":ready?"OGL Translater: einsatzbereit":
d.connected?"Verbunden – Dienst nicht bereit":"Verbindung nicht bereit";
state.dataset.ready=ready?"true":"false";
message.textContent=d.message||"Keine Statusmeldung.";
$("translator-node").textContent=d.nodeId||"–";
$("translator-chat").textContent=d.chat?"Bereit":"Nicht verfügbar";
$("translator-im").textContent=d.directIm?"Bereit":"Nicht verfügbar";
$("translator-groups").textContent=d.groupIm?"Bereit":"Noch nicht integriert";
$("translator-endpoint").textContent=d.endpoint||"Keine zentrale Verbindung konfiguriert";
$("translator-checked").textContent=new Date(d.checkedAtUtc||Date.now())
.toLocaleString("de-DE",{timeZone:"Europe/Berlin"});
$("translator-dot").style.opacity=ready?"1":".35";
}catch(e){
state.textContent="Statusabfrage fehlgeschlagen";
message.textContent=e.message;
state.dataset.ready="false";
}
}
async function loadIntegrity(){
const state=$("integrity-status"),note=$("integrity-note");
try{
const result=await api("/api/system/compatibility");
const reports=Array.isArray(result.reports)?result.reports:[];
state.textContent=reports.length&&reports.every(x=>x.status==="ok")?
"DLL-Kompatibilität: geprüft":reports.some(x=>x.status==="blocked")?
"Kritischer DLL-Fehler erkannt":"Noch keine gültige Startprüfung";
note.textContent=result.note||"Dateiprüfung der lokalen OGL-Module.";
table("integrity-table",["Instanz","Ergebnis","Framework","Geprüfte Module/Schnittstellen","Zeitpunkt"],
reports.map(x=>row(x.instance==="robust"?"ROBUST":"Simulator",
x.status==="ok"?"Kompatibel":x.status==="blocked"?"Start blockiert":"Nicht geprüft",
x.frameworkVersion||"–",x.checkCount||0,
x.checkedAtUtc?new Date(x.checkedAtUtc).toLocaleString("de-DE",
{timeZone:"Europe/Berlin"}):"–")));
const messages=$("integrity-errors");messages.replaceChildren();
for(const r of reports){
for(const entry of [...(r.errors||[]),...(r.warnings||[])]){
const p=document.createElement("p");p.className="muted";
p.textContent=(r.instance==="robust"?"ROBUST: ":"Simulator: ")+entry;
messages.append(p);
}
}
}catch(error){
state.textContent="Prüfbericht nicht verfügbar";
note.textContent=error.message;
$("integrity-table").replaceChildren();
}
}
const oglHealthLabels={
ok:"Betriebsbereit",warning:"Aufmerksamkeit erforderlich",
critical:"Kritischer Fehler",unknown:"Nicht geprüft"
};
function healthStatus(code){return oglHealthLabels[code]||"Unbekannter Zustand"}
function fmtHealthDate(value){
if(!value)return "–";
const d=new Date(value);
return Number.isNaN(d.getTime())?"–":
d.toLocaleString("de-DE",{timeZone:"Europe/Berlin"});
}
async function loadHealthCenter(){
const state=$("health-overall"),checked=$("health-checked"),
parent=$("health-components");
state.textContent="Systemdiagnose läuft …";
try{
const data=await api("/api/health-center/summary");
const items=Array.isArray(data.components)?data.components:[];
state.textContent="Gesamtzustand: "+healthStatus(data.status);
checked.textContent="Letzte Prüfung: "+fmtHealthDate(data.checkedAtUtc)+
" · "+(data.note||"");
$("health-count").textContent=String(data.evaluated??0);
$("health-attention").textContent=String(data.attention??0);
$("health-unknown").textContent=String(items.filter(x=>x.status==="unknown").length);
parent.replaceChildren();
if(!items.length){
const p=document.createElement("p");p.className="muted";
p.textContent="Noch keine Diagnosekomponenten verfügbar.";parent.append(p);
}
for(const item of items){
const card=document.createElement("article");card.className="ogl-health-item";
const header=document.createElement("div");header.className="ogl-health-head";
const name=document.createElement("strong");name.textContent=item.title||"OGL-Modul";
const status=document.createElement("span");status.className="status";
status.textContent=healthStatus(item.status);
status.dataset.health=item.status||"unknown";
header.append(name,status);
const detail=document.createElement("p");detail.textContent=item.detail||"Keine Detailangabe.";
const advice=document.createElement("p");advice.className="muted";
advice.textContent="Maßnahme: "+(item.action||"Keine Maßnahme erforderlich.");
card.append(header,detail,advice);parent.append(card);
}
$("health-overview-state").textContent="OGL-Systemzustand: "+healthStatus(data.status);
$("health-overview-detail").textContent=(data.attention??0)+
" Komponenten benötigen Aufmerksamkeit · "+fmtHealthDate(data.checkedAtUtc);
}catch(error){
state.textContent="Systemdiagnose derzeit nicht verfügbar";
checked.textContent=error.message;
$("health-overview-state").textContent="Health Center nicht erreichbar";
$("health-overview-detail").textContent="Status kann aktuell nicht bestätigt werden.";
}
}
async function loadLoginDiagnostics(){
const state=$("login-diagnostics-state"),summary=$("login-diagnostics-summary");
state.textContent="Login-Ereignisse werden ausgewertet …";
try{
const data=await api("/api/health-center/login-diagnostics");
state.textContent=data.available?
"Login-Diagnose: "+healthStatus(data.status):
"ROBUST-Protokoll nicht verfügbar";
summary.textContent=data.message||"Keine Diagnoseantwort.";
$("login-successes").textContent=data.available?String(data.successes||0):"–";
$("login-failures").textContent=data.available?String(data.failures||0):"–";
$("login-critical").textContent=data.available?String(data.critical||0):"–";
$("login-diagnostics-time").textContent="Zeitraum: letzte "+(data.lookbackMinutes||60)+
" Minuten (verfügbarer Logausschnitt) · geprüft "+fmtHealthDate(data.checkedAtUtc)+
(data.sampleLimited?" · Ausschnitt begrenzt":"")+
" · "+(data.note||"");
const causes=Array.isArray(data.causes)?data.causes:[];
table("login-diagnostics-causes",
["Erkannte Ursache","Anzahl","Zuletzt","Erklärung","Empfohlene Maßnahme"],
causes.length?causes.map(c=>row(c.label,c.count,
fmtHealthDate(c.lastSeenUtc),c.explanation,c.action)):
[row("Keine Ereignisse im ausgewerteten Zeitraum","–","–",
"Kein sicherer Rückschluss auf jeden Login möglich.","Bei Problemen Viewer-Anmeldung testen.")]);
const recent=Array.isArray(data.recent)?data.recent:[];
table("login-diagnostics-recent",
["Zeitpunkt","Ereignis","Schweregrad","Empfehlung"],
recent.length?recent.map(x=>row(fmtHealthDate(x.timeUtc),
x.label,healthStatus(x.severity),x.action)):
[row("–","Keine erkannten Probleme","–","–")]);
}catch(error){
state.textContent="Login-Diagnose nicht verfügbar";
summary.textContent=error.message;
$("login-successes").textContent="–";
$("login-failures").textContent="–";
$("login-critical").textContent="–";
$("login-diagnostics-causes").replaceChildren();
$("login-diagnostics-recent").replaceChildren();
}
}
function showView(name){document.querySelectorAll(".view").forEach(v=>v.hidden=v.id!==name);document.querySelectorAll("nav a").forEach(v=>v.classList.toggle("active",v.dataset.view===name));const titles={overview:"Übersicht",regions:"Regionen & Aktionen",archives:"OAR-Archive",network:"Netzwerk & Ports",logs:"Simulator-Logs",updates:"OGL Server-Updates",translator:"Global Translater",integrity:"System & Integrität",health:"OGL Health Center","login-diagnostics":"Login-Diagnose"};$("page-title").textContent=titles[name]||"Übersicht";if(name==="logs")loadLogs();if(name==="archives")loadJobs();if(name==="updates")loadUpdates();if(name==="network")loadNetworkStatus();if(name==="integrity")loadIntegrity();if(name==="health")loadHealthCenter();if(name==="login-diagnostics")loadLoginDiagnostics();if(name==="translator")loadTranslatorStatus();}
document.querySelectorAll("nav a").forEach(a=>a.onclick=e=>{e.preventDefault();showView(a.dataset.view)});
$("login-form").onsubmit=async e=>{e.preventDefault();try{const d=await api("/api/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:$("username").value,password:$("password").value})});csrf=d.csrf;$("identity").textContent=d.name;$("login-view").hidden=true;$("dashboard").hidden=false;$("password").value="";await refresh();}catch(err){notice(err.message,err.message.includes("Access Denied")?"Access Denied":"Anmeldung fehlgeschlagen")}};
$("login-form").onsubmit=async e=>{e.preventDefault();try{const d=await api("/api/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:$("username").value,password:$("password").value})});csrf=d.csrf;$("identity").textContent=d.name;$("login-view").hidden=true;$("dashboard").hidden=false;$("password").value="";await refresh();void checkUpdateNotification();void loadHealthCenter();}catch(err){notice(err.message,err.message.includes("Access Denied")?"Access Denied":"Anmeldung fehlgeschlagen")}};
$("refresh").onclick=refresh;
$("logout").onclick=async()=>{try{await api("/api/logout",{method:"POST"})}finally{csrf="";$("dashboard").hidden=true;$("login-view").hidden=false}};
$("oar-file").onchange=()=>{$("selected-file").textContent=$("oar-file").files[0]?.name||""};
$("oar-export").onclick=async()=>{try{const d=await jsonPost("/api/oar/export",{regionId:$("archive-region").value});notice("OAR-Sicherung gestartet: "+d.id);await loadJobs()}catch(e){notice(e.message,"OAR Export")}};
$("oar-export").onclick=()=>window.startOarLiveExport();
$("oar-import").onclick=()=>{const f=$("oar-file").files[0];if(!f){notice("Bitte zuerst eine .oar-Datei auswählen.");return;}if(f.size>2*1024**3){notice("Die Datei überschreitet 2 GiB.");return;}notice("ACHTUNG: OAR-Import kann alle Objekte und Gelände der gewählten Region überschreiben. Jetzt „"+f.name+"“ importieren?","OAR-Import bestätigen",async()=>{try{const d=await new Promise((resolve,reject)=>{const xhr=new XMLHttpRequest();xhr.open("POST","/api/oar/import?region="+encodeURIComponent($("archive-region").value));xhr.withCredentials=true;xhr.setRequestHeader("Content-Type","application/octet-stream");xhr.setRequestHeader("X-OGL-CSRF",csrf);xhr.upload.onprogress=e=>{if(e.lengthComputable)$("selected-file").textContent="Upload: "+Math.round(e.loaded*100/e.total)+"% ("+f.name+")";};xhr.onerror=()=>reject(new Error("Netzwerkfehler beim OAR Upload"));xhr.onload=()=>{let v;try{v=JSON.parse(xhr.responseText||"{}")}catch{v={error:"Ungültige Serverantwort"}}xhr.status>=200&&xhr.status<300?resolve(v):reject(new Error(v.error||"Upload fehlgeschlagen"))};xhr.send(f)});notice("Import angenommen: "+d.id+". Status im Auftragsbereich sichtbar.");await loadJobs()}catch(e){notice(e.message,"OAR Import")}})};
$("update-live-start").onclick=()=>notice("ACHTUNG: Der unabhängige Updater sichert lokale Konfigurationen und führt anschließend git reset --hard origin/main sowie einen .NET-10-Build aus. Die laufenden Binaries können währenddessen verändert werden. Ein Wartungsfenster und ein manueller Simulator-Neustart sind erforderlich. Update jetzt wirklich starten?","Live-Update bestätigen",async()=>{try{const d=await api("/api/updates/live-start",{method:"POST"});notice(d.note||"Live-Update angefordert.","Auftrag angenommen");await loadUpdates()}catch(e){notice(e.message,"Live-Update fehlgeschlagen")}});
$("update-stage").onclick=()=>{if(!latestSha){notice("Bitte zuerst GitHub prüfen.");return}notice("Commit "+latestSha.slice(0,12)+" herunterladen und vertrauliche Konfiguration lokal sichern? Es werden keine laufenden Programmdateien verändert.","Update vorbereiten",async()=>{try{const d=await jsonPost("/api/updates/stage",{sha:latestSha});notice(d.note+" Sicherung: "+d.backup,"Download abgeschlossen")}catch(e){notice(e.message,"Update fehlgeschlagen")}})};
$("logs-refresh").onclick=loadLogs;$("updates-refresh").onclick=loadUpdates;$("jobs-refresh").onclick=loadJobs;
async function bootstrap(){try{const d=await api("/api/me");csrf=d.csrf;$("identity").textContent=d.name;$("dashboard").hidden=false;$("login-view").hidden=true;await refresh()}catch{}}bootstrap();
$("update-stage").onclick=()=>{
if(!latestReleaseId)return;
notice("Freigegebenes OGL-Binärpaket "+latestReleaseId+
" herunterladen, SHA-256 überprüfen und vertrauliche Konfiguration lokal sichern? "+
"Es werden keine Programmdateien verändert und kein Simulator neu gestartet.",
"OGL-Update vorbereiten",async()=>{
try{
const d=await jsonPost("/api/updates/stage",{sha:latestReleaseId});
notice(d.note||"OGL-Update geprüft vorbereitet.","Update vorbereitet");
await loadUpdates();
}catch(error){notice(error.message,"Update konnte nicht vorbereitet werden")}
});
};
$("ogl-update-notice-open").onclick=()=>showView("updates");
$("health-refresh").onclick=loadHealthCenter;
$("login-diagnostics-refresh").onclick=loadLoginDiagnostics;
$("health-overview-open").onclick=()=>showView("health");
$("integrity-refresh").onclick=loadIntegrity;$("network-refresh").onclick=loadNetworkStatus;$("translator-refresh").onclick=loadTranslatorStatus;$("logs-refresh").onclick=loadLogs;$("updates-refresh").onclick=loadUpdates;$("jobs-refresh").onclick=loadJobs;
async function bootstrap(){try{const d=await api("/api/me");csrf=d.csrf;$("identity").textContent=d.name;$("dashboard").hidden=false;$("login-view").hidden=true;await refresh();void checkUpdateNotification();void loadHealthCenter()}catch{}}bootstrap();
setInterval(()=>{if(!$("dashboard").hidden){refresh();if(!$("archives").hidden)loadJobs()}},30000);
setInterval(()=>{if(!$("dashboard").hidden&&!$("archives").hidden)loadJobs()},4000);
setInterval(()=>{if(!$("dashboard").hidden&&!$("updates").hidden)api("/api/updates/live-status").then(d=>{const s=d.update||{};$("update-live-status").textContent=d.enabled?(d.reachable?("Status: "+(s.state||"?")+" · Schritt "+(s.phase||0)+"/7 · "+(s.message||"")):d.message):"Nicht aktiviert";$("update-live-start").hidden=!(d.enabled&&d.reachable&&s.state!=="running"&&s.state!=="queued")}).catch(()=>{})},10000);
setInterval(()=>{if(!$("dashboard").hidden&&!$("network").hidden)
loadNetworkStatus()},20000);
setInterval(()=>{if(!$("dashboard").hidden&&!$("translator").hidden)
loadTranslatorStatus()},15000);
// Polling is per running admin session, not per region or per avatar.
setInterval(checkUpdateNotification,120000);
setInterval(()=>{
if($("dashboard").hidden)return;
if(!$("health").hidden)void loadHealthCenter();
else if(!$("login-diagnostics").hidden)void loadLoginDiagnostics();
},45000);
+219 -9
View File
@@ -3,50 +3,260 @@
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark">
<meta name="theme-color" content="#0b101b">
<link rel="icon" type="image/png" sizes="32x32" href="/ogl-simulator-favicon.png">
<link rel="apple-touch-icon" sizes="180x180" href="/ogl-simulator-apple-icon.png">
<title>OpenGenesisLINK | Simulator Control</title>
<link rel="stylesheet" href="/style.css">
<link rel="stylesheet" href="/oar-live.css">
<script src="/app.js" defer></script>
<script src="/oar-live.js" defer></script>
</head>
<body>
<div id="login-view" class="login-screen">
<div class="login-panel">
<div class="brand-mark">O<span>G</span>L</div>
<img src="/ogl-simulator-logo.webp" alt="OGL Simulator" class="brand-logo login-logo" width="112" height="112">
<p class="eyebrow">OPENGENESISLINK GENERATION 1</p>
<h1>Simulator Control</h1>
<p class="muted">Melde dich mit deinem Avatar-Konto an. Zugelassen sind Konten mit UserLevel größer als 0.</p>
<p class="muted">Melde dich mit deinem Avatar-Konto an. Zugelassen sind Administrator-Konten mit UserLevel 200 oder höher.</p>
<form id="login-form">
<label>Avatar-Name<input id="username" autocomplete="username" required placeholder="Vorname Nachname"></label>
<label>Passwort<input id="password" type="password" autocomplete="current-password" required></label>
<button type="submit" class="primary">Sicher anmelden</button>
</form>
<small class="muted">Zugang über den lokalen Simulator. Für externe Nutzung ist ein HTTPS-Reverse-Proxy erforderlich.</small>
<small class="muted">Verschlüsselte Anmeldung über HTTPS mit dem bestehenden OpenGenesisLINK-Avatar-Konto.</small>
</div>
</div>
<div id="dashboard" hidden>
<aside>
<div class="side-brand"><div class="brand-mark small">O<span>G</span>L</div><div><strong>OpenGenesisLINK</strong><small>SIMULATOR CONTROL</small></div></div>
<div class="side-brand"><img src="/ogl-simulator-logo.webp" alt="OGL Simulator" class="brand-logo small" width="50" height="50"><div><strong>OpenGenesisLINK</strong><small>SIMULATOR CONTROL</small></div></div>
<div class="side-label">INSTANZ</div>
<nav><a href="#overview" data-view="overview" class="active">Übersicht</a><a href="#regions" data-view="regions">Regionen &amp; Aktionen</a><a href="#archives" data-view="archives">OAR Sicherungen</a><a href="#network" data-view="network">Netzwerk &amp; Ports</a><a href="#logs" data-view="logs">Live-Protokoll</a><a href="#updates" data-view="updates">Updates &amp; GitHub</a></nav>
<div class="side-footer"><span class="live-dot"></span> Simulator-Verwaltung lokal <p>Verbindung zu einem laufenden Simulatorprozess</p></div>
<nav><a href="#overview" data-view="overview" class="active">Übersicht</a><a href="#regions" data-view="regions">Regionen &amp; Aktionen</a><a href="#archives" data-view="archives">OAR Sicherungen</a><a href="#translator" data-view="translator">Global Translater</a><a href="#health" data-view="health">OGL Health Center</a><a href="#login-diagnostics" data-view="login-diagnostics">Login-Diagnose</a><a href="#integrity" data-view="integrity">System &amp; Integrität</a><a href="#network" data-view="network">Netzwerk &amp; Ports</a><a href="#logs" data-view="logs">Live-Protokoll</a><a href="#updates" data-view="updates">OGL Server-Updates</a></nav>
<div class="side-footer"><span class="live-dot"></span> Simulator-Verwaltung <p>Verbindung zu einem laufenden Simulatorprozess</p></div>
</aside>
<main>
<header class="topbar"><div><span class="eyebrow">ADMINISTRATIONSZENTRALE</span><h2 id="page-title">Übersicht</h2></div><div class="top-right"><span id="identity" class="pill">Administrator</span><button id="refresh" class="ghost">Aktualisieren</button><button id="logout" class="ghost">Abmelden</button></div></header>
<div id="ogl-update-notice" class="ogl-update-notice" role="status" hidden>
<div><strong>Neue OGL-Serverversion verfügbar</strong>
<p id="ogl-update-notice-text">Ein geprüftes Update steht bereit.</p></div>
<button id="ogl-update-notice-open" type="button" class="ghost">Update ansehen</button>
</div>
<section id="overview" class="view">
<div class="hero"><div><span class="eyebrow">SYSTEM CONTROL</span><h2>Deine virtuelle Infrastruktur.<br><em>Alles im Blick.</em></h2><p>Status, Regionen, Speicher und Dienste deiner Simulatorinstanz – zentral verwaltet.</p></div><div class="hero-ring"><span>OGL</span><small>GEN 1</small></div></div>
<div class="hero"><div><span class="eyebrow">SYSTEM CONTROL</span><h2>Deine virtuelle Infrastruktur.<br><em>Alles im Blick.</em></h2><p>Status, Regionen, Speicher und Dienste deiner Simulatorinstanz – zentral verwaltet.</p></div><div class="hero-ring"><img src="/ogl-simulator-logo.webp" alt="OGL Simulator" class="hero-brand-logo" width="166" height="166"></div></div>
<div class="stats">
<article class="stat"><p>Geladene Regionen</p><strong id="num-regions">–</strong><small>in dieser Instanz</small></article>
<article class="stat"><p>Avatare online</p><strong id="num-avatars">–</strong><small>Root-Avatare</small></article>
<article class="stat"><p>Arbeitsspeicher</p><strong id="num-memory">–</strong><small>Simulator-Prozess</small></article>
<article class="stat"><p>Instanz-Uptime</p><strong id="num-uptime">–</strong><small>seit Webmodul-Start</small></article>
</div>
<div class="panel ogl-health-overview">
<div><strong id="health-overview-state">OGL-Systemdiagnose noch nicht durchgeführt.</strong>
<p id="health-overview-detail" class="muted">Regionszustand, kritische Module und Loginprotokoll im Blick.</p></div>
<button class="ghost" id="health-overview-open" type="button">Health Center öffnen</button>
</div>
<section class="panel"><div class="section-head"><div><h3>ROBUST &amp; Grid-Dienste</h3><p>TCP-Erreichbarkeit der konfigurierten Service-Endpunkte</p></div></div><div id="services-table" class="table-wrap"></div></section><section class="panel"><div class="section-head"><div><h3>Regionen im Überblick</h3><p>Bereitschaft, aktuelle Besucher und Portkonfiguration</p></div></div><div id="overview-regions" class="table-wrap"></div></section>
</section>
<section id="regions" class="view" hidden><div class="section-head"><div><h3>Regionen &amp; Aktionen</h3><p>Neustart ausschließlich für lokal geladene Regionen</p></div></div><div id="region-actions" class="cards"></div></section>
<section id="archives" class="view" hidden><div class="section-head"><div><h3>OAR-Archive</h3><p>Lokaler Export, Download und Import mit Statusverfolgung. Ein Import verändert Regionsinhalt.</p></div></div><div class="panel"><label>Region auswählen<select id="archive-region"></select></label><div class="button-row"><button id="oar-export" class="primary">OAR-Sicherung erstellen</button><label for="oar-file" class="filelabel">OAR-Datei auswählen<input type="file" id="oar-file" accept=".oar,application/octet-stream" hidden></label><button id="oar-import" class="danger">Ausgewählte OAR importieren</button></div><div class="muted" id="selected-file"></div></div><section class="panel"><div class="section-head"><h3>Archivaufträge</h3><button class="ghost" id="jobs-refresh">Status abfragen</button></div><div id="job-table" class="table-wrap"></div></section></section>
<section id="network" class="view" hidden><div class="section-head"><div><h3>Netzwerkdiagnose</h3><p>TCP-/UDP-Listener auf dem Simulatorhost und die konfigurierte Region-Ports</p></div></div><div class="panel notice">Lokale Listener sind keine Bestätigung der externen Erreichbarkeit: Fritz!Box-Portfreigaben, CGNAT und Firewall-Regeln müssen zusätzlich von außerhalb getestet werden.</div><div id="ports-table" class="table-wrap panel"></div></section>
<section id="translator" class="view" hidden>
<div class="section-head">
<div><span class="eyebrow">STADT-NEXVERSE</span>
<h3>Global Translater</h3>
<p>Standortübergreifende Chatübersetzung über den zentralen OGL-Dienst.</p>
</div>
<button type="button" id="translator-refresh" class="ghost">Status aktualisieren</button>
</div>
<div class="panel">
<div class="translator-connection">
<span class="live-dot" id="translator-dot" aria-hidden="true"></span>
<div><strong id="translator-health">Status wird ermittelt …</strong>
<p id="translator-message" class="muted">Verbindung zum zentralen Dienst wird geprüft.</p></div>
</div>
<div class="translator-cards">
<article class="stat"><p>NodeID</p><strong id="translator-node">–</strong><small>Simulatoridentität</small></article>
<article class="stat"><p>Chat</p><strong id="translator-chat">–</strong><small>Lokaler Avatar-Chat</small></article>
<article class="stat"><p>Private IM</p><strong id="translator-im">–</strong><small>Beidseitige Einwilligung</small></article>
<article class="stat"><p>Gruppenchat</p><strong id="translator-groups">–</strong><small>Getrennte Integration</small></article>
</div>
<p class="muted">Zentraler Dienst: <span id="translator-endpoint" class="mono">–</span></p>
<p class="muted">Letzte Prüfung: <span id="translator-checked">–</span></p>
</div>
<div class="panel notice">
<strong>Einfach miteinander sprechen – weltweit</strong>
<p>Der Stadt-NexVerse Global Translater verbindet Bewohner unterschiedlicher Sprachen.
Chatnachrichten und private Mitteilungen können automatisch in der bevorzugten Sprache
des Empfängers angezeigt werden.</p>
<p>Die Übersetzung ist freiwillig und setzt die Zustimmung beider Gesprächspartner voraus.
Dafür werden die betreffenden Nachrichten von einem externen Übersetzungsdienst verarbeitet.
Ist der Dienst nicht erreichbar, werden die Nachrichten im Original angezeigt.</p>
<p>Inworld-Befehle: <code>!translate de</code>, <code>!translate en</code>,
<code>!translate im on</code>, <code>!translate off</code>,
<code>!translate status</code>.</p>
</div>
</section>
<section id="health" class="view" hidden>
<div class="section-head">
<div><span class="eyebrow">OPEN GENESIS LINK</span>
<h3>OGL Health Center</h3>
<p>Betriebszustand, Warnungen und konkrete Handlungsempfehlungen für diesen Simulator.</p>
</div><button type="button" class="ghost" id="health-refresh">Jetzt prüfen</button>
</div>
<div class="panel">
<strong id="health-overall" aria-live="polite">Gesamtzustand wird ermittelt …</strong>
<p class="muted" id="health-checked">Noch keine Prüfung abgeschlossen.</p>
<div class="translator-cards">
<article class="stat"><p>Geprüfte Komponenten</p><strong id="health-count">–</strong></article>
<article class="stat"><p>Benötigen Aufmerksamkeit</p><strong id="health-attention">–</strong></article>
<article class="stat"><p>Unbekannte Zustände</p><strong id="health-unknown">–</strong></article>
</div>
</div>
<section class="panel">
<div class="section-head"><div><h3>Systemdiagnose</h3>
<p>Aktuell geprüfte Module und die jeweils empfohlenen Maßnahmen.</p></div></div>
<div id="health-components" class="ogl-health-components" aria-live="polite"></div>
</section>
<section class="panel notice">
<strong>Was die Prüfung aussagt</strong>
<p>Die Prüfung berücksichtigt Regionsbereitschaft, Grid-Service-Ports, DLL-Startschutz,
anonymisierte Loginereignisse sowie konfigurierte zentrale OGL-Dienste.</p>
<p>Ein erreichbarer TCP-Port beweist nicht, dass eine Avatar-Anmeldung vollständig funktioniert.
Unbekannte oder nicht konfigurierte Prüfwerte werden ausdrücklich gekennzeichnet.</p>
</section>
</section>
<section id="login-diagnostics" class="view" hidden>
<div class="section-head"><div>
<span class="eyebrow">OPEN GENESIS LINK</span>
<h3>Login-Diagnosecenter</h3>
<p>Automatische Auswertung des ROBUST-Loginprotokolls ohne personenbezogene Details.</p>
</div><button type="button" class="ghost" id="login-diagnostics-refresh">Neu analysieren</button></div>
<div class="panel">
<strong id="login-diagnostics-state" aria-live="polite">Loginprotokoll wird untersucht …</strong>
<p class="muted" id="login-diagnostics-summary">Bitte Protokollanalyse abwarten.</p>
<div class="translator-cards">
<article class="stat"><p>Erkannte erfolgreiche Loginantworten</p><strong id="login-successes">–</strong></article>
<article class="stat"><p>Abgewiesene Anmeldungen / Fehler</p><strong id="login-failures">–</strong></article>
<article class="stat"><p>Kritische Serverausnahmen</p><strong id="login-critical">–</strong></article>
</div>
<p class="muted" id="login-diagnostics-time"></p>
</div>
<section class="panel">
<h3>Ursachen und Lösungsvorschläge</h3>
<div id="login-diagnostics-causes" class="table-wrap"></div>
</section>
<section class="panel">
<h3>Letzte erkannte Loginprobleme</h3>
<div id="login-diagnostics-recent" class="table-wrap"></div>
</section>
<section class="panel notice">
<strong>Datenschutz und Aussagekraft</strong>
<p>Die Auswertung zeigt nur Fehlerklassen, Zeitpunkte, Häufigkeiten und Empfehlungen.
Avatarnamen, IP-Adressen, UUIDs, Passwörter und Originalprotokolle werden hier nicht angezeigt.</p>
<p>Die Zählung bezieht sich auf den verfügbaren Ausschnitt des ROBUST-Protokolls.
Ein fehlender Fehler ist kein Beweis, dass sich jeder Avatar erfolgreich anmelden kann.
Für einen vollständigen Funktionstest ist weiterhin eine echte Anmeldung im Viewer erforderlich.</p>
</section>
</section>
<section id="integrity" class="view" hidden>
<div class="section-head"><div>
<span class="eyebrow">OPEN GENESIS LINK</span>
<h3>System &amp; Integrität</h3>
<p>Automatische DLL-Kompatibilitätsprüfung für sichere Simulator- und Grid-Starts.</p>
</div><button type="button" class="ghost" id="integrity-refresh">Prüfbericht laden</button></div>
<div class="panel">
<strong id="integrity-status">Prüfstatus wird geladen …</strong>
<p class="muted" id="integrity-note">Die Prüfung erfolgt vor dem Start der Serverinstanz.</p>
<div class="table-wrap" id="integrity-table"></div>
<div id="integrity-errors"></div>
</div>
<section class="panel notice">
<strong>Automatischer Startschutz</strong>
<p>Vor jedem kontrollierten Start prüft OpenGenesisLINK seine Kernmodule auf
fehlende Dateien, widersprüchliche Assemblies und kritische Schnittstellen.
Bei einem bestätigten DLL-Kompatibilitätsfehler wird der Start blockiert,
damit keine fehlerhafte Serverversion aktiv wird.</p>
<p>Diese Anzeige zeigt den letzten Prüfbericht der lokalen Programmdateien.
Bereits laufende Prozesse werden durch die Prüfung nicht unterbrochen.</p>
</section>
</section>
<section id="network" class="view" hidden>
<div class="section-head"><div><h3>Netzwerk &amp; Ports – Live-Prüfung</h3>
<p>Lokale Listener und externe TCP-Messungen werden getrennt geprüft.</p></div>
<button type="button" class="ghost" id="network-refresh">Jetzt prüfen</button>
</div>
<div class="panel"><strong id="network-test-status">Externe Messung wird angefordert …</strong>
<p id="network-test-time" class="muted">Noch kein externer Prüfbericht vorhanden.</p>
</div>
<div id="ports-table" class="table-wrap panel"></div>
<div class="panel notice">
<strong>Hinweis zur Erreichbarkeit</strong>
<p>TCP-Ports werden regelmäßig von einem unabhängigen, externen Standort geprüft.
Ein erfolgreich aufgebauter TCP-Kontakt bestätigt nur diesen Port und dieses Protokoll.</p>
<p>UDP-Ports benötigen eine gültige Antwort des jeweiligen Viewer-/Simulatorprotokolls.
Ohne einen solchen Handshake wird die externe UDP-Erreichbarkeit bewusst nicht behauptet.
Ist der externe Prüfstandort offline, wird der Messwert als veraltet angezeigt.</p>
</div>
</section>
<section id="logs" class="view" hidden><div class="section-head"><div><h3>Simulator-Protokoll</h3><p>Letzte 90.000 Zeichen der aktiven Logdatei</p></div><button id="logs-refresh" class="ghost">Log aktualisieren</button></div><pre id="log-text" class="terminal">Lade Protokoll …</pre></section>
<section id="updates" class="view" hidden><div class="section-head"><div><h3>GitHub &amp; Versionskontrolle</h3><p>Commit-Stand des offiziellen OpenGenesisLINK-Repositorys</p></div><button id="updates-refresh" class="ghost">GitHub prüfen</button></div><div class="panel"><p>Installierter Commit</p><strong id="local-sha" class="mono">–</strong><p>Aktueller Main-Commit</p><strong id="remote-sha" class="mono">–</strong><div id="version-note" class="muted"></div><div class="button-row"><button class="primary" id="update-stage">Quellcode herunterladen &amp; Konfiguration sichern</button></div></div><section class="panel"><h3>Unabhängiger Live-Updater</h3><p id="update-live-status" class="muted">Status wird geprüft ...</p><div class="button-row"><button class="danger" id="update-live-start" hidden>Update installieren (manueller Neustart danach)</button></div></section><section class="panel"><h3>Letzte Änderungen</h3><div id="commits"></div></section><div class="panel notice">Die Download-Schaltfläche bereitet ein Update nur vor: GitHub-Quellcode herunterladen, lokale Konfiguration sicher sichern und alte Backups nach Retentionsregel entfernen. Ein produktives In-place-Update kann optional an den vorhandenen, unabhängig installierten und authentifizierten OGL-Node-Updater delegiert werden. Das erfordert zwei explizite Freigaben und wird vor Start bestätigt. Danach ist ein manueller Neustart erforderlich.</div></section>
<section id="updates" class="view" hidden>
<div class="section-head">
<div><span class="eyebrow">OPEN GENESIS LINK</span><h3>OGL Server-Updatecenter</h3>
<p>Geprüfte Server-Updates werden ausschließlich über den zentralen OGL-Dienst bereitgestellt.</p></div>
<button type="button" id="updates-refresh" class="ghost">Verfügbarkeit prüfen</button>
</div>
<div class="panel">
<div class="translator-cards">
<article class="stat"><p>Installierte OGL-Version</p><strong id="local-version">–</strong></article>
<article class="stat"><p>Freigegebene Version</p><strong id="remote-version">–</strong></article>
<article class="stat"><p>Updatecenter-Verbindung</p><strong id="update-connection">Wird geprüft</strong></article>
<article class="stat"><p>Update-Status</p><strong id="update-availability">Wird geprüft</strong></article>
</div>
<p class="muted" id="version-note">Die nächste Updateprüfung startet automatisch.</p>
<div class="button-row">
<button type="button" class="primary" id="update-stage" hidden>OGL-Update sicher herunterladen</button>
</div>
</div>
<section class="panel"><h3>Freigabeinformationen</h3>
<p id="release-details" class="muted">Noch kein geprüftes Release ausgewählt.</p>
<p id="release-notes" class="muted"></p></section>
<section class="panel notice"><strong>Zentrale Updateversorgung</strong>
<p>Nur offiziell freigegebene Binärpakete werden angeboten. Der Simulator benötigt dafür
weder Zugang zum Entwicklungsrepository noch den Quellcode. Jedes Paket wird vor dem
lokalen Vorbereiten anhand seiner SHA-256-Prüfsumme verifiziert.</p>
<p>Ein Download erstellt zusätzlich eine lokale Konfigurationssicherung und führt keine
Installation und keinen Neustart aus. Die Aktivierung erfolgt erst nach einem
gesondert geprüften Updateverfahren mit geplantem Wartungsfenster.</p></section>
</section>
</main>
</div>
<div id="oar-live-modal" class="oar-live-modal" hidden>
<div class="oar-live-dialog" role="dialog" aria-modal="true" aria-labelledby="oar-live-title"
aria-describedby="oar-live-hint" tabindex="-1">
<div class="oar-live-top">
<div><span class="eyebrow">OPENGENESISLINK / ARCHIVIERUNG</span>
<h2 id="oar-live-title">OAR-Backup – Live-Status</h2></div>
<button type="button" class="ghost" id="oar-live-close" aria-label="Statusfenster schließen">✕ Schließen</button>
</div>
<div class="oar-live-body">
<div class="oar-live-regionline"><span class="oar-live-region" id="oar-live-region">—</span>
<span class="oar-live-badge" id="oar-live-state" data-state="queued" role="status" aria-live="polite">Wird vorbereitet</span></div>
<p class="oar-live-stage" id="oar-live-stage" aria-live="polite">Archivierung wird vorbereitet …</p>
<div class="oar-live-progress" id="oar-live-progress" role="progressbar"
aria-label="Archivierung läuft, Gesamtfortschritt nicht verfügbar"></div>
<p class="oar-live-hint" id="oar-live-hint">Es werden tatsächliche Statusdaten angezeigt, keine geschätzten Prozentwerte.</p>
<div class="oar-live-metrics">
<div class="oar-live-metric"><small>OAR-Größe (bisher)</small><strong id="oar-live-bytes">—</strong></div>
<div class="oar-live-metric"><small>Verstrichene Zeit</small><strong id="oar-live-elapsed">0 Sek.</strong></div>
</div>
<div class="oar-live-eventsbox"><h3>Live-Ereignisse</h3>
<ol class="oar-live-events" id="oar-live-events" aria-live="polite"></ol>
</div>
<p class="oar-live-jobid">Auftragskennung: <span id="oar-live-job">—</span></p>
<div class="oar-live-actions">
<a class="oar-live-download" id="oar-live-download" hidden>OAR-Datei herunterladen</a>
<span class="muted">Schließen unterbricht das Backup nicht.</span>
</div>
</div>
</div>
</div>
<div id="modal" class="modal" hidden><div class="dialog" role="alertdialog" aria-modal="true" aria-labelledby="modal-title"><div class="modal-icon">!</div><h3 id="modal-title">Hinweis</h3><p id="modal-message"></p><div class="button-row"><button class="primary" id="modal-ok">Verstanden</button><button class="ghost" id="modal-cancel" hidden>Abbrechen</button></div></div></div>
</body></html>
+70
View File
@@ -0,0 +1,70 @@
/* OpenGenesisLINK OAR live job dialog — real server telemetry only. */
.oar-live-modal{position:fixed;inset:0;z-index:32;background:#030916db;
display:grid;place-items:center;padding:16px}
.oar-live-modal[hidden]{display:none!important}
.oar-live-dialog{width:min(680px,100%);max-height:calc(100dvh - 32px);
display:flex;flex-direction:column;min-width:0;overflow:hidden;
background:linear-gradient(155deg,#182f4c,#111b2e 60%,#0a1223);
border:1px solid #3987bd;border-radius:22px;
box-shadow:0 28px 100px #01050bdc;color:#edf8ff}
.oar-live-top{display:flex;justify-content:space-between;align-items:start;gap:15px;
padding:22px 24px 17px;border-bottom:1px solid #32557377;flex:0 0 auto}
.oar-live-top h2{font-size:clamp(21px,4vw,27px);margin:5px 0 0}
.oar-live-top button{min-width:44px;min-height:44px;flex-shrink:0}
.oar-live-body{padding:21px 24px 24px;overflow-y:auto;min-height:0;overscroll-behavior:contain}
.oar-live-regionline{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.oar-live-badge{border:1px solid #496983;background:#1a2a40;
padding:7px 12px;border-radius:30px;font-size:12px;font-weight:700}
.oar-live-badge[data-state=completed]{color:#8cf4bf;border-color:#397c5c;background:#143c31}
.oar-live-badge[data-state=failed]{color:#ffc5c7;border-color:#a56064;background:#48252c}
.oar-live-badge[data-state=saving]{color:#8fddff;border-color:#3b82b8}
.oar-live-region{font-size:16px;font-weight:750;overflow-wrap:anywhere}
.oar-live-stage{font-size:18px;font-weight:750;margin:18px 0 10px;color:#d2efff;overflow-wrap:anywhere}
.oar-live-progress{height:9px;position:relative;overflow:hidden;border-radius:99px;
background:#193553;border:1px solid #3b6683}
.oar-live-progress::before{content:"";position:absolute;inset:0 auto 0 -45%;
width:38%;border-radius:99px;background:linear-gradient(90deg,transparent,#63d4ff,#2494df,transparent);
animation:oar-live-sweep 1.65s ease-in-out infinite}
@keyframes oar-live-sweep{to{left:115%}}
.oar-live-progress[hidden]{display:none!important}
.oar-live-hint{color:#9bb6cd;font-size:12px;line-height:1.65;margin:12px 0}
.oar-live-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
gap:12px;margin:17px 0}
.oar-live-metric{background:#0c1e33;border:1px solid #335676;
padding:14px 16px;border-radius:13px;min-width:0}
.oar-live-metric small{display:block;color:#9bb7cf;font-size:11px;margin-bottom:8px}
.oar-live-metric strong{display:block;font-size:18px;color:#d5f3ff;overflow-wrap:anywhere}
.oar-live-jobid{font-family:ui-monospace,Consolas,monospace;font-size:10px;
color:#8ca5c0;overflow-wrap:anywhere;margin:12px 0}
.oar-live-eventsbox{background:#081626;border:1px solid #294767;
border-radius:13px;padding:14px 15px;margin:14px 0}
.oar-live-eventsbox h3{margin:0 0 12px;font-size:14px;color:#a4def8}
.oar-live-events{list-style:none;margin:0;padding:0;display:grid;gap:11px;
max-height:175px;overflow-y:auto}
.oar-live-events li{display:grid;grid-template-columns:80px minmax(0,1fr);
gap:8px;align-items:start;border-bottom:1px solid #24384f70;padding-bottom:9px;
color:#daeafa;font-size:12px;line-height:1.5;overflow-wrap:anywhere}
.oar-live-events li:last-child{border:0;padding-bottom:0}
.oar-live-events time{font-family:ui-monospace,Consolas,monospace;color:#6dc5f5;font-size:11px}
.oar-live-actions{display:flex;justify-content:space-between;align-items:center;
flex-wrap:wrap;gap:12px;margin-top:16px}
.oar-live-download{display:inline-flex;align-items:center;justify-content:center;
color:white;text-decoration:none;padding:12px 19px;min-height:48px;
background:linear-gradient(120deg,#168bc2,#0c69c5);border:1px solid #64cbff;
border-radius:12px;font-weight:750}
.oar-live-download[hidden]{display:none!important}
.oar-live-modal :focus-visible{outline:2px solid #a8eaff;outline-offset:3px}
@media(max-width:650px){
.oar-live-modal{padding:0}
.oar-live-dialog{width:100%;max-height:100dvh;height:100dvh;border-radius:0;
border-left:0;border-right:0}
.oar-live-top{padding:calc(17px + env(safe-area-inset-top,0px)) 16px 15px}
.oar-live-body{padding:17px 15px calc(23px + env(safe-area-inset-bottom,0px))}
.oar-live-metrics{gap:9px}
.oar-live-metric{padding:12px}
.oar-live-metric strong{font-size:16px}
.oar-live-actions>a,.oar-live-actions>button{flex:1;text-align:center}
}
@media(prefers-reduced-motion:reduce){
.oar-live-progress::before{animation:none;left:0;width:100%;opacity:.45}
}
+207
View File
@@ -0,0 +1,207 @@
"use strict";
/* OGL.WebInterface OAR live monitor.
* Only real server-reported events and on-disk file bytes are displayed.
* OAR export continues inside the simulator after this modal is closed. */
(() => {
const byId = id => document.getElementById(id);
const dialog = byId("oar-live-modal");
if (!dialog) return;
const closeButton = byId("oar-live-close");
const statusLabel = byId("oar-live-state");
const stage = byId("oar-live-stage");
const events = byId("oar-live-events");
const bytes = byId("oar-live-bytes");
const elapsed = byId("oar-live-elapsed");
const region = byId("oar-live-region");
const jobLabel = byId("oar-live-job");
const download = byId("oar-live-download");
const progress = byId("oar-live-progress");
const hint = byId("oar-live-hint");
const startButton = byId("oar-export");
let selected = null, currentJob = null, timer = null, generation = 0;
let failedPolls = 0, focusReturn = null, activeExport = null;
const validJob = id => /^[a-f0-9]{32}$/i.test(id);
const clock = new Intl.DateTimeFormat("de-DE", {
hour:"2-digit",minute:"2-digit",second:"2-digit",timeZone:"Europe/Berlin"
});
const humanBytes = size => {
if (!Number.isFinite(size) || size <= 0) return "Noch keine Dateigröße gemeldet";
const unit = ["B","KiB","MiB","GiB","TiB"];
let n=size,k=0;
while(n>=1024&&k<unit.length-1){n/=1024;k++}
return n.toLocaleString("de-DE",{maximumFractionDigits: k ? 1 : 0})+" "+unit[k];
};
const duration = total => {
let seconds = Math.max(0,Math.floor(total || 0));
const h=Math.floor(seconds/3600), m=Math.floor(seconds%3600/60), s=seconds%60;
return h ? h+" Std. "+m+" Min. "+s+" Sek." : m ? m+" Min. "+s+" Sek." : s+" Sek.";
};
const eventLine = entry => {
const li=document.createElement("li");
const time=document.createElement("time");
const parsed=Date.parse(entry.timeUtc||"");
time.textContent=Number.isFinite(parsed)?clock.format(new Date(parsed)):"—";
const description=document.createElement("span");
description.textContent=entry.message||"Auftrag aktiv";
li.append(time,description);
return li;
};
function show() {
focusReturn=document.activeElement;
dialog.hidden=false;
closeButton.focus();
}
function stopPolling() {
generation++;
clearTimeout(timer);
timer=null;
}
function hide() {
stopPolling();
dialog.hidden=true;
// A running export is still tracked by activeExport. Allow the start
// button to reopen its monitor instead of leaving it disabled forever.
if(activeExport)startButton.disabled=false;
if(focusReturn?.isConnected)focusReturn.focus();
}
closeButton.addEventListener("click",hide);
dialog.addEventListener("click",e=>{if(e.target===dialog)hide()});
document.addEventListener("keydown",e=>{
if(dialog.hidden)return;
if(e.key==="Escape"){e.preventDefault();hide();return}
if(e.key==="Tab") {
const controls=[...dialog.querySelectorAll("button:not([hidden]),a[href]:not([hidden])")]
.filter(node=>node.getClientRects().length);
if(!controls.length)return;
if(e.shiftKey&&document.activeElement===controls[0]){
e.preventDefault();controls.at(-1).focus();
}else if(!e.shiftKey&&document.activeElement===controls.at(-1)){
e.preventDefault();controls[0].focus();
}
}
});
function pending(name) {
currentJob=null;
region.textContent=name||"—";
jobLabel.textContent="Wird angelegt";
statusLabel.textContent="Wird vorbereitet";
statusLabel.dataset.state="queued";
stage.textContent="Verbindung zum Simulator wird hergestellt …";
bytes.textContent="—";
elapsed.textContent="0 Sek.";
progress.hidden=false;
download.hidden=true;download.removeAttribute("href");
hint.textContent="Der Simulator ermittelt keine Gesamtprozentzahl. Angezeigt werden nur echte Statusmeldungen und die geschriebene Dateigröße.";
events.replaceChildren();
}
function render(status) {
currentJob=status;
const state=status.state||"queued";
const terminal=state==="completed"||state==="failed";
region.textContent=status.region||region.textContent;
jobLabel.textContent=status.id||"—";
stage.textContent=status.stage||"Archivauftrag wird verarbeitet";
statusLabel.textContent=({queued:"Wartet",saving:"Backup läuft",
completed:"Backup erfolgreich",failed:"Backup fehlgeschlagen"})[state]||state;
statusLabel.dataset.state=state;
bytes.textContent=humanBytes(status.bytesWritten ?? status.bytes);
elapsed.textContent=duration(status.elapsedSeconds);
events.replaceChildren(...(status.events||[]).map(eventLine));
if(status.message) {
const li=document.createElement("li");
const label=document.createElement("span");
label.textContent=status.message;
li.append(label);events.append(li);
}
progress.hidden=terminal;
hint.textContent=state==="completed" ?
"Die OAR-Datei ist fertig und kann heruntergeladen werden." :
state==="failed" ?
"Der Simulator hat den Auftrag als fehlgeschlagen gemeldet. Ein Download ist nicht verfügbar." :
"Der Fortschritt wird anhand der tatsächlichen OAR-Datei und des Simulatorstatus ermittelt. Ein Prozentwert ist für diesen Export nicht verfügbar.";
if(state==="completed"&&status.download&&validJob(status.id)) {
download.href="/api/oar/download?id="+encodeURIComponent(status.id);
download.hidden=false;
}else{download.hidden=true;download.removeAttribute("href")}
if(terminal){
if(activeExport===status.id)activeExport=null;
startButton.disabled=false;
if(typeof loadJobs==="function")loadJobs().catch(()=>{});
}
}
async function poll(id, epoch) {
if(epoch!==generation||dialog.hidden)return;
try {
const response=await api("/api/oar/status?id="+encodeURIComponent(id));
if(epoch!==generation||dialog.hidden)return;
failedPolls=0;
render(response);
if(response.state==="completed"||response.state==="failed")return;
}catch(error){
if(epoch!==generation||dialog.hidden)return;
failedPolls++;
stage.textContent="Statusverbindung unterbrochen";
hint.textContent="Der Backup-Auftrag kann weiterlaufen. Statusabfrage wird wiederholt: "+error.message;
if(failedPolls>=5)statusLabel.textContent="Verbindung prüfen";
}
timer=setTimeout(()=>poll(id,epoch),Math.min(5000,failedPolls?1500*failedPolls:1250));
}
async function openExisting(id) {
if(!validJob(id))return;
stopPolling();
pending("Archivauftrag");
show();
jobLabel.textContent=id;
selected=id;
failedPolls=0;
const epoch=generation;
await poll(id,epoch);
}
async function startExport() {
if(activeExport) {
await openExisting(activeExport);
return;
}
const regionId=byId("archive-region").value;
if(!regionId)return notice("Bitte zuerst eine Region auswählen.","OAR-Export");
const name=byId("archive-region").selectedOptions[0]?.textContent||"Region";
stopPolling();
pending(name);
show();
selected=null;
startButton.disabled=true;
const epoch=generation;
try {
const response=await jsonPost("/api/oar/export",{regionId});
if(!validJob(response.id))throw new Error("Der Simulator hat keine gültige Auftrags-ID geliefert");
activeExport=response.id;
selected=response.id;
if(epoch!==generation||dialog.hidden) {
startButton.disabled=false;
if(typeof loadJobs==="function")loadJobs().catch(()=>{});
return;
}
failedPolls=0;
await poll(response.id,epoch);
}catch(error){
if(epoch===generation&&!dialog.hidden) {
statusLabel.textContent="Start fehlgeschlagen";
statusLabel.dataset.state="failed";
stage.textContent="OAR-Export konnte nicht gestartet werden";
hint.textContent=error.message;
progress.hidden=true;
}
activeExport=null;
startButton.disabled=false;
}
}
window.startOarLiveExport=startExport;
window.openOarLiveModal=openExisting;
// A closed modal never cancels the running server job.
// Reopen via the persistent jobs table at any time.
})();
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

+53 -1
View File
@@ -1 +1,53 @@
:root{color-scheme:dark;font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;background:#0b101b;color:#e9eef9;font-size:14px}*{box-sizing:border-box}body{margin:0;min-height:100vh}button,input,select{font:inherit}button{cursor:pointer;border-radius:10px;padding:10px 17px;border:1px solid #30415a;background:#161f32;color:#eef5ff}button:hover{filter:brightness(1.17)}button.primary{background:linear-gradient(120deg,#24b2ef,#087bdd);color:white;border:0;font-weight:700}button.danger{color:#ffb6b8;border-color:#92484d}button.ghost{background:#151e2d}.muted,p{color:#94a5bb}.eyebrow{letter-spacing:.22em;font-size:10px;color:#6cc9f2;font-weight:750}.brand-mark{width:64px;height:64px;display:grid;place-items:center;font-weight:900;letter-spacing:-.17em;padding-right:.15em;font-size:22px;background:linear-gradient(135deg,#17ade4,#6244bf);border-radius:18px;box-shadow:0 10px 34px #0788cc44}.brand-mark span{color:#b9eafe}.brand-mark.small{width:46px;height:46px;border-radius:14px;font-size:17px}h1{font-size:35px;margin:.6em 0 .25em}h2{font-size:30px;margin:6px 0 0;font-weight:750}h3{font-size:19px;margin:0 0 6px}.login-screen{min-height:100vh;display:grid;place-items:center;padding:25px;background:radial-gradient(ellipse at 70% 18%,#132d50 0,transparent 40%),radial-gradient(ellipse at 16% 82%,#19204c 0,transparent 48%),#0b101b}.login-panel{width:min(100%,460px);padding:46px;background:#151d2de8;border:1px solid #35425b;border-radius:24px;box-shadow:0 32px 120px #0006}.login-panel .muted{line-height:1.6}label{display:block;font-size:13px;color:#bccce1;font-weight:650;margin:18px 0}input,select{display:block;width:100%;background:#0d1523;border:1px solid #36455e;border-radius:9px;padding:13px;color:#ecf3fc;margin-top:8px;outline:0}input:focus,select:focus{border-color:#51bdf3}.login-panel .primary{width:100%;margin:12px 0 18px;padding:14px}small{font-size:11px}aside{position:fixed;inset:0 auto 0 0;width:255px;background:#111927;border-right:1px solid #27374b;padding:27px 16px;display:flex;flex-direction:column}.side-brand{display:flex;gap:12px;align-items:center;padding:0 9px 33px}.side-brand strong{font-size:14px}.side-brand small{display:block;color:#7b90a8;letter-spacing:.16em;font-size:9px;margin-top:4px}.side-label{font-size:10px;color:#67819f;letter-spacing:.18em;margin:0 12px 10px}nav{display:flex;flex-direction:column;gap:4px}nav a{text-decoration:none;color:#aabbd0;padding:14px 15px;border-radius:10px;font-weight:550}nav a.active,nav a:hover{background:#1a2c45;color:#65c8ff}nav a.active{box-shadow:inset 3px 0 #22a8f6}.side-footer{margin-top:auto;font-size:12px;border-top:1px solid #25344b;padding:18px 10px 0}.side-footer p{font-size:11px}.live-dot{width:8px;height:8px;border-radius:50%;background:#4cdb9b;display:inline-block;margin-right:8px;box-shadow:0 0 14px #42bb86}main{margin-left:255px;max-width:1600px;min-height:100vh;padding:28px 38px 70px}.topbar{display:flex;justify-content:space-between;align-items:center;gap:15px;padding-bottom:28px}.top-right{display:flex;align-items:center;gap:10px}.pill{padding:9px 13px;background:#1a283c;color:#8ad5fa;border:1px solid #2b4967;border-radius:30px;white-space:nowrap}.hero{display:flex;justify-content:space-between;align-items:center;background:radial-gradient(circle at 84% 50%,#24528b70,transparent 38%),linear-gradient(120deg,#172c48,#121c30);border:1px solid #2b4666;border-radius:21px;padding:35px 43px;min-height:250px}.hero h2{font-size:36px;line-height:1.18}.hero h2 em{font-style:normal;color:#49c1f8}.hero p{max-width:420px;line-height:1.55}.hero-ring{width:160px;height:160px;border:9px solid #2f6594;box-shadow:0 0 0 1px #50c6fa99,inset 0 0 40px #159deb33,0 0 55px #39b0e922;border-radius:50%;display:flex;flex-direction:column;justify-content:center;align-items:center}.hero-ring span{font-weight:900;font-size:43px;letter-spacing:-.1em}.hero-ring small{letter-spacing:.2em;color:#62caff}.stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin:24px 0}.stat,.panel,.region-card{border:1px solid #27364d;background:#151f30;border-radius:15px;padding:23px}.stat p{margin:0 0 12px;font-weight:650}.stat strong{font-size:30px;font-weight:800}.stat small{display:block;color:#6d87a5;margin-top:8px}.panel{margin:20px 0}.section-head{display:flex;justify-content:space-between;align-items:center;gap:15px;margin:9px 0 18px}.section-head p{font-size:12px;margin:5px 0}.table-wrap{overflow-x:auto}table{width:100%;border-collapse:collapse;text-align:left}th{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:#8299b4;padding:14px;border-bottom:1px solid #2b3e55}td{padding:14px;border-bottom:1px solid #243348;color:#c9d6e7}td strong{color:#f4f7ff}.status{display:inline-block;border-radius:15px;padding:5px 9px;background:#273e49;color:#70dbb3;font-size:11px}.status.bad{background:#412b36;color:#ffacb4}.cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.region-card h3{font-size:20px}.region-card p{fonLine truncated
:root{color-scheme:dark;font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;background:#0b101b;color:#e9eef9;font-size:14px}*{box-sizing:border-box}body{margin:0;min-height:100vh}button,input,select{font:inherit}button{cursor:pointer;border-radius:10px;padding:10px 17px;border:1px solid #30415a;background:#161f32;color:#eef5ff}button:hover{filter:brightness(1.17)}button.primary{background:linear-gradient(120deg,#24b2ef,#087bdd);color:white;border:0;font-weight:700}button.danger{color:#ffb6b8;border-color:#92484d}button.ghost{background:#151e2d}.muted,p{color:#94a5bb}.eyebrow{letter-spacing:.22em;font-size:10px;color:#6cc9f2;font-weight:750}.brand-mark{width:64px;height:64px;display:grid;place-items:center;font-weight:900;letter-spacing:-.17em;padding-right:.15em;font-size:22px;background:linear-gradient(135deg,#17ade4,#6244bf);border-radius:18px;box-shadow:0 10px 34px #0788cc44}.brand-mark span{color:#b9eafe}.brand-mark.small{width:46px;height:46px;border-radius:14px;font-size:17px}h1{font-size:35px;margin:.6em 0 .25em}h2{font-size:30px;margin:6px 0 0;font-weight:750}h3{font-size:19px;margin:0 0 6px}.login-screen{min-height:100vh;display:grid;place-items:center;padding:25px;background:radial-gradient(ellipse at 70% 18%,#132d50 0,transparent 40%),radial-gradient(ellipse at 16% 82%,#19204c 0,transparent 48%),#0b101b}.login-panel{width:min(100%,460px);padding:46px;background:#151d2de8;border:1px solid #35425b;border-radius:24px;box-shadow:0 32px 120px #0006}.login-panel .muted{line-height:1.6}label{display:block;font-size:13px;color:#bccce1;font-weight:650;margin:18px 0}input,select{display:block;width:100%;background:#0d1523;border:1px solid #36455e;border-radius:9px;padding:13px;color:#ecf3fc;margin-top:8px;outline:0}input:focus,select:focus{border-color:#51bdf3}.login-panel .primary{width:100%;margin:12px 0 18px;padding:14px}small{font-size:11px}aside{position:fixed;inset:0 auto 0 0;width:255px;background:#111927;border-right:1px solid #27374b;padding:27px 16px;display:flex;flex-direction:column}.side-brand{display:flex;gap:12px;align-items:center;padding:0 9px 33px}.side-brand strong{font-size:14px}.side-brand small{display:block;color:#7b90a8;letter-spacing:.16em;font-size:9px;margin-top:4px}.side-label{font-size:10px;color:#67819f;letter-spacing:.18em;margin:0 12px 10px}nav{display:flex;flex-direction:column;gap:4px}nav a{text-decoration:none;color:#aabbd0;padding:14px 15px;border-radius:10px;font-weight:550}nav a.active,nav a:hover{background:#1a2c45;color:#65c8ff}nav a.active{box-shadow:inset 3px 0 #22a8f6}.side-footer{margin-top:auto;font-size:12px;border-top:1px solid #25344b;padding:18px 10px 0}.side-footer p{font-size:11px}.live-dot{width:8px;height:8px;border-radius:50%;background:#4cdb9b;display:inline-block;margin-right:8px;box-shadow:0 0 14px #42bb86}main{margin-left:255px;max-width:1600px;min-height:100vh;padding:28px 38px 70px}.topbar{display:flex;justify-content:space-between;align-items:center;gap:15px;padding-bottom:28px}.top-right{display:flex;align-items:center;gap:10px}.pill{padding:9px 13px;background:#1a283c;color:#8ad5fa;border:1px solid #2b4967;border-radius:30px;white-space:nowrap}.hero{display:flex;justify-content:space-between;align-items:center;background:radial-gradient(circle at 84% 50%,#24528b70,transparent 38%),linear-gradient(120deg,#172c48,#121c30);border:1px solid #2b4666;border-radius:21px;padding:35px 43px;min-height:250px}.hero h2{font-size:36px;line-height:1.18}.hero h2 em{font-style:normal;color:#49c1f8}.hero p{max-width:420px;line-height:1.55}.hero-ring{width:160px;height:160px;border:9px solid #2f6594;box-shadow:0 0 0 1px #50c6fa99,inset 0 0 40px #159deb33,0 0 55px #39b0e922;border-radius:50%;display:flex;flex-direction:column;justify-content:center;align-items:center}.hero-ring span{font-weight:900;font-size:43px;letter-spacing:-.1em}.hero-ring small{letter-spacing:.2em;color:#62caff}.stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin:24px 0}.stat,.panel,.region-card{border:1px solid #27364d;background:#151f30;border-radius:15px;padding:23px}.stat p{margin:0 0 12px;font-weight:650}.stat strong{font-size:30px;font-weight:800}.stat small{display:block;color:#6d87a5;margin-top:8px}.panel{margin:20px 0}.section-head{display:flex;justify-content:space-between;align-items:center;gap:15px;margin:9px 0 18px}.section-head p{font-size:12px;margin:5px 0}.table-wrap{overflow-x:auto}table{width:100%;border-collapse:collapse;text-align:left}th{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:#8299b4;padding:14px;border-bottom:1px solid #2b3e55}td{padding:14px;border-bottom:1px solid #243348;color:#c9d6e7}td strong{color:#f4f7ff}.status{display:inline-block;border-radius:15px;padding:5px 9px;background:#273e49;color:#70dbb3;font-size:11px}.status.bad{background:#412b36;color:#ffacb4}.cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.region-card h3{font-size:20px}.region-card p{fonLine truncated
/* Official OGL Simulator branding */
.brand-logo{display:block;object-fit:contain;flex-shrink:0;max-width:100%;filter:drop-shadow(0 0 16px rgba(0,190,255,.18))}
.login-logo{width:112px;height:112px;margin:0 0 8px;border-radius:12px}
.brand-logo.small{width:50px;height:50px}
.hero-ring{border:0;border-radius:20px;background:none;box-shadow:none;overflow:visible;width:180px;height:180px;flex-shrink:0}
.hero-brand-logo{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 0 24px rgba(0,190,255,.25))}
.side-brand{gap:10px}.side-brand>div:last-child{min-width:0}
@media(max-width:900px){.login-logo{width:96px;height:96px}.brand-logo.small{width:44px;height:44px}}
/* OGL Global Translater */
.translator-connection{display:flex;gap:15px;align-items:center;margin-bottom:18px}
.translator-connection strong{font-size:18px;color:#cfeeff}
.translator-connection strong[data-ready="true"]{color:#8befce}
.translator-connection p{margin:5px 0 0}
.translator-cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:18px 0 22px}
.translator-cards .stat{padding:18px;min-width:0}
.translator-cards strong{font-size:clamp(16px,1.8vw,21px);overflow-wrap:anywhere}
#translator-endpoint{overflow-wrap:anywhere}
#translator .notice p{line-height:1.7;max-width:80ch}
@media(max-width:900px){.translator-cards{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:550px){.translator-cards{grid-template-columns:1fr 1fr;gap:8px}
.translator-cards .stat{padding:13px}.translator-connection strong{font-size:16px}}
/* Only visible when a new, centrally approved release is available. */
.ogl-update-notice:not([hidden]){display:flex;align-items:center;
justify-content:space-between;gap:16px;flex-wrap:wrap;
padding:16px 20px;margin:12px 0 20px;border:1px solid rgba(100,194,247,.5);
border-radius:14px;background:rgba(13,55,89,.38)}
.ogl-update-notice strong{font-size:1.05rem}
.ogl-update-notice p{margin:4px 0 0;color:#b9d7e7}
nav a[data-update-available="true"]{font-weight:700;border-left:3px solid #60ceec}
@media(max-width:600px){.ogl-update-notice{align-items:flex-start}}
/* OGL Health Center / Login Diagnostics */
.ogl-health-overview{display:flex;align-items:center;gap:18px;
justify-content:space-between;flex-wrap:wrap}
.ogl-health-overview strong{font-size:1.04rem}
.ogl-health-overview p{margin:5px 0 0}
.ogl-health-components{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.ogl-health-item{padding:16px;border:1px solid rgba(131,190,226,.26);
background:rgba(17,43,64,.25);border-radius:12px;min-width:0}
.ogl-health-head{display:flex;align-items:center;gap:12px;
justify-content:space-between;flex-wrap:wrap}
.ogl-health-item p{margin:10px 0 0;line-height:1.5;overflow-wrap:anywhere}
.ogl-health-item .muted{font-size:.88rem}
.ogl-health-head .status{padding:4px 9px;border-radius:8px;font-size:.8rem;
background:rgba(125,147,164,.13);border:1px solid rgba(138,164,180,.22)}
.ogl-health-head .status[data-health="critical"]{border-color:rgba(222,115,115,.5)}
.ogl-health-head .status[data-health="warning"]{border-color:rgba(217,171,111,.45)}
@media(max-width:820px){.ogl-health-components{grid-template-columns:1fr}}
@@ -0,0 +1,101 @@
# OpenGenesisLINK Generation 1 – DLL-Startschutz (21.11.2026)
## Status
Der Offline-DLL-Kompatibilitätsprüfer ist implementiert, lokal geprüft und
in die drei vorhandenen Startskripte integriert. Für die neu erstellte
System-&-Integrität-Administrationsseite wurden beide Webinterface-DLLs
erfolgreich gebaut und auf der Festplatte bereitgestellt.
**Die laufenden ROBUST- und Simulatorprozesse wurden bewusst nicht neu gestartet.**
Die neue Seite erscheint deshalb beim nächsten kontrollierten Neustart der
jeweiligen Simulatorinstanz.
## Schutzumfang
Das unabhängige .NET-10-Werkzeug **ogl.dllpreflight.dll** liest die Metadaten
der lokalen Programmdlls offline, ohne Regions- oder Loginlogik auszuführen.
- Vor jedem zukünftigen Start der ROBUST-Instanz und der beiden lokalen
Simulatoren.
- Prüft das Vorhandensein und den Aufbau zentraler Assemblies.
- Prüft die deklarierten OpenSim.Framework-Assemblyversionen der Kernmodule.
- **Auf ROBUST zusätzlich:** Prüft tatsächlich referenzierte Methoden des
`OpenSim.Framework.OglLiveAccessPolicy` gegen die vom
`OpenSim.Services.LLLoginService.dll` erwarteten Signaturen. Damit ist
auch eine Inkompatibilität bei **gleicher Assemblyversion 0.9.4.0**
erkennbar.
- Bei einem bestätigten Fehler wird ein JSON-Bericht erstellt und der
Start mit Exitcode 78 gestoppt. Die gestarteten Prozesse bleiben bei einer
bloßen Aktualisierung der Startskripte unberührt.
- Dies ist ein **gezielter Kernmodul-/Login-ABI-Check**, keine vollständige
Kompatibilitätsgarantie sämtlicher Drittanbieterplugins oder Laufzeitpfade.
## Pfade
Werkzeug:
`/opt/robust/tools/ops/ogl-dll-preflight/`
Binärprogramm:
`/opt/robust/tools/ops/ogl-dll-preflight/bin/Release/net10.0/ogl.dllpreflight.dll`
Startskripte:
```text
/opt/robust/bin/ogl-run-robust-with-policy.sh
/opt/robust/bin/ogl-run-simulator-with-policy.sh
/opt/eventsim/bin/ogl-run-eventsim-with-policy.sh
```
Statusdateien (0600):
```text
/opt/robust/bin/ops-data/compatibility-robust.json
/opt/robust/bin/ops-data/compatibility-simulator.json
/opt/eventsim/bin/ops-data/compatibility-simulator.json
```
Admin-Webroute pro Simulator (nur mit OGL.WebInterface-Session):
`GET /api/system/compatibility`
Neue Ansicht im Simulator-Webinterface:
**System & Integrität**. Auf dem Hauptsimulator enthält sie den
lokalen ROBUST- und Simulatorbericht, auf NexTopia den eigenen Simulatorbericht.
## Manuelle Prüfung ohne Neustart
```bash
CHECKER=/opt/robust/tools/ops/ogl-dll-preflight/bin/Release/net10.0/ogl.dllpreflight.dll
dotnet "$CHECKER" --dir /opt/robust/bin --mode robust --report /opt/robust/bin/ops-data/compatibility-robust.json
dotnet "$CHECKER" --dir /opt/robust/bin --mode simulator --report /opt/robust/bin/ops-data/compatibility-simulator.json
dotnet "$CHECKER" --dir /opt/eventsim/bin --mode simulator --report /opt/eventsim/bin/ops-data/compatibility-simulator.json
```
Der Prüfer gibt Exitcode 0 bei erfolgreicher Prüfung, 2 bei
Inkompatibilität und 64 bei ungültigen Aufrufen zurück. Im Startskript
führen alle Fehler zu Exitcode 78, bevor dotnet ROBUST/OpenSim lädt.
## Verifikation
- .NET 10: Build mit 0 Warnungen und 0 Fehlern.
- Aktuelle ROBUST-/Hauptsim-/EventSim-DLLs: jeweils Status `ok`.
- Positivtest ROBUST: zwei Referenzen auf OglLiveAccessPolicy erkannt,
beide Signaturen in OpenSim.Framework.dll exakt gefunden.
- **Negativtest:** Die vor dem Loginfix eingesetzte Framework-DLL
wurde in ein separates temporäres Testverzeichnis kopiert. Der
Prüfer hat den fehlenden Typ erkannt und den Start korrekt blockiert.
- Alle drei Startskripte: Bash-Syntax erfolgreich geprüft.
- UI-Backend und Frontend auf beiden Simulatoren: ohne Buildwarnung.
- Laufende Gridprozesse/HTTPS-Endpunkte: unverändert erreichbar.
## Betrieb und Grenzen
Für künftige fremde Server wird das Preflight-Programm gemeinsam mit
dem jeweiligen OGL-Serverpaket ausgeliefert werden müssen. Die aktuellen
lokalen Startskripte erwarten das Werkzeug unter dem oben genannten Pfad.
Dieser Prüfer beurteilt die DLLs auf dem Dateisystem. Er ersetzt keinen
echten Avatar-Login-Test, prüft keine Netzverbindung und garantiert nicht
die Integrität sämtlicher nachladbarer Pluginmodule. Ein zusätzlicher
vollständiger Update-Rehearsal- und Rollbackablauf bleibt sinnvoll.
**Backup der vorigen Startskripte und Webinterfacequellen:**
`/root/ogl-deploy-backups/ogl-dll-preflight-20261121/`
@@ -0,0 +1,126 @@
# OpenGenesisLINK Gen1 – OGL Health Center und Login-Diagnose
Stand: 21.11.2026
## Funktionsumfang
Das OGL.WebInterface des jeweiligen Simulators erhält die Administrationsbereiche
**OGL Health Center** und **Login-Diagnosecenter**.
Die Diagnose läuft **lokal in der jeweiligen Simulatorinstanz**, ohne
Änderungen an Stadtportal, SYS.API, AssetService, S3 oder externen Nodes.
### OGL Health Center
- Regionsbereitschaft und Anzahl geladener Regionen / Root-Avatare.
- Tatsächliche TCP-Erreichbarkeit der konfigurierten Grid-Service-Endpunkte
über die bestehende ServiceSummaryAsync-Funktion.
- Lokaler DLL-Startschutz-Bericht aus
`ops-data/compatibility-simulator.json` (Dateien auf Datenträger,
nicht automatisch die bereits geladenen Assemblies).
- Anonymisierte ROBUST-Loginfehler der letzten 60 Minuten
(soweit im lokalen Ausschnitt der Logdatei vorhanden).
- Optionaler HTTPS-Healthcheck des zentralen OGL Update Center und des
OGL Global Translater, sofern auf dieser Node konfiguriert.
- Bewertung: betriebsbereit, Warnung, kritisch oder unbekannt;
konkrete empfohlene Maßnahmen für jede Komponente.
- Dashboard-Kurzhinweis und manueller **Jetzt prüfen**-Button.
- Bei geöffnetem Health Center automatische Aktualisierung etwa alle 45 Sekunden.
**Wichtig:** Eine erfolgreiche TCP-Verbindung und ein gültiger
Dienst-Healthcheck beweisen *keinen* vollständigen Avatar-Login.
Daher werden solche Checks ausdrücklich nicht als echte Login-Erfolgsprüfung
ausgegeben. Ohne Logdaten erscheint der Loginstatus *unbekannt*.
### Login-Diagnosecenter
Read-only-Auswertung der letzten max. 2 MiB des aktuellsten ROBUST-Logs
(`Robust_*.log`) für Ereignisse der letzten 60 Minuten:
- Serverausnahme bei `login_to_simulator`
- Fehlender Framework-Typ (`Could not load type`)
- Fehlende/inkompatible Methode (`Method not found`)
- Zielregion nicht auffindbar (`destination not found`)
- Abgewiesene Zugangsdaten / Viewer-Zugangsrichtlinie
- Bürgerordnung/Zugangsrichtlinie
- Timeout und sonstige Login-Ausnahmen
- Erfolgreiche Loginantworten (`All clear. Sending login response`)
Ausgabe ausschließlich **als kategorisierte, anonymisierte Ereignisse**.
Es werden **keine Rohlogzeilen, Avatar-Namen, Passwörter, UUIDs,
Chatnachrichten oder IP-Adressen** übertragen. Die Zählung ist explizit
auf den vorhandenen Protokollausschnitt beschränkt; kein vollständiger
Ereigniszähler über alle Logdateien.
### Konfiguration
Für Simulatoren und ROBUST auf demselben Host wird im lokalen
OGL-Startskript der erlaubte, lesbare Logpfad angegeben:
```bash
export OGL_HEALTH_ROBUST_LOG_DIR=/opt/robust/bin/logs
```
Auf fremden Nodes ist das optional. Ohne ein dort zugängliches ROBUST-Log
wird **"ROBUST-Protokoll nicht verfügbar"** angezeigt, nicht
fälschlich "Logins in Ordnung". Es werden keine privaten Protokolle
an einen externen Cloud-Dienst übertragen.
Zusätzliche zentrale Dienstadressen werden **nur** aus den bestehenden
Laufzeitumgebungsvariablen gelesen:
```text
OGL_UPDATE_CENTRAL_URL
OGL_TRANSLATOR_CENTRAL_URL
```
Die Health-Center-Frontendseite erhält daraus **keine** Zugangstokens.
### Administrations-API
Nach bestehender administrativer Anmeldung (OGL.WebInterface, UserLevel >= 200):
```http
GET /api/health-center/summary
GET /api/health-center/login-diagnostics
```
Beide Routen werden erst nach der bestehenden Cookie- und
UserLevel-Revalidierung behandelt. Nicht angemeldete Anfragen
erhalten HTTP 401. Es werden keine neuen Rollen, Scopes oder
erweiterten Schreibrechte eingeführt.
### Technische Quelle
`addons/OSWebInterface/OglHealthDiagnostics.cs`
Verkabelung:
`addons/OSWebInterface/AdminHttpServer.cs`
UI:
`addons/OSWebInterface/www/index.html`,
`addons/OSWebInterface/www/app.js`,
`addons/OSWebInterface/www/style.css`.
Buildtargets: .NET 10; Linux x64, Linux ARM64, Windows x64.
### Tests
- `.NET 10`: beide OGL.Webinterface-Projekte kompiliert mit 0 Fehlern/0 Warnungen.
- Echter ROBUST-Log: Diagnose läuft und gibt keine Identitäten aus.
- Künstliches Log mit zwei inkompatiblen DLL-Ereignissen, einem
fehlgeschlagenen Regionslogin und einer erfolgreichen Loginantwort:
**3 Fehler, 1 Erfolg, kritisch**; personenbezogene Testdaten nicht
in der Antwort.
- Browsertest mit simulierten Adminantworten:
Layout, Navigationswege, Statusanzeige, Ursachen und Empfehlungen
bei 390, 768, 1440 Pixeln erfolgreich.
- Produktive OGL.Webinterface-DLLs werden erst beim nächsten
kontrollierten Simulator-Neustart neu geladen.
## Betrieb
Wenn der ROBUST-Log nicht lesbar ist, nie pauschal "ok" anzeigen.
Eine Fehlermeldung über inkompatible DLLs sollte durch den separat
implementierten DLL-Startschutz bereits **vor dem nächsten Start**
abgefangen werden. Der Health-Check ist ergänzende Beobachtung
und ersetzt keine abschließenden Login-/Viewer-Akzeptanztests.
+173
View File
@@ -0,0 +1,173 @@
// SPDX-License-Identifier: LicenseRef-OpenGenesisLINK-EULA
// Offline assembly metadata inspection; never executes untrusted module code.
// Intended to gate OGL process startup and to provide admin-only diagnostic JSON.
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using System.Reflection.PortableExecutable;
using System.Text.Json;
if (args.Length != 6 || args[0] != "--dir" || args[2] != "--mode" || args[4] != "--report")
{
Console.Error.WriteLine("Usage: ogl.dllpreflight --dir <bin> --mode robust|simulator --report <path>");
return 64;
}
string dir=Path.GetFullPath(args[1]), mode=args[3], output=Path.GetFullPath(args[5]);
if (!Directory.Exists(dir) || mode is not ("robust" or "simulator"))
{
Console.Error.WriteLine("Ungültiger Simulator-/ROBUST-Pfad oder Instanztyp.");
return 64;
}
List<string> errors=new(), notices=new();
List<object> checks=new();
var expected=mode=="robust" ?
new[]{"Robust.dll","OpenSim.Framework.dll","OpenSim.Services.LLLoginService.dll",
"OpenSim.Services.Interfaces.dll"} :
new[]{"OpenSim.dll","OpenSim.Framework.dll","OpenSim.Region.Framework.dll",
"OpenSim.Region.CoreModules.dll"};
var all=expected.Concat(new[]{"os_webinterface.dll"}).Distinct().ToArray();
string? coreVersion=null;
foreach(string name in all)
{
string file=Path.Combine(dir,name);
if (!File.Exists(file))
{
if(expected.Contains(name,StringComparer.Ordinal)) errors.Add("Pflichtmodul fehlt: "+name);
else notices.Add("Optionales Modul nicht vorhanden: "+name);
continue;
}
try
{
using var stream=File.OpenRead(file);
using var pe=new PEReader(stream);
if (!pe.HasMetadata || !pe.GetMetadataReader().IsAssembly)
{
errors.Add("Keine gültige .NET-Assembly: "+name);
continue;
}
MetadataReader reader=pe.GetMetadataReader();
var asm=reader.GetAssemblyDefinition();
string real=reader.GetString(asm.Name);
string declared=name.EndsWith(".dll",StringComparison.OrdinalIgnoreCase)?
name[..^4]:name;
if (!real.Equals(declared,StringComparison.OrdinalIgnoreCase))
errors.Add("Assemblyname und Dateiname weichen ab: "+name);
if(name=="OpenSim.Framework.dll")coreVersion=asm.Version.ToString();
// Compare explicitly declared core-assembly versions, not just file timestamps.
foreach(var refHandle in reader.AssemblyReferences)
{
var reference=reader.GetAssemblyReference(refHandle);
string referenceName=reader.GetString(reference.Name);
if(referenceName!="OpenSim.Framework" || name=="OpenSim.Framework.dll")continue;
string referenceVersion=reference.Version.ToString();
// A different declared assembly version is a definite binding problem.
// Some legacy assemblies still carry stable old versions across builds,
// so matching versions alone cannot prove ABI compatibility.
checks.Add(new { kind="framework-reference",module=name,version=referenceVersion });
}
checks.Add(new {kind="assembly",module=name,version=asm.Version.ToString()});
}
catch(Exception ex) when(ex is IOException or BadImageFormatException or UnauthorizedAccessException)
{
errors.Add("DLL nicht lesbar oder beschädigt: "+name+" ("+ex.GetType().Name+")");
}
}
if (coreVersion != null)
{
foreach(var check in checks)
{
var c=JsonSerializer.SerializeToElement(check);
if (c.GetProperty("kind").GetString()!="framework-reference")continue;
var referenced=c.GetProperty("version").GetString();
if (referenced!=coreVersion)
errors.Add("OpenSim.Framework-Assemblyversion widerspricht Referenz von "+
c.GetProperty("module").GetString()+": "+referenced+" statt "+coreVersion);
}
}
if(mode=="robust" && errors.Count==0)
{
try
{
using var fstream=File.OpenRead(Path.Combine(dir,"OpenSim.Framework.dll"));
using var lstream=File.OpenRead(Path.Combine(dir,"OpenSim.Services.LLLoginService.dll"));
using var framework=new PEReader(fstream);
using var login=new PEReader(lstream);
var f=framework.GetMetadataReader();
var l=login.GetMetadataReader();
TypeDefinitionHandle? policy=null;
foreach(var handle in f.TypeDefinitions)
{
var t=f.GetTypeDefinition(handle);
if(f.GetString(t.Name)=="OglLiveAccessPolicy" &&
f.GetString(t.Namespace)=="OpenSim.Framework")
{ policy=handle;break; }
}
int expectedRefs=0, matched=0;
foreach(var h in l.MemberReferences)
{
var m=l.GetMemberReference(h);
if(m.Parent.Kind!=HandleKind.TypeReference)continue;
var t=l.GetTypeReference((TypeReferenceHandle)m.Parent);
if(l.GetString(t.Name)!="OglLiveAccessPolicy" ||
l.GetString(t.Namespace)!="OpenSim.Framework")continue;
string name=l.GetString(m.Name);
expectedRefs++;
if(policy is null)
{
errors.Add("OpenSim.Framework.OglLiveAccessPolicy fehlt; benötigt von Loginmodul.");
continue;
}
var type=f.GetTypeDefinition(policy.Value);
bool found=false;
foreach(var methodHandle in type.GetMethods())
{
var def=f.GetMethodDefinition(methodHandle);
if(f.GetString(def.Name)!=name)continue;
// Compare exact CLR method signature blobs from consumer and provider;
// catches missing or changed ref/out parameter types and return type.
if(f.GetBlobBytes(def.Signature).SequenceEqual(l.GetBlobBytes(m.Signature)))
{found=true;break;}
}
if(found)matched++;
else errors.Add("Loginmodul benötigt inkompatible Methode: OglLiveAccessPolicy."+name);
}
if(expectedRefs==0)
notices.Add("Loginmodul enthält keine OglLiveAccessPolicy-Verweise (älterer Modultyp).");
checks.Add(new{kind="login-policy-abi",referenced=expectedRefs,matched,
valid=expectedRefs==matched});
}
catch(Exception ex) when(ex is IOException or BadImageFormatException or UnauthorizedAccessException or InvalidOperationException)
{
errors.Add("Login-ABI-Prüfung fehlgeschlagen: "+ex.GetType().Name);
}
}
bool healthy=errors.Count==0;
var report=new {
instance=mode,
status=healthy?"ok":"blocked",
checkedAtUtc=DateTimeOffset.UtcNow,
frameworkVersion=coreVersion,
checks,
warnings=notices,
errors,
message=healthy?"DLL-Prüfung erfolgreich: alle geprüften Kernmodule kompatibel.":
"Kritischer DLL-Kompatibilitätsfehler: Start blockiert."
};
string json=JsonSerializer.Serialize(report,new JsonSerializerOptions{WriteIndented=true});
try
{
Directory.CreateDirectory(Path.GetDirectoryName(output)!);
string temp=output+"."+Guid.NewGuid().ToString("N")+".tmp";
await File.WriteAllTextAsync(temp,json);
if(!OperatingSystem.IsWindows())
File.SetUnixFileMode(temp,UnixFileMode.UserRead|UnixFileMode.UserWrite);
File.Move(temp,output,true);
}
catch(Exception ex)
{
Console.Error.WriteLine("Statusdatei konnte nicht geschrieben werden: "+ex.GetType().Name);
return 74;
}
Console.WriteLine("[OGL DLL PREFLIGHT] "+(healthy?"OK":"BLOCKIERT")+" / "+mode+
" / "+checks.Count+" Prüfungen / "+errors.Count+" Fehler");
foreach(string error in errors)Console.Error.WriteLine("[OGL DLL PREFLIGHT] "+error);
return healthy?0:2;
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<AssemblyName>ogl.dllpreflight</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
</Project>