diff --git a/src_assets/common/assets/web/index.html b/src_assets/common/assets/web/index.html index e83d43ee..2fe713e6 100644 --- a/src_assets/common/assets/web/index.html +++ b/src_assets/common/assets/web/index.html @@ -1,6 +1,16 @@

Hello, Sunshine!

Sunshine is a self-hosted game stream host for Moonlight.

+
+
+ + Attention! Sunshine detected these errors during startup. These errors MUST be fixed before using + Sunshine.
+
+ +
@@ -21,7 +31,8 @@
A new Nightly Version is Available!
- Download + Download
{{nightlyData.head_sha}}
{{nightlyData.display_title}}
@@ -83,6 +94,7 @@ githubVersion: null, nightlyData: null, loading: true, + logs: null, } }, async created() { @@ -92,7 +104,12 @@ if (this.buildVersionIsNightly) { this.nightlyData = (await fetch("https://api.github.com/repos/LizardByte/Sunshine/actions/workflows/CI.yml/runs?branch=nightly&event=push&exclude_pull_requests=true&per_page=1").then((r) => r.json())).workflow_runs[0]; } - } catch(e){ + } catch (e) { + } + try { + this.logs = (await fetch("/api/logs").then(r => r.text())) + } catch (e) { + console.error(e); } this.loading = false; }, @@ -125,15 +142,26 @@ // return true if the commit hash is different, otherwise false return this.nightlyData.head_sha.indexOf(commit) !== 0; }, - buildVersionIsDirty() { + buildVersionIsDirty() { return this.version?.split(".").length === 5 && this.version.indexOf("dirty") !== -1 }, - buildVersionIsNightly() { + buildVersionIsNightly() { return this.version?.split(".").length === 4 }, buildVersionIsStable() { return this.version?.split(".").length === 3 + }, + /** Parse the text errors, calculating the text, the timestamp and the level */ + fancyLogs() { + if (!this.logs) return []; + let regex = /(\[\d{4}:\d{2}:\d{2}:\d{2}:\d{2}:\d{2}\]):\s/g; + let rawLogLines = (this.logs.split(regex)).splice(1); + let logLines = [] + for (let i = 0; i < rawLogLines.length; i += 2) { + logLines.push({ timestamp: rawLogLines[i], level: rawLogLines[i + 1].split(":")[0], value: rawLogLines[i + 1] }); + } + return logLines; } } });