-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
169 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import defaults from "$lib/defaults" | ||
import { parseAcceptLangHeader } from "$lib/locales" | ||
import { info } from "$lib/server/deepwell" | ||
import { translate } from "$lib/server/deepwell/translate" | ||
import type { TranslateKeys } from "$lib/types" | ||
import "$lib/vite-env.d.ts" | ||
import process from "process" | ||
|
||
export async function loadInfo(request, cookies) { | ||
const url = new URL(request.url) | ||
const domain = url.hostname | ||
const sessionToken = cookies.get("wikijump_token") | ||
let locales = parseAcceptLangHeader(request) | ||
|
||
if (!locales.includes(defaults.fallbackLocale)) locales.push(defaults.fallbackLocale) | ||
|
||
const response = await info() | ||
|
||
let translateKeys: TranslateKeys = { | ||
...defaults.translateKeys | ||
} | ||
|
||
const viewData = { | ||
backend: response, | ||
frontend: { | ||
name: serverInfo.frontendName, | ||
description: serverInfo.frontendDescription, | ||
repository: serverInfo.frontendRepository, | ||
version: serverInfo.frontendVersion, | ||
license: serverInfo.frontendLicense, | ||
node: process.versions.node, | ||
pnpm: serverInfo.pnpmVersion | ||
} | ||
} | ||
|
||
const translated = await translate(locales, translateKeys) | ||
|
||
viewData.internationalization = translated | ||
|
||
return viewData | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
declare const serverInfo: { | ||
pnpmVersion: string | null | ||
frontendName: string | null | ||
frontendVersion: string | null | ||
frontendDescription: string | null | ||
frontendRepository: string | null | ||
frontendLicense: string | null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { loadInfo } from "$lib/server/load/info" | ||
|
||
export async function load({ request, cookies }) { | ||
return loadInfo(request, cookies) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,88 @@ | ||
<h1>UNTRANSLATED:TODO: info page</h1> | ||
<script lang="ts"> | ||
import { page } from "$app/stores" | ||
</script> | ||
|
||
<h1>UNTRANSLATED: Info page</h1> | ||
|
||
<textarea class="debug">{JSON.stringify($page, null, 2)}</textarea> | ||
|
||
<table class="platform-info"> | ||
<tbody> | ||
<tr class="info-header"> | ||
<th colspan="2">UT:Backend</th> | ||
</tr> | ||
<tr class="info-attribute-row"> | ||
<th class="info-attribute-name">UT:Package name</th> | ||
<td class="info-attribute-value">{$page.data.backend.package.name}</td> | ||
</tr> | ||
<tr class="info-attribute-row"> | ||
<th class="info-attribute-name">UT:Package description</th> | ||
<td class="info-attribute-value">{$page.data.backend.package.description}</td> | ||
</tr> | ||
<tr class="info-attribute-row"> | ||
<th class="info-attribute-name">UT:Package license</th> | ||
<td class="info-attribute-value">{$page.data.backend.package.license}</td> | ||
</tr> | ||
<tr class="info-attribute-row"> | ||
<th class="info-attribute-name">UT:Package repository</th> | ||
<td class="info-attribute-value"> | ||
<a href={$page.data.backend.package.repository}> | ||
{$page.data.backend.package.repository} | ||
</a> | ||
</td> | ||
</tr> | ||
<tr class="info-attribute-row"> | ||
<th class="info-attribute-name">UT:Package version</th> | ||
<td class="info-attribute-value">{$page.data.backend.package.version}</td> | ||
</tr> | ||
<tr class="info-attribute-row"> | ||
<th class="info-attribute-name">UT:Rustc version</th> | ||
<td class="info-attribute-value">{$page.data.backend.compile_info.rustc_version}</td> | ||
</tr> | ||
</tbody> | ||
<tbody> | ||
<tr class="info-header"> | ||
<th colspan="2">UT:Frontend</th> | ||
</tr> | ||
<tr class="info-attribute-row"> | ||
<th class="info-attribute-name">UT:Package name</th> | ||
<td class="info-attribute-value">{$page.data.frontend.name}</td> | ||
</tr> | ||
<tr class="info-attribute-row"> | ||
<th class="info-attribute-name">UT:Package description</th> | ||
<td class="info-attribute-value">{$page.data.frontend.description}</td> | ||
</tr> | ||
<tr class="info-attribute-row"> | ||
<th class="info-attribute-name">UT:Package license</th> | ||
<td class="info-attribute-value">{$page.data.frontend.license}</td> | ||
</tr> | ||
<tr class="info-attribute-row"> | ||
<th class="info-attribute-name">UT:Package repository</th> | ||
<td class="info-attribute-value"> | ||
<a href={$page.data.frontend.repository}> | ||
{$page.data.frontend.repository} | ||
</a> | ||
</td> | ||
</tr> | ||
<tr class="info-attribute-row"> | ||
<th class="info-attribute-name">UT:Package version</th> | ||
<td class="info-attribute-value">{$page.data.frontend.version}</td> | ||
</tr> | ||
<tr class="info-attribute-row"> | ||
<th class="info-attribute-name">UT:Node version</th> | ||
<td class="info-attribute-value">{$page.data.frontend.node}</td> | ||
</tr> | ||
<tr class="info-attribute-row"> | ||
<th class="info-attribute-name">UT:Pnpm version</th> | ||
<td class="info-attribute-value">{$page.data.frontend.pnpm}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<style lang="scss"> | ||
table.platform-info { | ||
.info-attribute-name { | ||
text-align: left; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters