2023-12-28 00:25:49 +00:00
|
|
|
<!DOCTYPE html>
|
2024-05-25 01:28:39 +00:00
|
|
|
<html lang="en" data-bs-theme="auto">
|
2023-12-28 00:25:49 +00:00
|
|
|
|
|
|
|
<head>
|
|
|
|
<%- header %>
|
|
|
|
</head>
|
|
|
|
|
2024-03-22 23:54:12 +00:00
|
|
|
<body id="app" v-cloak>
|
2023-12-28 00:25:49 +00:00
|
|
|
<Navbar></Navbar>
|
|
|
|
<div id="content" class="container">
|
2024-03-22 23:54:12 +00:00
|
|
|
<h1 class="my-4">{{ $t('index.welcome') }}</h1>
|
|
|
|
<p>{{ $t('index.description') }}</p>
|
2023-12-28 00:25:49 +00:00
|
|
|
<div class="alert alert-danger" v-if="fancyLogs.find(x => x.level === 'Fatal')">
|
|
|
|
<div style="line-height: 32px;">
|
|
|
|
<i class="fas fa-circle-exclamation" style="font-size: 32px;margin-right: 0.25em;"></i>
|
2024-03-22 23:54:12 +00:00
|
|
|
<p v-html="$t('index.startup_errors')"></p>
|
|
|
|
<br>
|
2023-03-27 19:55:21 +00:00
|
|
|
</div>
|
2023-12-28 00:25:49 +00:00
|
|
|
<ul>
|
|
|
|
<li v-for="v in fancyLogs.filter(x => x.level === 'Fatal')">{{v.value}}</li>
|
|
|
|
</ul>
|
2024-01-07 20:02:25 +00:00
|
|
|
<a class="btn btn-danger" href="/troubleshooting/#logs">View Logs</a>
|
2023-12-28 00:25:49 +00:00
|
|
|
</div>
|
2024-01-07 18:32:32 +00:00
|
|
|
<!-- Version -->
|
2023-12-28 00:25:49 +00:00
|
|
|
<div class="card p-2 my-4">
|
|
|
|
<div class="card-body" v-if="version">
|
2024-05-25 00:09:07 +00:00
|
|
|
<h2>Version {{version.version}}</h2>
|
2024-01-07 18:32:32 +00:00
|
|
|
<br>
|
2023-12-28 00:25:49 +00:00
|
|
|
<div v-if="loading">
|
2024-03-22 23:54:12 +00:00
|
|
|
{{ $t('index.loading_latest') }}
|
2023-03-09 23:13:57 +00:00
|
|
|
</div>
|
2023-12-28 00:25:49 +00:00
|
|
|
<div class="alert alert-success" v-if="buildVersionIsDirty">
|
2024-03-22 23:54:12 +00:00
|
|
|
{{ $t('index.version_dirty') }} 🌇
|
2023-12-28 00:25:49 +00:00
|
|
|
</div>
|
2024-05-25 00:09:07 +00:00
|
|
|
<div class="alert alert-info" v-if="installedVersionNotStable">
|
|
|
|
{{ $t('index.installed_version_not_stable') }}
|
|
|
|
</div>
|
|
|
|
<div v-else-if="(!preReleaseBuildAvailable || !notifyPreReleases) && !stableBuildAvailable && !buildVersionIsDirty">
|
2023-12-28 00:25:49 +00:00
|
|
|
<div class="alert alert-success">
|
2024-03-22 23:54:12 +00:00
|
|
|
{{ $t('index.version_latest') }}
|
2023-03-09 23:13:57 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-05-24 01:42:06 +00:00
|
|
|
<div v-if="notifyPreReleases && preReleaseBuildAvailable">
|
2023-12-28 00:25:49 +00:00
|
|
|
<div class="alert alert-warning">
|
|
|
|
<div class="d-flex justify-content-between">
|
2024-03-22 23:54:12 +00:00
|
|
|
<div class="my-2">
|
2024-05-24 01:42:06 +00:00
|
|
|
<p>{{ $t('index.new_pre_release') }}</p>
|
2024-03-22 23:54:12 +00:00
|
|
|
</div>
|
2024-05-25 00:09:07 +00:00
|
|
|
<a class="btn btn-success m-1" :href="preReleaseVersion.release.html_url" target="_blank">{{ $t('index.download') }}</a>
|
2023-12-28 00:25:49 +00:00
|
|
|
</div>
|
2024-05-25 00:09:07 +00:00
|
|
|
<pre><b>{{preReleaseVersion.release.name}}</b></pre>
|
|
|
|
<pre>{{preReleaseVersion.release.body}}</pre>
|
2023-12-28 00:25:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div v-if="stableBuildAvailable">
|
|
|
|
<div class="alert alert-warning">
|
|
|
|
<div class="d-flex justify-content-between">
|
2024-03-22 23:54:12 +00:00
|
|
|
<div class="my-2">
|
2024-05-24 01:42:06 +00:00
|
|
|
<p>{{ $t('index.new_stable') }}</p>
|
2024-03-22 23:54:12 +00:00
|
|
|
</div>
|
2024-05-25 00:09:07 +00:00
|
|
|
<a class="btn btn-success m-1" :href="githubVersion.release.html_url" target="_blank">{{ $t('index.download') }}</a>
|
2023-12-28 00:25:49 +00:00
|
|
|
</div>
|
2024-05-25 00:09:07 +00:00
|
|
|
<h3>{{githubVersion.release.name}}</h3>
|
|
|
|
<pre>{{githubVersion.release.body}}</pre>
|
2023-03-09 23:13:57 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-01-07 18:32:32 +00:00
|
|
|
<!-- Resources -->
|
2023-12-28 00:25:49 +00:00
|
|
|
<div class="my-4">
|
|
|
|
<Resource-Card></Resource-Card>
|
2021-05-30 13:56:13 +00:00
|
|
|
</div>
|
2021-08-17 17:12:15 +00:00
|
|
|
</div>
|
2023-12-28 00:25:49 +00:00
|
|
|
</body>
|
2023-03-09 23:13:57 +00:00
|
|
|
|
2023-12-28 00:25:49 +00:00
|
|
|
<script type="module">
|
|
|
|
import { createApp } from 'vue'
|
2024-05-13 17:08:13 +00:00
|
|
|
import { initApp } from './init'
|
2023-12-28 00:25:49 +00:00
|
|
|
import Navbar from './Navbar.vue'
|
|
|
|
import ResourceCard from './ResourceCard.vue'
|
2024-05-25 00:09:07 +00:00
|
|
|
import SunshineVersion from './sunshine_version'
|
2024-03-22 23:54:12 +00:00
|
|
|
|
2023-12-28 00:25:49 +00:00
|
|
|
console.log("Hello, Sunshine!")
|
|
|
|
let app = createApp({
|
|
|
|
components: {
|
|
|
|
Navbar,
|
|
|
|
ResourceCard
|
|
|
|
},
|
2023-03-09 23:13:57 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
version: null,
|
|
|
|
githubVersion: null,
|
2024-05-24 01:42:06 +00:00
|
|
|
notifyPreReleases: false,
|
|
|
|
preReleaseVersion: null,
|
2023-03-09 23:13:57 +00:00
|
|
|
loading: true,
|
2023-09-16 18:53:38 +00:00
|
|
|
logs: null,
|
2023-03-09 23:13:57 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
async created() {
|
|
|
|
try {
|
2024-05-24 01:42:06 +00:00
|
|
|
let config = await fetch("/api/config").then((r) => r.json());
|
|
|
|
this.notifyPreReleases = config.notify_pre_releases;
|
2024-05-25 00:09:07 +00:00
|
|
|
this.version = new SunshineVersion(null, config.version);
|
|
|
|
console.log("Version: ", this.version.version)
|
|
|
|
this.githubVersion = new SunshineVersion(await fetch("https://api.github.com/repos/LizardByte/Sunshine/releases/latest").then((r) => r.json()), null);
|
|
|
|
console.log("GitHub Version: ", this.githubVersion.version)
|
|
|
|
this.preReleaseVersion = new SunshineVersion((await fetch("https://api.github.com/repos/LizardByte/Sunshine/releases").then((r) => r.json())).find(release => release.prerelease), null);
|
|
|
|
console.log("Pre-Release Version: ", this.preReleaseVersion.version)
|
2023-09-16 18:53:38 +00:00
|
|
|
} catch (e) {
|
2024-05-25 00:09:07 +00:00
|
|
|
console.error(e);
|
2023-09-16 18:53:38 +00:00
|
|
|
}
|
|
|
|
try {
|
|
|
|
this.logs = (await fetch("/api/logs").then(r => r.text()))
|
|
|
|
} catch (e) {
|
|
|
|
console.error(e);
|
2023-03-09 23:13:57 +00:00
|
|
|
}
|
|
|
|
this.loading = false;
|
|
|
|
},
|
|
|
|
computed: {
|
2024-05-25 00:09:07 +00:00
|
|
|
installedVersionNotStable() {
|
2024-05-24 01:42:06 +00:00
|
|
|
if (!this.githubVersion || !this.version) {
|
|
|
|
return false;
|
|
|
|
}
|
2024-05-25 00:09:07 +00:00
|
|
|
return this.version.isGreater(this.githubVersion);
|
|
|
|
},
|
|
|
|
stableBuildAvailable() {
|
|
|
|
if (!this.githubVersion || !this.version) {
|
|
|
|
return false;
|
2023-03-26 23:28:57 +00:00
|
|
|
}
|
2024-05-25 00:09:07 +00:00
|
|
|
return this.githubVersion.isGreater(this.version);
|
2023-03-09 23:13:57 +00:00
|
|
|
},
|
2024-05-24 01:42:06 +00:00
|
|
|
preReleaseBuildAvailable() {
|
2024-05-25 00:09:07 +00:00
|
|
|
if (!this.preReleaseVersion || !this.githubVersion || !this.version) {
|
2024-05-24 01:42:06 +00:00
|
|
|
return false;
|
|
|
|
}
|
2024-05-25 00:09:07 +00:00
|
|
|
return this.preReleaseVersion.isGreater(this.version) && this.preReleaseVersion.isGreater(this.githubVersion);
|
2023-06-06 22:31:15 +00:00
|
|
|
},
|
2023-09-16 18:53:38 +00:00
|
|
|
buildVersionIsDirty() {
|
2024-05-25 00:09:07 +00:00
|
|
|
return this.version.version?.split(".").length === 5 &&
|
|
|
|
this.version.version.indexOf("dirty") !== -1
|
2023-03-26 23:28:57 +00:00
|
|
|
},
|
2023-09-16 18:53:38 +00:00
|
|
|
/** 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;
|
2023-03-26 23:28:57 +00:00
|
|
|
}
|
2023-03-09 23:13:57 +00:00
|
|
|
}
|
|
|
|
});
|
2024-03-22 23:54:12 +00:00
|
|
|
|
2024-05-13 17:08:13 +00:00
|
|
|
initApp(app);
|
2023-03-09 23:13:57 +00:00
|
|
|
</script>
|