Add local and public QR sharing for training profiles

This commit is contained in:
larssand
2026-09-03 20:15:13 +02:00
parent 4f847610dc
commit 2d56b74731
15 changed files with 965 additions and 226 deletions

View File

@@ -570,6 +570,18 @@ const TRANSLATIONS = {
"training.public_profile_help": "Skapa en skrivskyddad mobilvy med den här förarens träningsstatistik, mål, belöningar och valbara träningstimer.",
"training.public_profile_private": "Länken innehåller en unik hemlig nyckel. Den visar inte transponder-ID, övriga förare eller adminfunktioner.",
"training.public_profile_link": "Personlig delningslänk",
"training.public_base_url": "Publik adress eller FQDN",
"training.public_base_url_hint": "Exempel: https://jmkrb.myddns.rocks. Lämna tomt för adressen där RaceCore öppnades.",
"training.save_public_url": "Spara adress",
"training.detect_public_ip": "Hämta publik IP",
"training.detecting_public_ip": "Kontrollerar publik IP...",
"training.detected_public_ip": "Publik IP hittades: {address}. Använd FQDN om certifikatet har ett domännamn och spara.",
"training.detect_public_ip_failed": "Kunde inte hämta publik IP. Fyll i FQDN manuellt.",
"training.public_url_invalid": "Ange en komplett http- eller https-adress.",
"training.local_profile_qr": "Lokal QR-kod",
"training.local_profile_qr_hint": "RaceCore-serverns LAN-adress",
"training.public_profile_qr": "Publik QR-kod",
"training.public_profile_qr_hint": "Lokal QR fungerar på samma nätverk. Publik QR använder sparad FQDN eller publik IP.",
"training.copy_link": "Kopiera länk",
"training.open_profile": "Öppna profil",
"training.replace_link": "Skapa ny länk",
@@ -1904,6 +1916,18 @@ const TRANSLATIONS = {
"training.public_profile_help": "Create a read-only mobile view with this driver's practice statistics, goals, rewards and configurable practice timer.",
"training.public_profile_private": "The link contains a unique secret key. It does not show transponder IDs, other drivers or admin controls.",
"training.public_profile_link": "Personal share link",
"training.public_base_url": "Public address or FQDN",
"training.public_base_url_hint": "Example: https://training.example.org. Leave empty to use the address where RaceCore was opened.",
"training.save_public_url": "Save address",
"training.detect_public_ip": "Detect public IP",
"training.detecting_public_ip": "Detecting public IP...",
"training.detected_public_ip": "Public IP found: {address}. Use the FQDN when the certificate has a domain name, then save.",
"training.detect_public_ip_failed": "Could not detect the public IP. Enter the FQDN manually.",
"training.public_url_invalid": "Enter a complete http or https address.",
"training.local_profile_qr": "Local QR code",
"training.local_profile_qr_hint": "RaceCore server LAN address",
"training.public_profile_qr": "Public QR code",
"training.public_profile_qr_hint": "The local QR works on the same network. The public QR uses the saved FQDN or public IP.",
"training.copy_link": "Copy link",
"training.open_profile": "Open profile",
"training.replace_link": "Create new link",
@@ -3357,6 +3381,8 @@ function seedDefaultData() {
state.settings.backendUrl = getDefaultBackendUrl();
}
state.settings.publicBaseUrl = String(state.settings.publicBaseUrl || "").trim().replace(/\/$/, "");
if (!state.settings.language) {
state.settings.language = DEFAULT_LANGUAGE;
}
@@ -3474,6 +3500,7 @@ function loadState() {
pitEntryWsUrl: String(parsed.settings?.pitEntryWsUrl || "ws://127.0.0.1:9002"),
pitExitWsUrl: String(parsed.settings?.pitExitWsUrl || "ws://127.0.0.1:9003"),
backendUrl: parsed.settings?.backendUrl || getDefaultBackendUrl(),
publicBaseUrl: String(parsed.settings?.publicBaseUrl || ""),
language: parsed.settings?.language || DEFAULT_LANGUAGE,
theme: AVAILABLE_THEMES.includes(String(parsed.settings?.theme || "").toLowerCase()) ? String(parsed.settings.theme).toLowerCase() : DEFAULT_THEME,
autoReconnect: parsed.settings?.autoReconnect !== false,
@@ -3540,6 +3567,7 @@ function loadState() {
pitEntryWsUrl: "ws://127.0.0.1:9002",
pitExitWsUrl: "ws://127.0.0.1:9003",
backendUrl: getDefaultBackendUrl(),
publicBaseUrl: "",
language: DEFAULT_LANGUAGE,
theme: DEFAULT_THEME,
autoReconnect: true,