From f22542bedf60498f79b669ddd68ee1435eb9c1cd Mon Sep 17 00:00:00 2001 From: Prabhaav Pillai Date: Wed, 18 Nov 2026 16:13:28 -0500 Subject: [PATCH] Update the app link to firestar link and also add wiki links galaxy wide --- openpilot/starpilot/galaxy/README.md | 15 ++++ .../galaxy/tests/test_app_reminder.mjs | 4 +- .../galaxy/tests/test_companion_update.mjs | 3 +- .../galaxy/tests/test_install_app.mjs | 7 +- .../starpilot/galaxy/tests/test_starport.mjs | 4 +- .../starpilot/galaxy/tests/test_wiki_help.mjs | 77 +++++++++++++++++++ openpilot/starpilot/galaxy/web/css/galaxy.css | 2 + .../starpilot/galaxy/web/js/app-downloads.js | 4 +- .../starpilot/galaxy/web/js/bluetooth.js | 5 +- openpilot/starpilot/galaxy/web/js/cameras.js | 5 +- .../galaxy/web/js/diagnostic-tools.js | 9 ++- openpilot/starpilot/galaxy/web/js/driving.js | 5 +- openpilot/starpilot/galaxy/web/js/flm.js | 5 +- openpilot/starpilot/galaxy/web/js/galaxy.js | 5 +- openpilot/starpilot/galaxy/web/js/home.js | 8 +- openpilot/starpilot/galaxy/web/js/logs.js | 14 ++-- .../galaxy/web/js/longitudinal-curves.js | 5 +- openpilot/starpilot/galaxy/web/js/models.js | 6 +- .../starpilot/galaxy/web/js/navigation.js | 5 +- openpilot/starpilot/galaxy/web/js/networks.js | 5 +- .../galaxy/web/js/onroad-layout-template.js | 2 +- .../starpilot/galaxy/web/js/onroad-layout.js | 3 +- openpilot/starpilot/galaxy/web/js/pip.js | 5 +- .../starpilot/galaxy/web/js/record-history.js | 5 +- openpilot/starpilot/galaxy/web/js/sentry.js | 5 +- .../galaxy/web/js/settings-recovery.js | 5 +- openpilot/starpilot/galaxy/web/js/settings.js | 9 ++- .../galaxy/web/js/software-status.js | 5 +- openpilot/starpilot/galaxy/web/js/spotify.js | 7 +- openpilot/starpilot/galaxy/web/js/starport.js | 10 +-- .../starpilot/galaxy/web/js/system-monitor.js | 5 +- openpilot/starpilot/galaxy/web/js/tools.js | 5 +- openpilot/starpilot/galaxy/web/js/vasm.js | 5 +- .../starpilot/galaxy/web/js/wiki-help.js | 9 +++ .../starpilot/galaxy/web/js/wiki-links.js | 71 +++++++++++++++++ 35 files changed, 271 insertions(+), 73 deletions(-) create mode 100644 openpilot/starpilot/galaxy/tests/test_wiki_help.mjs create mode 100644 openpilot/starpilot/galaxy/web/js/wiki-help.js create mode 100644 openpilot/starpilot/galaxy/web/js/wiki-links.js diff --git a/openpilot/starpilot/galaxy/README.md b/openpilot/starpilot/galaxy/README.md index a827725453..3137067b89 100644 --- a/openpilot/starpilot/galaxy/README.md +++ b/openpilot/starpilot/galaxy/README.md @@ -33,6 +33,21 @@ it labels its sample System Monitor data and cannot edit a device. StarPort log uploads use the built-in developer Discord webhook. +## Wiki help links + +Maintain wiki destinations in `web/js/wiki-links.js`: `WIKI_LINKS` uses Galaxy routes, +and `SETTINGS_WIKI_LINKS` uses settings API page IDs because toggles also navigate +without changing the URL. Values are paths relative to `https://wiki.firestar.link/`, +including optional section anchors. Only add destinations with substantial guidance for +that feature, rather than brief overview mentions. Routes match explicitly; nested settings +can inherit their mapped settings parent. Driving settings reuse the settings page mappings. +Unmapped routes and settings pages hide the link without falling back to a generic guide. + +Existing page headers use the shared `` book link. For a new page, register +`WikiHelp` from `./wiki-help.js`, place it after the title/description in the page header, +and add its destination to the mapping. Settings pass their active page ID with `:page`. +No docs build, sync, or network lookup is required; update this file when a wiki URL changes. + ## Pages and owners | Page | Current source and operations | diff --git a/openpilot/starpilot/galaxy/tests/test_app_reminder.mjs b/openpilot/starpilot/galaxy/tests/test_app_reminder.mjs index 96db7c0296..5300ac04d9 100644 --- a/openpilot/starpilot/galaxy/tests/test_app_reminder.mjs +++ b/openpilot/starpilot/galaxy/tests/test_app_reminder.mjs @@ -1,5 +1,6 @@ import assert from 'node:assert/strict' import { readFileSync } from 'node:fs' +import { APP_DOWNLOADS as downloads } from '../web/js/app-downloads.js' import { appDownloadPlatform, APP_DOWNLOADS, appReminderPreference, reminderHidden, reminderDismissed, HIDE_APP_REMINDER, DISMISSED_APP_REMINDER, AppDownloadReminder } from '../web/js/app-reminder.js' @@ -14,8 +15,7 @@ for (const userAgent of ['Macintosh Safari', 'Windows Chrome', 'Linux x86_64 Fir assert.equal(appDownloadPlatform({ ...android, StarPilotApp: {} }), null) assert.equal(appDownloadPlatform({ ...iphone, webkit: { messageHandlers: { galaxyDiagnostics: {} } } }), null) assert.equal(appDownloadPlatform({ ...iphone, webkit: {} }), 'ios', 'Safari itself must not be mistaken for the native app') -assert.equal(APP_DOWNLOADS.ios.href, 'https://apps.apple.com/ca/app/starpilot-bt/id6821039119') -assert.equal(APP_DOWNLOADS.android.href, 'https://play.google.com/store/apps/details?id=com.starpilot.galaxy') +assert.equal(APP_DOWNLOADS, downloads, 'Reminders use the shared store metadata') const values = new Map() const target = { localStorage: { getItem: k => values.get(k), setItem: (k, v) => values.set(k, v) }, sessionStorage: { getItem: k => values.get(k), setItem: (k, v) => values.set(k, v) } } diff --git a/openpilot/starpilot/galaxy/tests/test_companion_update.mjs b/openpilot/starpilot/galaxy/tests/test_companion_update.mjs index cbc90a45d3..e6c258c6d0 100644 --- a/openpilot/starpilot/galaxy/tests/test_companion_update.mjs +++ b/openpilot/starpilot/galaxy/tests/test_companion_update.mjs @@ -1,4 +1,5 @@ import assert from 'node:assert/strict' +import { APP_DOWNLOADS } from '../web/js/app-downloads.js' import { createRenderer, nextTick } from '../web/vendor/vue/vue.esm-browser.js' import { CompanionUpdates, newerCompanionVersion } from '../web/js/companion-updates.js' @@ -48,7 +49,7 @@ let mounted = await mount() try { assert.ok(banner(mounted.host)) assert.match(text(mounted.host), /Version 1.1.5 is available.*Installed: 1.1.4/s) - assert.ok(all(mounted.host).some(item => item.type === 'a' && item.props.href === 'https://play.google.com/store/apps/details?id=com.starpilot.galaxy')) + assert.ok(all(mounted.host).some(item => item.type === 'a' && item.props.href === APP_DOWNLOADS.android.href)) mounted.vm.dismissUpdate() await nextTick() assert.equal(banner(mounted.host), undefined) diff --git a/openpilot/starpilot/galaxy/tests/test_install_app.mjs b/openpilot/starpilot/galaxy/tests/test_install_app.mjs index 622bed9c63..5030c01ddf 100644 --- a/openpilot/starpilot/galaxy/tests/test_install_app.mjs +++ b/openpilot/starpilot/galaxy/tests/test_install_app.mjs @@ -1,10 +1,10 @@ import { APP_DOWNLOADS, AppStoreLinks } from '../web/js/app-downloads.js' import assert from 'node:assert/strict' +import { readFileSync } from 'node:fs' import { installHelp, InstallApp, rememberInstallPrompt, isIosDevice, isAndroidDevice } from '../web/js/install-app.js' assert.match(installHelp({ secure: true, agent: 'iPhone' }), /Share.*Add to Home Screen/) assert.match(installHelp({ secure: false, agent: 'Android' }), /web app.*https:\/\/galaxy\.firestar\.link/) assert.match(installHelp({ secure: true, agent: 'Android' }), /Install app/) -assert.equal(APP_DOWNLOADS.android.href, 'https://play.google.com/store/apps/details?id=com.starpilot.galaxy') assert.match(installHelp({ secure: true, agent: 'Chrome' }), /Install app/) const events = new Map() let modeListener @@ -46,7 +46,10 @@ assert.equal(prompted, 2) InstallApp.beforeUnmount.call(late) // Store metadata lives outside the web installer. -assert.equal(APP_DOWNLOADS.ios.href, 'https://apps.apple.com/ca/app/starpilot-bt/id6821039119') +const readme = readFileSync(new URL('../../../../README.md', import.meta.url), 'utf8') +for (const app of Object.values(APP_DOWNLOADS)) { + assert.ok(readme.includes(`](${app.href})`), `${app.label} download must match the README`) +} assert.match(AppStoreLinks.template, /app.href/) assert.doesNotMatch(InstallApp.template, /Google Play|App Store|offline app|app\.apk/) const android = { ...InstallApp.data() } diff --git a/openpilot/starpilot/galaxy/tests/test_starport.mjs b/openpilot/starpilot/galaxy/tests/test_starport.mjs index 8efd5b91d3..6f24c59610 100644 --- a/openpilot/starpilot/galaxy/tests/test_starport.mjs +++ b/openpilot/starpilot/galaxy/tests/test_starport.mjs @@ -22,7 +22,7 @@ assert.match(StarPortPage.template, /Cancel Search \/ Pairing/) assert.equal(StarPortPage.computed.deviceChosen.call({ pairing: { ...pairing, state: "pairing" } }), true) assert.equal(StarPortPage.computed.deviceChosen.call({ pairing: { ...pairing, state: "failed" } }), false) assert.doesNotMatch(StarPortPage.template, /:row="wiredRow"/) -assert.match(StarPortPage.template, /Read the Android Auto troubleshooting guide/) +assert.match(StarPortPage.template, //) assert.doesNotMatch(StarPortPage.template, /v-html|autoaccept/i) const app = readFileSync(new URL("../web/js/app.js", import.meta.url), "utf8") assert.match(app, /StarPortPage v-else-if="route\.path === '\/starport'"/) @@ -228,7 +228,7 @@ assert.equal(uploadCalls.length, beforeDeniedEnable, "failed enable never upload console.log("Android Auto: APK/XAPK/APKM uploads in either road state, enable/upload sequencing, explicit blockers and feed boundaries passed") assert.match(StarPortPage.template, /]*:inert="busy"[^>]*:aria-busy="busy \|\| undefined"/) assert.match(StarPortPage.template, /@click="openInstall">Update/) -assert.match(StarPortPage.template, /
/) +assert.match(StarPortPage.template, /
/) const removePage = page({ ...setup, enabled: false, parked: false }) removePage.runtime = { running: true } removePage.feed = { async removePackage() { return true } } diff --git a/openpilot/starpilot/galaxy/tests/test_wiki_help.mjs b/openpilot/starpilot/galaxy/tests/test_wiki_help.mjs new file mode 100644 index 0000000000..dc5304ee9f --- /dev/null +++ b/openpilot/starpilot/galaxy/tests/test_wiki_help.mjs @@ -0,0 +1,77 @@ +import assert from 'node:assert/strict' +import { readFileSync } from 'node:fs' +import { compile, createRenderer, nextTick } from '../web/vendor/vue/vue.esm-browser.js' +import { route } from '../web/js/route-state.js' +import { WikiHelp } from '../web/js/wiki-help.js' +import { wikiLink } from '../web/js/wiki-links.js' + +assert.equal(wikiLink('/manage_models'), 'https://wiki.firestar.link/usage/model-manager/') +assert.equal(wikiLink('/navigation/maps'), 'https://wiki.firestar.link/exclusive/navigation/#offline-maps') +assert.equal(wikiLink('/settings', 'slc'), wikiLink('/driving/slc')) +assert.match(wikiLink('/settings', 'torque/developer'), /#lateral-tuning$/) +assert.match(wikiLink('/settings', 'conditional/conditions'), /#conditional-experimental-mode-recommended$/) +for (const path of ['/', '/tools', '/theme_maker', '/theme_maker/starport', '/appearance', '/logs', '/logs/help', '/networks', '/recordings', '/tuning/plots', '/driving/traffic']) { + assert.equal(wikiLink(path), null, `${path} has no substantial feature guide`) +} +for (const page of ['visual', 'display', 'vehicle', 'data', 'traffic', 'unknown']) { + assert.equal(wikiLink('/settings', page), null, `${page} must not fall back to the Toggles overview`) +} +assert.equal(wikiLink('/navigation-other'), null, 'Do not match partial path segments') +assert.equal(wikiLink('/undocumented'), null) + +const node = (type = '') => ({ type, props: {}, children: [] }) +const renderer = createRenderer({ + createElement: node, createText: () => node(), createComment: () => node(), + setText() {}, setElementText() {}, + patchProp: (item, key, _before, value) => { item.props[key] = value }, + insert: (item, parent) => { item.parent = parent; parent.children.push(item) }, + remove: item => { item.parent.children.splice(item.parent.children.indexOf(item), 1) }, + parentNode: item => item.parent, nextSibling: () => null, +}) +route.path = '/manage_models' +const host = node('host') +const app = renderer.createApp(WikiHelp) +app.mount(host) +try { + let link = host.children.find(item => item.type === 'a') + assert.equal(link.props.href, wikiLink('/manage_models')) + assert.equal(link.props.target, '_blank') + assert.equal(link.props.rel, 'noopener noreferrer') + assert.match(link.props['aria-label'], /wiki guide.*new tab/) + route.path = '/navigation/maps' + await nextTick() + assert.equal(link.props.href, wikiLink('/navigation/maps'), 'Help follows route changes') + route.path = '/undocumented' + await nextTick() + assert.equal(host.children.some(item => item.type === 'a'), false, 'Hide absent guides') +} finally { app.unmount() } + +route.path = '/settings' +const nestedHost = node('host') +const nestedApp = renderer.createApp({ + components: { WikiHelp }, data: () => ({ page: 'slc' }), template: '', +}) +const settings = nestedApp.mount(nestedHost) +try { + const link = nestedHost.children.find(item => item.type === 'a') + assert.equal(link.props.href, wikiLink('/settings', 'slc')) + settings.page = 'aol' + await nextTick() + assert.equal(link.props.href, wikiLink('/settings', 'aol'), 'Nested toggles update without URL changes') + settings.page = 'display' + await nextTick() + assert.equal(nestedHost.children.some(item => item.type === 'a'), false, 'Overview-only toggles hide help') +} finally { nestedApp.unmount() } + +// Compile the changed page templates to catch invalid nesting or Vue directives. +for (const name of ['models', 'settings', 'navigation', 'starport', 'spotify', 'bluetooth', 'cameras', + 'home', 'system-monitor', 'sentry', 'vasm', 'pip', 'galaxy', 'networks', 'tools', 'logs', 'software-status', 'driving', + 'longitudinal-curves', 'flm', 'record-history', 'onroad-layout-template', 'settings-recovery', 'diagnostic-tools']) { + const source = readFileSync(new URL(`../web/js/${name}.js`, import.meta.url), 'utf8') + const templates = [...source.matchAll(/(?:template:\s*|ONROAD_LAYOUT_TEMPLATE = )`([\s\S]*?)`/g)] + assert.ok(templates.length, `${name} has a template`) + for (const [, template] of templates) { + compile(template, { decodeEntities: raw => raw, onError: error => { throw new Error(`${name}: ${error.message}`) } }) + } +} +console.log('Wiki help: mapping, nested settings, reactive navigation, accessibility and page templates passed') diff --git a/openpilot/starpilot/galaxy/web/css/galaxy.css b/openpilot/starpilot/galaxy/web/css/galaxy.css index 16181fd788..8a8303bd03 100644 --- a/openpilot/starpilot/galaxy/web/css/galaxy.css +++ b/openpilot/starpilot/galaxy/web/css/galaxy.css @@ -421,6 +421,8 @@ transition: background-color var(--motion-fast), transform var(--motion-fast); width: var(--touch-target); } .gx-icon-btn:hover { background: var(--glass-bg-hover); } +.gx-home__hero.gx-page-header { flex-direction: row; } +.gx-icon-btn.gx-wiki-help { flex: none; color: var(--on-surface-variant); text-decoration: none; } .gx-icon-btn:active { transform: scale(0.9); } .gx-icon-btn i, .gx-appbar .bi, diff --git a/openpilot/starpilot/galaxy/web/js/app-downloads.js b/openpilot/starpilot/galaxy/web/js/app-downloads.js index 6f595f0d11..ce27bb9b97 100644 --- a/openpilot/starpilot/galaxy/web/js/app-downloads.js +++ b/openpilot/starpilot/galaxy/web/js/app-downloads.js @@ -1,7 +1,7 @@ // Canonical store metadata shared by download links and reminders. export const APP_DOWNLOADS = Object.freeze({ - ios: Object.freeze({ href: 'https://apps.apple.com/ca/app/starpilot-bt/id6821039119', label: 'App Store', icon: 'bi-apple', name: 'StarPilot BT for iPhone' }), - android: Object.freeze({ href: 'https://play.google.com/store/apps/details?id=com.starpilot.galaxy', label: 'Google Play', icon: 'bi-google-play', name: 'Galaxy for Android' }), + ios: Object.freeze({ href: 'https://firestar.link/ios', label: 'App Store', icon: 'bi-apple', name: 'StarPilot BT for iPhone' }), + android: Object.freeze({ href: 'https://firestar.link/android', label: 'Google Play', icon: 'bi-google-play', name: 'Galaxy for Android' }), }) export const AppStoreLinks = { diff --git a/openpilot/starpilot/galaxy/web/js/bluetooth.js b/openpilot/starpilot/galaxy/web/js/bluetooth.js index aa3a61096d..6625c5ff80 100644 --- a/openpilot/starpilot/galaxy/web/js/bluetooth.js +++ b/openpilot/starpilot/galaxy/web/js/bluetooth.js @@ -1,3 +1,4 @@ +import { WikiHelp } from './wiki-help.js' import { GxState } from "./state.js" import { GxNotice } from "./notice.js" import { reportSave } from "./save-feedback.js" @@ -166,7 +167,7 @@ export class BluetoothFeed { } export const BluetoothPage = { - components: { GxState, GxNotice, ControllersPage, GxDialog }, + components: { WikiHelp, GxState, GxNotice, ControllersPage, GxDialog }, props: { mode: { type: String, required: true }, unauthorized: { type: Function, required: true } }, data: () => ({ status: null, busy: false, error: "", pairValue: "", now: Date.now(), claimAt: Date.now(), forgetting: null }), mounted() { @@ -212,7 +213,7 @@ export const BluetoothPage = { template: `

Bluetooth

-

View, pair and manage nearby and saved devices.

+

View, pair and manage nearby and saved devices.

Bluetooth requires the device. No radio was checked in preview. `, } export const TmuxPage = { - components: { GxState, GxIconButton, GxNotice }, props, ...lifecycle, + components: { WikiHelp, GxState, GxIconButton, GxNotice }, props, ...lifecycle, setup: props => setup(props, true), methods, template: `

tmux Live View

-

Live view of the launcher console, refreshed every few seconds.

+

Live view of the launcher console, refreshed every few seconds.

Loading console…{{ state.error }}{{ state.notice }}

{{ state.data.reason }}

{{ state.data.text }}
diff --git a/openpilot/starpilot/galaxy/web/js/driving.js b/openpilot/starpilot/galaxy/web/js/driving.js index 1cb2c3b493..0ba20ec99c 100644 --- a/openpilot/starpilot/galaxy/web/js/driving.js +++ b/openpilot/starpilot/galaxy/web/js/driving.js @@ -1,3 +1,4 @@ +import { WikiHelp } from './wiki-help.js' import { GxState } from "./state.js" import { MenuTile } from "./menu-tile.js" export const DRIVING_PAGES = Object.freeze({ @@ -34,13 +35,13 @@ export function drivingPage(path) { } export const DrivingPage = { - components: { GxState, MenuTile }, + components: { WikiHelp, GxState, MenuTile }, props: { mode: { type: String, required: true }, go: { type: Function, required: true } }, data: () => ({ groups: DRIVING_GROUPS }), template: `

Driving Settings

-

Choose how StarPilot steers and controls speed.

+

Choose how StarPilot steers and controls speed.

Local driving settings are unavailable in preview.