feat: add software licenses
All checks were successful
TrafficCue CI / check (push) Successful in 56s
TrafficCue CI / build (push) Successful in 1m38s
TrafficCue CI / build-android (push) Successful in 14m57s

This commit is contained in:
2025-09-13 18:02:18 +02:00
parent 8c33ff7c88
commit 2c702c4588
8 changed files with 83 additions and 2 deletions

View File

@ -14,6 +14,10 @@ jobs:
- uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun i
- name: Get licenses
run: ./updateLicenses.sh
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- run: bun run build
- name: Upload build artifact
uses: actions/upload-artifact@v3
@ -51,6 +55,10 @@ jobs:
- uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun i
- name: Get licenses
run: ./updateLicenses.sh
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Setup Java
uses: actions/setup-java@v4
with:

3
.gitignore vendored
View File

@ -23,3 +23,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?
public/licenses.json
public/licenses/

View File

@ -52,7 +52,8 @@
"about": {
"header": "Über",
"powered-by": "Angetrieben von",
"contributors": "Mitwirkende"
"contributors": "Mitwirkende",
"licenses": "Open Source Lizenzen"
},
"developer": {
"header": "Entwicklereinstellungen"

View File

@ -52,7 +52,8 @@
"about": {
"header": "About",
"powered-by": "Powered by",
"contributors": "contributors"
"contributors": "contributors",
"licenses": "Open Source Licenses"
},
"developer": {
"header": "Developer Settings"

View File

@ -40,6 +40,7 @@
onboarding: "onboarding/OnboardingSidebar",
"onboarding-vehicles": "onboarding/OnboardingVehiclesSidebar",
"nearby-poi": "NearbyPOISidebar",
licenses: "settings/LicensesSidebar",
};
const fullscreen: Record<string, boolean> = {
@ -57,6 +58,7 @@
onboarding: true,
"onboarding-vehicles": true,
"nearby-poi": false,
licenses: true,
};
let isDragging = false;

View File

@ -1,7 +1,9 @@
<script>
import { m } from "$lang/messages";
import { ScaleIcon } from "@lucide/svelte";
import SidebarHeader from "../SidebarHeader.svelte";
import { getDeveloperToggle } from "./developer.svelte";
import SettingsButton from "./SettingsButton.svelte";
let count = 5;
const dev = getDeveloperToggle();
@ -33,3 +35,9 @@
<li>Photon</li>
<li>Overpass</li>
</ul>
<SettingsButton
icon={ScaleIcon}
text={m["sidebar.about.licenses"]()}
view="licenses"
/>

View File

@ -0,0 +1,54 @@
<script lang="ts">
import { onMount } from "svelte";
import SidebarHeader from "../SidebarHeader.svelte";
import { m } from "$lang/messages";
let licenses: License[] = $state([]);
let loading = $state(true);
interface License {
name: string;
licenseType: string;
link: string;
installedFrom?: string;
remoteVersion: string;
installedVersion: string;
definedVersion: string;
latestRemoteVersion?: string;
latestRemoteModified?: string;
author: string;
}
onMount(async () => {
const res = await fetch("/licenses.json");
licenses = await res.json();
loading = false;
});
</script>
<SidebarHeader>{m["sidebar.about.licenses"]()}</SidebarHeader>
{#if loading}
<p>Loading...</p>
{:else if licenses.length == 0}
<p>No licenses found.</p>
{:else}
<ul
style="display: flex; flex-direction: column; gap: 1em; padding: 0; list-style: none;"
>
{#each licenses as license (license.name)}
<li>
<strong>{license.name}</strong> - {license.installedVersion}
<p
style="white-space: pre-wrap; background: #0e0e0e; padding: 1em; border-radius: 0.5em; overflow-x: scroll;"
>
{#await fetch("/licenses/" + license.name + ".LICENSE.txt").then( (res) => res.text(), ) then text}
{text.startsWith("<!doctype html>") ? license.licenseType : text}
{:catch _error}
{license.licenseType}
{/await}
</p>
</li>
{/each}
</ul>
{/if}

4
updateLicenses.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
bunx license-report --output=json > public/licenses.json
rm -r public/licenses/
bunx license-downloader --source public/licenses.json --licDir public/licenses/ --download