Modularize Galaxy access setup, centralize app links and step styles, and unify disclosure transitions with shared height animations

This commit is contained in:
Prabhaav Pillai
2026-11-17 03:12:57 -05:00
parent b39e1abbf7
commit f4bf190e7c
36 changed files with 806 additions and 598 deletions
+1
View File
@@ -0,0 +1 @@
{"flmUxBrowser":{"checks":[],"failure":"Error: FLM browser check deadline exceeded\nError: spawn chromedriver ENOENT\n at ChildProcess._handle.onexit (node:internal/child_process:285:19)\n at onErrorNT (node:internal/child_process:483:16)\n at process.processTicksAndRejections (node:internal/process/task_queues:82:21)\n at until (file:///home/prabh/Projects/openpilot/openpilot/starpilot/galaxy/tests/test_flm_ux_browser.mjs:177:9)\n at async file:///home/prabh/Projects/openpilot/openpilot/starpilot/galaxy/tests/test_flm_ux_browser.mjs:254:3","screenshots":[],"cleanup":{"driver_exit_code":-2,"driver_signal":null,"driver_reaped":true,"server_closed":true}}}
@@ -51,7 +51,7 @@ const assert = require('node:assert/strict')
for (const width of [320, 360, 390, 600, 1280]) {
await page.setViewportSize({ width, height: 900 })
await mount('starport')
await checkActions('.gx-starport-step-card__body, .gx-starport-sheet__toolbar')
await checkActions('.gx-step-card__body, .gx-starport-sheet__toolbar')
await page.getByRole('button', { name: 'Turn On and Install', exact: true }).click()
assert.equal(await page.evaluate(() => window.uploadClicks), 1)
await page.evaluate(() => { window.fixtureVM.setup.enabled = true })
@@ -61,7 +61,7 @@ const assert = require('node:assert/strict')
await page.evaluate(() => { window.fixtureVM.busy = true; window.fixtureVM.uploadProgress = { loaded: 1, total: 2 } })
assert.equal(await page.getByRole('progressbar', { name: 'Sending to your comma' }).isVisible(), true)
assert.equal(await page.getByLabel('Android Auto APK, XAPK, APKM, or ZIP', { exact: true }).isDisabled(), true)
await checkActions('.gx-starport-step-card__body, .gx-starport-sheet__toolbar')
await checkActions('.gx-step-card__body, .gx-starport-sheet__toolbar')
await mount('recording')
await checkActions('.gx-route-workspace__toolbar, .gx-route-workspace__download-actions')
@@ -28,7 +28,7 @@ const assert = require('node:assert/strict')
window.fixture = createApp({ components: { software, GxState, GxNotice, GxDialog, GxSummary },
data: () => ({ dialog: false }),
template: `<software mode="local" :unauthorized="() => {}" /><div class="gx-card-grid"><section class="gx-card gx-panel">Card</section><section class="gx-card gx-panel">Card</section></div>
<div class="gx-home__totals"><section class="gx-card"><h2>Time on the Road</h2><p>Saved history</p></section></div><section class="gx-card gx-starport-step"><h2>Android Auto</h2><p>Connect your car</p></section><GxSummary :items="[{label: 'Installed', value: 1}, {label: 'Missing', value: 0}, {label: 'Total', value: 1}]" /><GxState loading>Reading your device…</GxState><GxState>Nothing here yet.</GxState>
<div class="gx-home__totals"><section class="gx-card"><h2>Time on the Road</h2><p>Saved history</p></section></div><section class="gx-card gx-step"><h2>Android Auto</h2><p>Connect your car</p></section><GxSummary :items="[{label: 'Installed', value: 1}, {label: 'Missing', value: 0}, {label: 'Total', value: 1}]" /><GxState loading>Reading your device…</GxState><GxState>Nothing here yet.</GxState>
<GxNotice tone="success" title="Saved">Preferences saved.</GxNotice><GxNotice tone="danger">An error occurred.</GxNotice>
<div class="gx-tabs"><button class="gx-btn" aria-pressed="true">Selected</button><button class="gx-btn gx-btn--tonal">Other</button></div>
<button class="gx-btn" @click="dialog=true">Open dialog</button>
@@ -58,7 +58,7 @@ const assert = require('node:assert/strict')
const summary = await page.locator('.gx-summary > div').evaluateAll(elements => elements.map(element => element.getBoundingClientRect().top))
assert.ok(summary.every(top => Math.abs(top - summary[0]) < 1), 'summary counts share one row')
assert.ok(Math.abs(geometry.notice - geometry.container) < 1 && geometry.aligned, 'progress fills the padded panel with the track below its label')
for (const selector of ['.gx-panel', '.gx-message', '.gx-home__totals > section', '.gx-starport-step']) {
for (const selector of ['.gx-panel', '.gx-message', '.gx-home__totals > section', '.gx-step']) {
const padding = await page.locator(selector).first().evaluate(element => { const style = getComputedStyle(element); return [parseFloat(style.paddingLeft), parseFloat(style.paddingRight), parseFloat(style.paddingTop), parseFloat(style.paddingBottom)] })
assert.ok(padding[0] >= 16 && padding[1] >= 16, `${selector}: horizontal padding survives all themes and widths`)
assert.ok(padding[2] >= 16 && padding[3] >= 16, `${selector}: vertical padding`)
@@ -0,0 +1,107 @@
const { chromium } = require(process.env.PLAYWRIGHT_MODULE || 'playwright')
const { readFileSync } = require('node:fs')
const path = require('node:path')
const assert = require('node:assert/strict')
const web = path.resolve(__dirname, '../../web')
const reviewMarkup = readFileSync(path.join(web, 'js/flm.js'), 'utf8').match(/<div class="gx-tuner__drive-mark"[^]*?<\/div>/)[0]
const reviewIcons = [...reviewMarkup.matchAll(/'(bi-[\w-]+)'/g)].map(match => match[1])
const iconCss = readFileSync(path.join(web, 'vendor/bootstrap-icons/bootstrap-icons.min.css'), 'utf8')
for (const icon of reviewIcons) assert.ok(iconCss.includes('.' + icon + '::before'), `${icon} must exist in the bundled font`)
;(async () => {
const browser = await chromium.launch({ headless: true,
...(process.env.PLAYWRIGHT_EXECUTABLE_PATH ? { executablePath: process.env.PLAYWRIGHT_EXECUTABLE_PATH } : {}) })
try {
const page = await browser.newPage({ viewport: { width: 390, height: 844 } })
const errors = []
page.on('pageerror', error => errors.push(error.message))
await page.route('http://motion.test/**', route => {
const pathname = new URL(route.request().url()).pathname
if (pathname === '/') return route.fulfill({ contentType: 'text/html', body: `<!doctype html><html><head>
<link rel="stylesheet" href="/css/galaxy.css"><link rel="stylesheet" href="/css/settings.css"><link rel="stylesheet" href="/css/flm.css">
<link rel="stylesheet" href="/vendor/bootstrap-icons/bootstrap-icons.min.css"></head>
<body><i id="review-icon" class="bi ${reviewIcons.at(-1)}" aria-hidden="true"></i><main id="fixture" style="padding:24px"></main><script type="module">
import {createApp} from '/vendor/vue/vue.esm-browser.js'
import {GalaxySelect} from '/js/galaxy-select.js'
import {installDisclosureMotion, GxCollapse} from '/js/disclosure.js'
installDisclosureMotion()
import {RouteCleanup} from '/js/route-cleanup.js'
createApp({components:{GalaxySelect,RouteCleanup,GxCollapse},data:()=>({choice:'one',expanded:false}),template:
'<GalaxySelect v-model="choice" aria-label="Example"><option value="one">One</option><option value="two">Two</option></GalaxySelect><div class="gx-tuner"><details id="example" class="gx-card gx-tuner__section gx-tuner__disclosure"><summary>Diagnostics &amp; source details</summary><p style="height:120px">Details content</p><details><summary>Nested</summary><p>Nested content</p></details></details></div><button id="panel-toggle" @click="expanded=!expanded">Panel</button><GxCollapse><div v-show="expanded" id="panel" class="gx-card gx-panel"><p style="height:100px">Custom panel</p></div></GxCollapse><RouteCleanup :unauthorized="()=>{}" />'
}).mount('#fixture')
</script></body></html>` })
const file = path.join(web, pathname)
const ext = path.extname(file)
return route.fulfill({ body: readFileSync(file), contentType: ({ '.js': 'text/javascript', '.css': 'text/css', '.woff2': 'font/woff2' })[ext] || 'application/octet-stream' })
})
await page.goto('http://motion.test/')
await page.locator('details#example > summary').waitFor()
assert.notEqual(await page.locator('#review-icon').evaluate(node => getComputedStyle(node, '::before').content), 'none')
// All native disclosures use the same CSS, including late-rendered content.
const details = page.locator('#example')
const closedHeight = await details.evaluate(node => node.getBoundingClientRect().height)
await details.locator(':scope > summary').click()
await page.waitForTimeout(30)
assert.ok(await details.evaluate(node => node.getAnimations().length > 0), 'Outer card animates open')
const openingHeight = await details.evaluate(node => node.getBoundingClientRect().height)
await page.waitForTimeout(280)
const openHeight = await details.evaluate(node => node.getBoundingClientRect().height)
assert.ok(openHeight > closedHeight + 100)
assert.ok(openingHeight > closedHeight && openingHeight < openHeight, 'Border height expands gradually')
await details.locator(':scope > summary').click()
await page.waitForTimeout(30)
assert.ok(await details.evaluate(node => node.getAnimations().length > 0), 'Outer card animates closed')
const closingHeight = await details.evaluate(node => node.getBoundingClientRect().height)
assert.ok(closingHeight > closedHeight && closingHeight < openHeight, 'Border height collapses gradually')
await page.waitForTimeout(280)
assert.ok(Math.abs(await details.evaluate(node => node.getBoundingClientRect().height) - closedHeight) < 1)
// Real shared select keeps keyboard selection and focus restoration.
const button = page.locator('button[aria-haspopup="listbox"]')
await button.click()
const menu = page.locator('.gx-select-menu')
assert.ok(await menu.evaluate(node => node.getAnimations().length > 0), 'Menu animates open')
await page.waitForTimeout(280)
await page.getByRole('option', { name: 'Two' }).click()
assert.ok(await menu.evaluate(node => node.getAnimations().length > 0), 'Menu animates closed')
await page.waitForTimeout(280)
assert.equal(await button.getAttribute('aria-expanded'), 'false')
assert.equal(await button.evaluate(node => node === document.activeElement), true)
assert.match(await button.textContent(), /Two/)
// Reversing an in-flight transition must settle in the final native state.
await details.locator(':scope > summary').click()
await details.locator(':scope > summary').click()
await page.waitForTimeout(280)
assert.equal(await details.getAttribute('open'), null)
await page.locator('#panel-toggle').click()
assert.ok(await page.locator('#panel').evaluate(node => node.getAnimations().length > 0), 'Vue panels share the height animation')
await page.waitForTimeout(280)
await page.locator('#panel-toggle').click()
assert.ok(await page.locator('#panel').evaluate(node => node.getAnimations().length > 0), 'Vue panels animate closed')
await page.waitForTimeout(280)
assert.equal(await page.locator('#panel').evaluate(node => getComputedStyle(node).display), 'none')
// No per-page registration is needed for disclosures rendered after startup.
await page.evaluate(() => {
const dynamic = document.createElement('details')
dynamic.id = 'dynamic'
dynamic.innerHTML = '<summary>Later disclosure</summary><p style="height:80px">Dynamic content</p>'
document.querySelector('main').append(dynamic)
})
await page.locator('#dynamic > summary').click()
assert.ok(await page.locator('#dynamic').evaluate(node => node.getAnimations().length > 0))
await page.waitForTimeout(280)
const danger = page.getByRole('button', { name: 'Delete all driving routes' })
assert.equal(await danger.evaluate(node => getComputedStyle(node).backgroundColor), await danger.evaluate(node => {
const probe = document.createElement('span'); probe.style.color = 'var(--error)'; node.append(probe)
const color = getComputedStyle(probe).color; probe.remove(); return color
}))
await page.emulateMedia({ reducedMotion: 'reduce' })
await details.locator(':scope > summary').click()
assert.equal(await details.evaluate(node => node.getAnimations().length), 0)
await button.click()
assert.equal(await menu.evaluate(node => node.getAnimations().length), 0)
await page.keyboard.press('Escape')
assert.equal(await button.evaluate(node => node === document.activeElement), true)
assert.deepEqual(errors, [])
console.log('Shared disclosure/menu motion, reversal, reduced motion, keyboard focus and danger contrast passed')
} finally { await browser.close() }
})().catch(error => { console.error(error); process.exitCode = 1 })
@@ -14,8 +14,8 @@ 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://firestar.link/iOS')
assert.equal(APP_DOWNLOADS.android.href, 'https://firestar.link/android')
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')
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) } }
@@ -8,7 +8,6 @@ import { VasmPage } from '../web/js/vasm.js'
import { NavigationPage } from '../web/js/navigation.js'
import { OfflineRoadMapsPanel } from '../web/js/offline-road-maps.js'
import { StarPortPage } from '../web/js/starport.js'
import { GalaxyCompanion } from '../web/js/companion.js'
globalThis.window = {}
assert.equal(bluetoothConnection(), false)
@@ -105,7 +104,6 @@ aa.uploadReason = StarPortPage.computed.uploadReason.call(aa)
assert.match(aa.uploadReason, /not available over Bluetooth/)
await StarPortPage.methods.upload.call(aa)
assert.equal(uploaded, 0)
await GalaxyCompanion.methods.toggle.call({ bluetooth: true })
assert.equal(requests, 0)
window.StarPilotApp.bluetooth = () => false
@@ -1,14 +1,14 @@
import assert from 'node:assert/strict'
import { compile } from '../web/vendor/vue/vue.esm-browser.js'
import { GalaxyCompanion, validCompanion } from '../web/js/companion.js'
import { CompanionUpdates, validCompanion } from '../web/js/companion-updates.js'
globalThis.window = {}
const value = { protocol: 1, enabled: false, connected: false, active: false, appAvailable: true, updateAvailable: false,
bytes: 0, shippedVersion: '1.0.0', state: 'disabled' }
assert.equal(validCompanion(value), true)
assert.equal(validCompanion({ ...value, bytes: -1 }), false)
compile(GalaxyCompanion.template, { decodeEntities: v => v })
const vm = { ...GalaxyCompanion.data(), mode: 'sample', unauthorized() {}, $emit() {} }
for (const [key, fn] of Object.entries(GalaxyCompanion.methods)) vm[key] = fn.bind(vm)
compile(CompanionUpdates.template, { decodeEntities: v => v })
const vm = { ...CompanionUpdates.data(), mode: 'sample', eligible: true, unauthorized() {}, $emit() {} }
for (const [key, fn] of Object.entries(CompanionUpdates.methods)) vm[key] = fn.bind(vm)
let requests = 0, resolve
globalThis.fetch = () => { requests++; return new Promise(done => { resolve = done }) }
vm.start()
@@ -1,24 +1,21 @@
import assert from 'node:assert/strict'
import { createRenderer, nextTick } from '../web/vendor/vue/vue.esm-browser.js'
import { GalaxyPage } from '../web/js/galaxy.js'
import { newerCompanionVersion } from '../web/js/companion.js'
import { CompanionUpdates, newerCompanionVersion } from '../web/js/companion-updates.js'
assert.equal(newerCompanionVersion('1.1.5', '1.1.4'), true)
assert.equal(newerCompanionVersion('1.1.10', '1.1.9'), true)
assert.equal(newerCompanionVersion('1.2', '1.1.99'), true)
for (const [available, installed] of [['1.1.5', '1.1.5'], ['1.1.4', '1.1.5'], ['1.1', '1.1.0'],
['', '1.1.4'], ['1.1.5', ''], ['unknown', '1.1.4'], ['1.1.5', null]]) {
for (const [available, installed] of [['1.1.5', '1.1.5'], ['1.1.4', '1.1.5'], ['1.1', '1.1.0'], ['', '1.1.4'], ['1.1.5', ''], ['unknown', '1.1.4']]) {
assert.equal(newerCompanionVersion(available, installed), false)
}
const storage = new Map()
globalThis.localStorage = { getItem: key => storage.get(key) ?? null, setItem: (key, value) => storage.set(key, value) }
globalThis.window = { StarPilotApp: { version: () => '1.1.4', uplinkState: () => '{}' } }
globalThis.window = { StarPilotApp: { version: () => '1.1.4' } }
globalThis.document = { activeElement: null }
Object.defineProperty(globalThis, 'navigator', { configurable: true, value: { userAgent: 'Android' } })
const status = { protocol: 1, enabled: false, connected: false, active: false, appAvailable: true, updateAvailable: false,
bytes: 0, shippedVersion: '1.1.5', version: null, state: 'disabled' }
globalThis.fetch = async url => ({ ok: true, json: async () => url.includes('/api/companion/status') ? status : { paired: false } })
let requests = 0, installs = 0
globalThis.fetch = async () => { requests++; return { ok: true, json: async () => status } }
const node = (type, text = '') => ({ type, text, props: {}, children: [], parent: null,
addEventListener() {}, removeEventListener() {} })
const renderer = createRenderer({
@@ -40,91 +37,45 @@ const text = item => [item.text, ...item.children.map(text)].join(' ')
const banner = host => all(host).find(item => item.type === 'div' && text(item).includes('Android app update available') && item.props.role === 'status')
async function mount() {
const host = node('host')
const app = renderer.createApp({ ...GalaxyPage,
// The real companion child still polls and emits metadata to the real page.
components: { ...GalaxyPage.components, GalaxyHotspot: { template: '<div />' }, InstallApp: { props: ['updateAvailable'], template: '<div class="install-state">{{ updateAvailable }}</div>' } },
}, { mode: 'local', unauthorized() { assert.fail('Unexpected authentication failure') } })
app.config.compilerOptions.decodeEntities = raw => raw.replaceAll('&amp;', '&')
const app = renderer.createApp(CompanionUpdates, { mode: 'local', unauthorized() { assert.fail('Unexpected authentication failure') } })
app.config.compilerOptions.decodeEntities = raw => raw
const vm = app.mount(host)
await new Promise(resolve => setImmediate(resolve))
await nextTick()
return { host, app, vm }
}
let mounted = await mount()
try {
const { host, vm } = mounted
const notice = banner(host)
assert.ok(notice, 'A native app without an internet-sharing lease still gets an update notice')
assert.match(text(notice), /Version 1.1.5 is available.*Installed: 1.1.4/s)
assert.ok(all(notice).some(item => item.type === 'a' && item.props.href === 'https://groups.google.com/g/galaxy-starpilot-android-beta' && text(item).includes('Update app')))
assert.ok(all(host).some(item => item.type === 'div' && item.props.class === 'install-state' && text(item).includes('true')),
'The main install action is told to render as an update')
const root = host.children.find(item => item.type === 'div')
assert.ok(root.children.indexOf(notice) < root.children.findIndex(item => item.type === 'ol'), 'Notice precedes the setup steps')
const install = all(host).find(item => item.type === 'li' && text(item).includes('Install Galaxy'))
assert.match(text(install), /Android offline app version:.*1.1.5.*Installed.*1.1.4/s)
const dismiss = all(notice).find(item => item.type === 'button' && item.props['aria-label'] === 'Dismiss app update notice')
dismiss.props.onClick()
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'))
mounted.vm.dismissUpdate()
await nextTick()
assert.equal(banner(host), undefined)
vm.companionStatus = { ...status }
await nextTick()
assert.equal(banner(host), undefined, 'Polling does not undo dismissal')
assert.equal(banner(mounted.host), undefined)
} finally { mounted.app.unmount() }
let nativeInstalls = 0
window.StarPilotApp.installUpdate = () => nativeInstalls++
window.StarPilotApp.installUpdate = () => installs++
mounted = await mount()
try {
assert.equal(banner(mounted.host), undefined, 'Dismissal survives leaving and returning to the page')
mounted.vm.companionStatus = { ...status, shippedVersion: '1.1.6' }
assert.equal(banner(mounted.host), undefined, 'Dismissal persists across remounts')
mounted.vm.status = { ...status, shippedVersion: '1.1.6' }
await nextTick()
const nativeNotice = banner(mounted.host)
assert.ok(nativeNotice, 'A later available release gets a new notice')
const nativeUpdate = all(nativeNotice).find(item => item.type === 'button' && text(item).includes('Update app'))
assert.ok(nativeUpdate, 'A current native app uses the in-app installer')
nativeUpdate.props.onClick()
assert.equal(nativeInstalls, 1)
mounted.vm.companionStatus = { ...status, shippedVersion: '1.1.3', updateAvailable: true }
await nextTick()
assert.equal(banner(mounted.host), undefined, 'A server mismatch flag cannot suggest downgrading this phone')
mounted.vm.companionStatus = { ...status, shippedVersion: '1.1.6', appAvailable: false }
await nextTick()
assert.equal(banner(mounted.host), undefined, 'Missing APK never advertises a dead update link')
mounted.vm.companionStatus = { ...status, shippedVersion: '1.1.6' }
localStorage.setItem = () => { throw new Error('Storage unavailable') }
mounted.vm.dismissAppUpdate()
await nextTick()
assert.equal(banner(mounted.host), undefined, 'Dismiss still works when persistent storage is unavailable')
all(banner(mounted.host)).find(item => item.type === 'button' && text(item).includes('Update app')).props.onClick()
assert.equal(installs, 1)
for (const override of [{ shippedVersion: '1.1.3', updateAvailable: true }, { appAvailable: false }]) {
mounted.vm.status = { ...status, ...override }
await nextTick()
assert.equal(banner(mounted.host), undefined, 'Never offer a downgrade or missing artifact')
}
} finally { mounted.app.unmount() }
delete window.StarPilotApp
storage.clear()
mounted = await mount()
try {
assert.equal(banner(mounted.host), undefined, 'A browser cannot infer an installed version without a connected phone')
const install = all(mounted.host).find(item => item.type === 'li' && text(item).includes('Install Galaxy'))
assert.match(text(install), /Android offline app version:.*1.1.5/s)
assert.doesNotMatch(text(install), /Installed:/)
} finally { mounted.app.unmount() }
// iPhone users never mount or poll the Android companion section.
Object.defineProperty(globalThis, 'navigator', { configurable: true, value: { userAgent: 'iPhone' } })
let companionMounts = 0
const iosHost = node('host')
const iosApp = renderer.createApp({ ...GalaxyPage, components: { ...GalaxyPage.components,
GalaxyHotspot: { template: '<div />' }, InstallApp: { template: '<div class="web-install">Install as web app</div>' },
GalaxyCompanion: { mounted() { companionMounts++ }, template: '<div>Android companion</div>' },
} }, { mode: 'local', unauthorized() { assert.fail('Unexpected authentication failure') } })
iosApp.config.compilerOptions.decodeEntities = raw => raw.replaceAll('&amp;', '&')
const iosVm = iosApp.mount(iosHost)
await new Promise(resolve => setImmediate(resolve))
await nextTick()
assert.equal(iosVm.ios, true)
assert.equal(companionMounts, 0)
assert.doesNotMatch(text(iosHost), /Android companion/)
assert.match(text(iosHost), /Install as web app/)
iosApp.unmount()
console.log('Companion install version, in-app update, browser fallback, version ordering and persistent dismissal passed')
for (const [agent, bridge] of [['Chrome', undefined], ['iPhone', { version: () => '1.1.4' }], ['Android', { version: () => '1.1.4', distribution: () => 'play' }]]) {
navigator.userAgent = agent
window.StarPilotApp = bridge
const before = requests
mounted = await mount()
try {
assert.equal(requests, before, 'Browsers, iOS and Play apps do not poll the legacy APK endpoint')
assert.equal(banner(mounted.host), undefined)
assert.doesNotMatch(text(mounted.host), /MB today|disabled|Connections/)
} finally { mounted.app.unmount() }
}
console.log('Companion updates: version ordering, native install, persistent dismissal, platform and distribution isolation passed')
@@ -0,0 +1,89 @@
import assert from 'node:assert/strict'
import { createRenderer, nextTick } from '../web/vendor/vue/vue.esm-browser.js'
import { GalaxyPage } from '../web/js/galaxy.js'
import { RemoteAccess } from '../web/js/remote-access.js'
import { APP_DOWNLOADS } from '../web/js/app-downloads.js'
Object.defineProperty(globalThis, 'navigator', { configurable: true, value: { userAgent: 'Android', clipboard: { writeText: async () => {} } } })
globalThis.window = { confirm: () => true }
globalThis.document = { activeElement: null }
let paired = true, requests = [], unauthorized = 0
const link = 'https://galaxy.firestar.link/device'
globalThis.fetch = async (url, options) => {
requests.push([url, options])
if (url.endsWith('/pair')) paired = true
if (url.endsWith('/unpair')) paired = false
return { ok: true, json: async () => url.endsWith('/session') ? { paired, sessionToken: 'test%20key' } :
{ paired, url: paired ? link : '', tunnelClientAvailable: true } }
}
const node = (type, text = '') => ({ type, text, props: {}, children: [], parent: null,
addEventListener() {}, removeEventListener() {} })
const renderer = createRenderer({
createElement: type => node(type), createText: text => node('text', text), createComment: text => node('comment', text),
setText: (item, text) => { item.text = text }, setElementText: (item, text) => { item.text = text; item.children = [] },
patchProp: (item, key, before, after) => { item.props[key] = after },
insert: (item, parent, anchor = null) => {
if (item.parent) item.parent.children.splice(item.parent.children.indexOf(item), 1)
item.parent = parent
const index = parent.children.indexOf(anchor)
parent.children.splice(index < 0 ? parent.children.length : index, 0, item)
},
remove: item => { const index = item.parent?.children.indexOf(item); if (index >= 0) item.parent.children.splice(index, 1) },
parentNode: item => item.parent,
nextSibling: item => item.parent?.children[item.parent.children.indexOf(item) + 1] ?? null,
})
const all = item => [item, ...item.children.flatMap(all)]
const text = item => [item.text, ...item.children.map(text)].join(' ')
const flush = async () => { await new Promise(resolve => setImmediate(resolve)); await nextTick() }
const host = node('host')
const app = renderer.createApp({ ...GalaxyPage, components: { ...GalaxyPage.components,
GalaxyHotspot: { template: '<div>Hotspot settings</div>' },
InstallApp: { props: ['url'], template: '<div class="web-link">{{ url }}</div>' },
} }, { mode: 'local', unauthorized() { unauthorized++ } })
app.config.compilerOptions.decodeEntities = value => value.replaceAll('&amp;', '&')
const vm = app.mount(host)
await flush()
try {
const nodes = all(host), links = nodes.filter(item => item.type === 'a')
for (const download of Object.values(APP_DOWNLOADS)) {
assert.equal(links.filter(item => item.props.href === download.href).length, 1, 'Each store link appears exactly once')
}
assert.match(text(host), /Set up remote access.*Get the app/s)
assert.doesNotMatch(text(host), /Local access/)
const stepList = nodes.find(item => item.type === 'ol' && item.props.class === 'gx-steps')
assert.equal(stepList.children.filter(item => item.type === 'li' && item.props.class?.includes('gx-step')).length, 2)
assert.equal(nodes.filter(item => item.props.class === 'gx-step__head').length, 2)
assert.doesNotMatch(text(host), /MB today|Status:|Connections|offline app version/)
assert.equal(requests.length, 1, 'A browser reads remote pairing status without polling Android internet-sharing status')
assert.equal(requests[0][0], './api/galaxy/status')
assert.equal(vm.url, link, 'Remote link reaches the web installer')
const steps = vm.$.subTree.children.find(child => child.props?.class === 'gx-steps')
const remote = steps.children.find(child => child.type === RemoteAccess).component.proxy
await remote.showAppKey()
await nextTick()
assert.match(text(host), /test key/)
await remote.unpair()
await nextTick()
assert.equal(vm.url, '')
assert.equal(remote.appKey, '')
assert.equal(remote.keyVisible, false)
remote.password = 'new-password'
await remote.pair()
await nextTick()
assert.equal(vm.url, link)
assert.equal(remote.password, '')
assert.equal(unauthorized, 0)
} finally { app.unmount() }
// A secret response arriving after unmount must never restore the key.
let resolve
const state = { ...RemoteAccess.data(), mode: 'local', paired: true, url: link, unauthorized() {}, $emit() {} }
for (const [key, method] of Object.entries(RemoteAccess.methods)) state[key] = method.bind(state)
globalThis.fetch = () => new Promise(done => { resolve = done })
const pending = state.showAppKey()
RemoteAccess.beforeUnmount.call(state)
resolve({ ok: true, json: async () => ({ paired: true, sessionToken: 'stale-secret' }) })
await pending
assert.equal(state.appKey, '')
assert.equal(state.keyVisible, false)
console.log('Galaxy access: unique store links, browser isolation, remote pairing/link propagation and secret cleanup passed')
@@ -12,16 +12,12 @@ assert.ok(Home.template.includes('recordArt(record.id)'))
assert.ok(Home.template.includes('aria-hidden="true"><svg'))
assert.ok(GalaxyPage.template.includes('>Galaxy Access & Install</h2>'))
assert.ok(!GalaxyPage.template.includes('Galaxy & App Install'))
assert.ok(GalaxyPage.template.includes('Your remote link needs Internet and an active tunnel.'))
assert.ok(GalaxyPage.template.includes('join the Android beta on Google Groups'))
assert.ok(GalaxyPage.template.includes('Android offline app version:'))
assert.ok(GalaxyPage.template.includes('<GalaxyHotspot'))
assert.ok(GalaxyPage.template.includes('<GalaxyCompanion v-if="!ios"'), 'The Android companion section is not mounted on iOS')
assert.ok(GalaxyPage.template.indexOf('<h3>Remote pairing</h3>') < GalaxyPage.template.indexOf('<InstallApp'))
assert.ok(GalaxyPage.template.includes('class="gx-starport__steps"'))
assert.ok(GalaxyPage.template.includes('<InstallApp :url="url"'))
assert.ok(GalaxyPage.template.indexOf('<InstallApp') < GalaxyPage.template.indexOf('<GalaxyHotspot'))
assert.ok(GalaxyPage.template.includes('<LocalAccess v-if="!ios" :mode="mode" :on-unauthorized="unauthorized" />'))
assert.ok(!GalaxyPage.template.includes('Android users:'))
assert.ok(!GalaxyPage.template.includes('Phone companion · Connections'))
assert.ok(GalaxyPage.template.indexOf('<RemoteAccess') < GalaxyPage.template.indexOf('<AppStoreLinks'))
assert.ok(!GalaxyPage.template.includes('<LocalAccess'))
assert.ok(GalaxyPage.template.includes('<h3>Get the app</h3>'))
assert.ok(GalaxyPage.template.includes('<InstallApp :url="url" />'))
assert.ok(!GalaxyPage.template.includes('PWA'))
assert.ok(DriveStatePanel.template.includes('gx-card gx-force-drive'))
const css = readFileSync(new URL('../web/css/galaxy.css', import.meta.url), 'utf8')
@@ -1,9 +1,10 @@
import { APP_DOWNLOADS, AppStoreLinks } from '../web/js/app-downloads.js'
import assert from 'node:assert/strict'
import { ANDROID_BETA_URL, installHelp, InstallApp, rememberInstallPrompt, isIosDevice, isAndroidDevice } from '../web/js/install-app.js'
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(ANDROID_BETA_URL, 'https://groups.google.com/g/galaxy-starpilot-android-beta')
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
@@ -44,26 +45,11 @@ await InstallApp.methods.installWeb.call(late)
assert.equal(prompted, 2)
InstallApp.beforeUnmount.call(late)
// Android sends users to the Google Groups beta instead of a direct APK download.
navigator.userAgent = 'Android'
let apk
globalThis.location = { protocol: 'http:', assign: value => { apk = value } }
let nativeUpdates = 0
window.StarPilotApp = { installUpdate: () => nativeUpdates++ }
const nativeUpdate = { ...InstallApp.data(), updateAvailable: true }
InstallApp.methods.installAndroid.call(nativeUpdate)
assert.equal(nativeUpdates, 1)
assert.equal(apk, undefined, 'Native updates never hand the APK to a browser')
delete window.StarPilotApp
// Store metadata lives outside the web installer.
assert.equal(APP_DOWNLOADS.ios.href, 'https://apps.apple.com/ca/app/starpilot-bt/id6821039119')
assert.match(AppStoreLinks.template, /app.href/)
assert.doesNotMatch(InstallApp.template, /Google Play|App Store|offline app|app\.apk/)
const android = { ...InstallApp.data() }
InstallApp.methods.installAndroid.call(android)
assert.equal(apk, ANDROID_BETA_URL)
assert.match(InstallApp.template, /Install web app/)
assert.match(InstallApp.template, /Join the Android beta/)
assert.doesNotMatch(InstallApp.template, /app\.apk|Download Android APK/)
assert.match(InstallApp.template, /Update offline app \(Android\)/)
assert.match(InstallApp.template, /android && !ios/)
// Choosing the web app on Android always keeps web-install guidance.
const webHelp = InstallApp.methods.installHelp.call(android)
assert.match(webHelp, /Install app/)
@@ -77,8 +63,4 @@ assert.equal(isAndroidDevice('Android'), true)
assert.equal(isAndroidDevice('iPhone'), false)
navigator.userAgent = 'iPhone'
const ios = { ...InstallApp.data() }
assert.equal(ios.android, false)
assert.equal(ios.ios, true)
assert.match(InstallApp.template, /<a v-if="ios"[^>]+href="https:\/\/apps\.apple\.com\/ca\/app\/starpilot-bt\/id6821039119"/)
assert.match(InstallApp.methods.installHelp.call(ios), /Share.*Add to Home Screen/)
assert.match(InstallApp.template, /v-if="android && !ios/)
@@ -59,13 +59,11 @@ setup.feed.stop()
assert.equal(Home.components.LocalAccess, LocalAccess)
assert.ok(Home.template.includes(':on-unauthorized="unauthorized"'))
assert.ok(LocalAccess.template.includes('Connect your phone to the Galaxy hotspot'))
assert.ok(LocalAccess.template.includes('full http:// address into a new browser tab'))
assert.ok(LocalAccess.template.includes('public Galaxy link uses the Internet tunnel'))
assert.ok(LocalAccess.template.includes('full http:// address'))
assert.ok(LocalAccess.template.includes('Your Firestar Link uses Internet instead.'))
console.log('Local access: actual Vue component/setup, bounded automatically synchronized read, sample exclusion, authentication, safe links and unmount race passed')
assert.equal(GalaxyPage.components.LocalAccess, LocalAccess)
const installStep = GalaxyPage.template.slice(GalaxyPage.template.indexOf('<h3>Install Galaxy</h3>'), GalaxyPage.template.indexOf('</li>', GalaxyPage.template.indexOf('<h3>Install Galaxy</h3>')))
assert.ok(installStep.includes('<LocalAccess v-if="!ios" :mode="mode" :on-unauthorized="unauthorized" />'))
assert.ok(installStep.indexOf('Android users:') < installStep.indexOf('<LocalAccess'))
assert.equal(GalaxyPage.components.LocalAccess, undefined)
assert.ok(!GalaxyPage.template.includes('<LocalAccess'))
compile(GalaxyPage.template, { decodeEntities: value => value.replaceAll('&amp;', '&') })
console.log('Galaxy APK installation exposes authenticated local links with current mode and session handling')
console.log('Galaxy local access remains independent of app installation')
@@ -270,7 +270,7 @@ console.log("StarPort guided setup: Bluetooth-first hint passed")
assert.match(guidedBlock, /beginPairing/) // Find car / Find adapter
assert.match(guidedBlock, /@click="connect"/) // the Connect button
assert.match(guidedBlock, /Stuck pairing\?/) // the pairing help stays
assert.match(template, /<ol v-if="setup && !newSetup" id="gx-starport-steps"/) // the classic step 2, with its dropdown
assert.match(template, /<ol v-if="setup && !newSetup" id="gx-steps"/) // the classic step 2, with its dropdown
const home = template.slice(template.indexOf("gx-starport-home\" aria-labelledby"))
assert.match(home, /<template v-if="!newSetup">\s*<GalaxySettingRow :row="carTypeRow"/)
assert.match(StarPortGuidedSetup.template, /gx-guided__steps/)
+83 -70
View File
@@ -1364,23 +1364,74 @@ input[type="checkbox"]:disabled { opacity: .4; cursor: not-allowed; }
.gx-summary > div { display: flex; flex-direction: column; min-width: 0; text-align: center; }
.gx-summary dt { color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.35; overflow-wrap: anywhere; }
.gx-summary dd { order: -1; margin: 0 0 var(--sp-1); font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--primary); overflow-wrap: anywhere; }
/* Android Auto setup layout; controls reuse shared Galaxy styles. */
.gx-starport__steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-4); }
.gx-starport__steps > .gx-card { margin-bottom: 0; }
.gx-starport-step { padding: var(--panel-padding); display: grid; gap: var(--sp-4); min-width: 0; }
.gx-starport-step__head { display: flex; align-items: flex-start; gap: var(--sp-4); min-width: 0; }
.gx-starport-step__head h3 { margin: 2px 0 var(--sp-1); font-size: var(--fs-lg); }
.gx-starport-step__head p { margin: 0; color: var(--text-muted); line-height: 1.45; }
.gx-starport-step__head > .gx-btn { margin-left: auto; flex: none; }
.gx-starport-step__num { flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-full);
/* Shared setup steps: Galaxy access, navigation, music and StarPort. */
.gx-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-4); }
.gx-steps > .gx-card { margin-bottom: 0; }
.gx-step { padding: var(--panel-padding); display: grid; gap: var(--sp-4); min-width: 0; }
.gx-step__head { display: flex; align-items: flex-start; gap: var(--sp-4); min-width: 0; }
.gx-step__head h3 { margin: 2px 0 var(--sp-1); font-size: var(--fs-lg); }
.gx-step__head p { margin: 0; color: var(--text-muted); line-height: 1.45; }
.gx-step__head > .gx-btn { margin-left: auto; flex: none; }
.gx-step__num { flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-full);
background: var(--primary-container); color: var(--on-primary-container); font-weight: var(--fw-bold); }
.gx-starport-step--done .gx-starport-step__num { background: var(--success); color: var(--background); }
.gx-step--done .gx-step__num { background: var(--success); color: var(--background); }
.gx-step__body { display: grid; gap: var(--sp-3); min-width: 0; padding-left: calc(36px + var(--sp-4)); }
.gx-step__body > p { margin: 0; line-height: 1.45; }
.gx-step__body > p:has(> .gx-spinner) { display: flex; align-items: center; gap: var(--sp-2); }
.gx-step__body > .gx-driving__actions { margin-block: 0; }
.gx-steps--compact { gap: var(--sp-3); }
.gx-step-card {
display: grid;
gap: var(--sp-3);
padding: var(--sp-3) var(--sp-4);
border-radius: var(--radius-md);
background: var(--surface-container);
border: 1px solid var(--outline);
transition: border-color var(--motion-fast);
}
.gx-step-card:focus-within {
border-color: var(--primary);
}
.gx-step-card__head {
display: flex;
align-items: center;
gap: var(--sp-3);
}
.gx-step-card__num {
width: 28px;
height: 28px;
font-size: var(--fs-sm);
}
.gx-step-card__title {
display: grid;
gap: 1px;
}
.gx-step-card__title strong {
font-size: var(--fs-sm);
font-weight: var(--fw-bold);
color: var(--on-surface);
}
.gx-step-card__title small {
font-size: var(--fs-xs);
color: var(--on-surface-variant);
}
.gx-step-card__body {
display: grid;
gap: var(--sp-2);
padding-left: 40px;
}
@media (max-width: 500px) {
.gx-step-card__body { padding-left: 0; }
.gx-step-card { padding: var(--sp-3); }
}
@media (max-width: 600px) {
.gx-step { padding: var(--sp-4); }
.gx-step__body { padding-left: 0; }
}
/* StarPort-specific status and setup controls. */
.gx-starport-home { margin-bottom: 0; }
.gx-starport-step__num.gx-starport-home__icon--live { background: var(--success); color: var(--background); }
.gx-starport-step__body { display: grid; gap: var(--sp-3); min-width: 0; padding-left: calc(36px + var(--sp-4)); }
.gx-starport-step__body > p { margin: 0; line-height: 1.45; }
.gx-starport-step__body > p:has(> .gx-spinner) { display: flex; align-items: center; gap: var(--sp-2); }
.gx-starport-step__body > .gx-driving__actions { margin-block: 0; }
.gx-step__num.gx-starport-home__icon--live { background: var(--success); color: var(--background); }
.gx-starport-status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.gx-starport-status__actions { margin-left: auto; }
.gx-starport-pill { display: inline-flex; align-items: center; gap: var(--sp-2); width: fit-content; max-width: 100%; margin: 0; padding: 6px 14px;
@@ -1471,57 +1522,6 @@ letter-spacing: -0.01em;
.gx-starport-sheet__dialog .gx-note {
line-height: 1.45;
}
.gx-starport-sheet__steps {
list-style: none;
margin: 0;
padding: 0;
display: grid;
gap: var(--sp-3);
}
.gx-starport-step-card {
display: grid;
gap: var(--sp-3);
padding: var(--sp-3) var(--sp-4);
border-radius: var(--radius-md);
background: var(--surface-container);
border: 1px solid var(--outline);
transition: border-color var(--motion-fast);
}
.gx-starport-step-card:focus-within {
border-color: var(--primary);
}
.gx-starport-step-card__head {
display: flex;
align-items: center;
gap: var(--sp-3);
}
.gx-starport-step-card__num {
width: 28px;
height: 28px;
font-size: var(--fs-sm);
}
.gx-starport-step-card__title {
display: grid;
gap: 1px;
}
.gx-starport-step-card__title strong {
font-size: var(--fs-sm);
font-weight: var(--fw-bold);
color: var(--on-surface);
}
.gx-starport-step-card__title small {
font-size: var(--fs-xs);
color: var(--on-surface-variant);
}
.gx-starport-step-card__body {
display: grid;
gap: var(--sp-2);
padding-left: 40px;
}
@media (max-width: 500px) {
.gx-starport-step-card__body { padding-left: 0; }
.gx-starport-step-card { padding: var(--sp-3); }
}
.gx-starport-sheet__step--muted { opacity: .7; }
.gx-starport-file { position: relative; }
.gx-starport-file input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
@@ -1568,8 +1568,6 @@ border-top: 1px solid var(--outline-variant);
.gx-starport-trademark { display: block; font-size: var(--fs-xs); opacity: .75; line-height: 1.35; }
@media (prefers-reduced-motion: reduce) { .gx-spinner, .gx-starport-checks .gx-starport-check--active::before { animation: none; } }
@media (max-width: 600px) {
.gx-starport-step { padding: var(--sp-4); }
.gx-starport-step__body { padding-left: 0; }
.gx-starport-status__actions { margin-left: 0; width: 100%; }
.gx-starport-status__actions .gx-btn { flex: 1 1 auto; }
.gx-starport-row { flex-wrap: wrap; }
@@ -1607,7 +1605,7 @@ border-top: 1px solid var(--outline-variant);
.gx-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gx-device-picker__row { display: flex; align-items: center; gap: var(--sp-1); }
.gx-device-picker__form { padding: var(--sp-2); display: grid; gap: var(--sp-2); }
.gx-tunnel__qr { display: block; width: min(250px, 100%); background: white; padding: var(--sp-2); border-radius: var(--radius-sm); }
.gx-tunnel__qr { display: block; margin-inline: auto; width: min(250px, 100%); background: white; padding: var(--sp-2); border-radius: var(--radius-sm); }
.gx-plots__hint { min-height: 2.8em; }
.gx-tabs > button { min-height: var(--touch-target); padding: var(--sp-2) var(--sp-4); }
.gx-tabs > button[aria-pressed="true"], .gx-tabs > button[aria-selected="true"], .gx-chip--selected { background: var(--primary); color: var(--on-primary); }
@@ -1684,7 +1682,7 @@ progress { max-width: 100%; accent-color: var(--primary); }
.gx-replay__player:fullscreen .gx-replay__video { min-height: 0; flex: 1; }
}
.gx-spotify-now { display: grid; gap: var(--sp-3); }
.gx-spotify > .gx-starport-step > h3 { margin: 0; font-size: var(--fs-lg); }
.gx-spotify > .gx-step > h3 { margin: 0; font-size: var(--fs-lg); }
.gx-spotify-now__main { display: flex; gap: var(--sp-3); align-items: center; justify-content: center; min-width: 0; }
.gx-spotify-now__text { min-width: 0; }
.gx-spotify-now__text h3, .gx-spotify-now__text p { margin: 0; }
@@ -1883,3 +1881,18 @@ progress { max-width: 100%; accent-color: var(--primary); }
.gx-app-download__get { width: 100%; min-height: 48px; }
.gx-app-download > .gx-app-download__platform { margin-top: -8px; font-size: .75rem; }
.gx-app-download > .gx-btn--text { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-muted); min-height: 44px; }
/* Shared disclosure motion. Native focus, keyboard and open state stay intact. */
.gx-select-menu {
opacity: 0;
transform: translateY(-4px);
transition: opacity var(--motion-base), transform var(--motion-base), display var(--motion-base) allow-discrete, overlay var(--motion-base) allow-discrete;
}
.gx-select-menu[open] { opacity: 1; transform: translateY(0); }
.gx-select-menu:not([open]) { pointer-events: none; }
@starting-style {
.gx-select-menu[open] { opacity: 0; transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
.gx-select-menu { transition: none; }
}
@@ -183,8 +183,8 @@
.gx-navigation__sources { display: flex; flex-wrap: wrap; gap: var(--sp-2); list-style: none; margin: 0; padding: 0; }
.gx-navigation__sources .gx-navigation__chip { text-decoration: none; border: 1px solid var(--outline); }
.gx-navigation__power .gx-row__info { display: grid; gap: 2px; }
.gx-navigation .gx-starport-step__body { padding-left: 0; }
@media (min-width: 640px) { .gx-navigation .gx-starport-step__body { padding-left: calc(36px + var(--sp-4)); } }
.gx-navigation .gx-step__body { padding-left: 0; }
@media (min-width: 640px) { .gx-navigation .gx-step__body { padding-left: calc(36px + var(--sp-4)); } }
@media (max-width: 540px) { .gx-compare__row { grid-template-columns: 1fr; gap: 2px; } .gx-compare__row--head { display: none; } .gx-compare__row > :nth-child(2)::before { content: "Mapbox: "; } .gx-compare__row > :nth-child(3)::before { content: "Google: "; } }
.gx-navigation__guide { border: 1px solid var(--outline); border-radius: var(--radius-sm); padding: var(--sp-3); }
@@ -0,0 +1,13 @@
// 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' }),
})
export const AppStoreLinks = {
data: () => ({ downloads: APP_DOWNLOADS }),
template: `<div class="gx-actions" aria-label="Get Galaxy">
<a v-for="(app, platform) in downloads" :key="platform" class="gx-btn" :href="app.href" target="_blank" rel="noopener"><i :class="['bi', app.icon]" aria-hidden="true"></i> {{ app.label }}</a>
<slot />
</div>`,
}
@@ -1,12 +1,11 @@
import { APP_DOWNLOADS } from "./app-downloads.js"
export { APP_DOWNLOADS } from "./app-downloads.js"
import { reactive } from "../vendor/vue/vue.esm-browser.js"
import { GxDialog } from "./dialog.js"
export const HIDE_APP_REMINDER = "galaxy-hide-app-download-reminder"
export const DISMISSED_APP_REMINDER = "galaxy-app-download-reminder-dismissed"
export const APP_DOWNLOADS = {
ios: { href: "https://firestar.link/iOS", label: "Download for iOS", icon: "bi-apple", name: "StarPilot BT for iPhone" },
android: { href: "https://firestar.link/android", label: "Get the Android app", icon: "bi-google-play", name: "Galaxy for Android" },
}
export function appDownloadPlatform(target = globalThis) {
// Native bridges exist before page scripts run on both companion apps.
@@ -69,5 +68,5 @@ export const AppReminderSettings = {
<div class="gx-row"><div class="gx-row__info"><span class="gx-row__label">Hide app download reminder</span><small>Saved for this browser.</small></div>
<label class="gx-switch"><input type="checkbox" role="switch" aria-label="Hide app download reminder" :checked="pref.hidden"
@change="pref.set($event.target.checked)"><span class="gx-switch__track"></span><span class="gx-switch__thumb"></span></label></div>
<p v-if="pref.error" class="gx-note" role="alert">{{ pref.error }}</p></section>`,
<p v-if="pref.error" class="gx-note gx-inset" role="alert">{{ pref.error }}</p></section>`,
}
+3
View File
@@ -1,3 +1,4 @@
import { installDisclosureMotion } from './disclosure.js'
import { startLocalization } from "./localization.js"
import { rememberInstallPrompt } from "./install-app.js"
import { toggleHaptic } from "./haptics.js"
@@ -13,6 +14,8 @@ import { route, navigate, navigateBack, ensureBackEntry, setRouteLeaveGuard, sta
import { loadCatalog } from "./startup.js"
import { Tools } from "./tools.js"
window.addEventListener("beforeinstallprompt", rememberInstallPrompt)
installDisclosureMotion()
const Logs = page(() => import("./logs.js").then((module) => module.Logs))
const SoftwarePage = page(() => import("./software-status.js").then((module) => module.SoftwarePage))
const NavigationPage = page(() => import("./navigation.js").then((module) => module.NavigationPage))
@@ -0,0 +1,85 @@
import { requestJson } from './startup.js'
import { GxNotice } from './notice.js'
import { BluetoothNotice, bluetoothConnection } from './bluetooth-notice.js'
import { APP_DOWNLOADS } from './app-downloads.js'
import { isIosDevice } from './install-app.js'
const DISMISSED_UPDATE = 'galaxy.companion.dismissedUpdateVersion'
export function newerCompanionVersion(available, installed) {
const parts = version => typeof version === 'string' && /^\d+(?:\.\d+){1,3}$/.test(version) ? version.split('.').map(Number) : []
const next = parts(available), current = parts(installed)
if (!next.length || !current.length || ![...next, ...current].every(Number.isSafeInteger)) return false
for (let index = 0; index < Math.max(next.length, current.length); index++) {
const difference = (next[index] || 0) - (current[index] || 0)
if (difference) return difference > 0
}
return false
}
export function validCompanion(value) {
return value?.protocol === 1 && ['enabled', 'connected', 'active', 'appAvailable', 'updateAvailable'].every(key => typeof value[key] === 'boolean') &&
Number.isSafeInteger(value.bytes) && value.bytes >= 0 && typeof value.shippedVersion === 'string' &&
['active', 'waiting', 'disabled', 'error'].includes(value.state)
}
export const CompanionUpdates = {
components: { GxNotice, BluetoothNotice },
props: { mode: String, unauthorized: Function },
data: () => ({ status: null, error: '', androidApp: APP_DOWNLOADS.android, nativeVersion: window.StarPilotApp?.version?.() || '',
eligible: !isIosDevice() && !!window.StarPilotApp?.version && window.StarPilotApp?.distribution?.() !== 'play',
playDistribution: window.StarPilotApp?.distribution?.() === 'play',
bluetooth: bluetoothConnection(), generation: 0, alive: false, dismissedUpdateVersion: (() => {
try { return localStorage.getItem(DISMISSED_UPDATE) || '' } catch { return '' }
})() }),
computed: {
availableVersion() { return this.status?.appAvailable ? this.status.shippedVersion : '' },
showUpdate() { return this.eligible && this.mode === 'local' && this.availableVersion !== this.dismissedUpdateVersion && newerCompanionVersion(this.availableVersion, this.nativeVersion) },
nativeInstallerAvailable() { return typeof window.StarPilotApp?.installUpdate === 'function' },
},
mounted() { this.start() },
beforeUnmount() { this.stop() },
watch: { mode() { this.stop(); this.start() } },
methods: {
installUpdate() { window.StarPilotApp?.installUpdate?.() },
dismissUpdate() {
this.dismissedUpdateVersion = this.availableVersion
try { localStorage.setItem(DISMISSED_UPDATE, this.dismissedUpdateVersion) } catch {}
},
start() { if (this.mode === 'local' && this.eligible) { this.alive = true; this.refresh() } },
stop() { this.alive = false; this.generation++; clearTimeout(this.timer); this.controller?.abort(); this.status = null },
adopt(status) {
if (!validCompanion(status)) throw new Error('Invalid companion status')
this.status = status
},
async refresh() {
if (!this.alive) return
clearTimeout(this.timer)
const generation = ++this.generation
this.controller = new AbortController()
try {
const status = await requestJson('./api/companion/status', { request: { signal: this.controller.signal } })
if (!this.alive || generation !== this.generation) return
this.adopt(status); this.error = ''
} catch (e) {
if (!this.alive || generation !== this.generation) return
this.error = e.message
if (e.status === 401) { this.stop(); this.unauthorized() }
} finally { if (this.alive && generation === this.generation) this.timer = setTimeout(() => this.refresh(), 5000) }
},
},
template: `<p v-if="playDistribution" class="gx-note">Updates come from Google Play.</p>
<BluetoothNotice v-else-if="showUpdate && bluetooth" :feature="'Android app update ' + availableVersion">
Installed: {{ nativeVersion }}. Connect over Wi-Fi to update.
<button type="button" class="gx-btn gx-btn--tonal" @click="dismissUpdate">Dismiss</button>
</BluetoothNotice>
<GxNotice v-else-if="showUpdate" tone="warn" title="Android app update available">
Version {{ availableVersion }} is available. Installed: {{ nativeVersion }}.
<template #actions>
<button v-if="nativeInstallerAvailable" type="button" class="gx-btn" @click="installUpdate">Update app</button>
<a v-else class="gx-btn" :href="androidApp.href" target="_blank" rel="noopener">Update app</a>
<button type="button" class="gx-btn gx-btn--tonal" aria-label="Dismiss app update notice" @click="dismissUpdate">Dismiss</button>
</template>
</GxNotice>
<GxNotice v-else-if="eligible && error" tone="danger">{{ error }}</GxNotice>`,
}
@@ -1,96 +0,0 @@
import { requestJson } from './startup.js'
import { GxNotice } from './notice.js'
import { BluetoothNotice, bluetoothConnection } from './bluetooth-notice.js'
import { ANDROID_BETA_URL } from './install-app.js'
export function newerCompanionVersion(available, installed) {
const parts = version => typeof version === 'string' && /^\d+(?:\.\d+){1,3}$/.test(version) ? version.split('.').map(Number) : []
const next = parts(available), current = parts(installed)
if (!next.length || !current.length || ![...next, ...current].every(Number.isSafeInteger)) return false
for (let index = 0; index < Math.max(next.length, current.length); index++) {
const difference = (next[index] || 0) - (current[index] || 0)
if (difference) return difference > 0
}
return false
}
export function validCompanion(value) {
return value?.protocol === 1 && ['enabled', 'connected', 'active', 'appAvailable', 'updateAvailable'].every(key => typeof value[key] === 'boolean') &&
Number.isSafeInteger(value.bytes) && value.bytes >= 0 && typeof value.shippedVersion === 'string' &&
['active', 'waiting', 'disabled', 'error'].includes(value.state)
}
export const GalaxyCompanion = {
components: { GxNotice, BluetoothNotice },
emits: ['status'],
props: { mode: String, unauthorized: Function },
data: () => ({ status: null, error: '', betaUrl: ANDROID_BETA_URL, native: !!window.StarPilotApp?.uplinkState, sharing: false, autoStart: false,
bluetooth: bluetoothConnection(), nativeBytes: 0, busy: false, generation: 0, alive: false }),
computed: { windowAutoStart() { return !!window.StarPilotApp?.setAutoStart } },
mounted() { this.start() },
beforeUnmount() { this.stop() },
watch: { mode() { this.stop(); this.start() } },
methods: {
connectionOptions() { window.StarPilotApp?.connectionOptions?.() },
setAutoStart() { window.StarPilotApp.setAutoStart(this.autoStart) },
start() { if (this.mode === 'local') { this.alive = true; this.refresh() } },
stop() { this.alive = false; this.generation++; clearTimeout(this.timer); this.controller?.abort(); this.status = null; this.$emit('status', null) },
adopt(status) {
if (!validCompanion(status)) throw new Error('Invalid companion status')
this.status = status
this.$emit('status', status)
if (this.native) {
const state = JSON.parse(window.StarPilotApp.uplinkState())
this.sharing = state.enabled === true; this.autoStart = state.autoStart === true
this.nativeBytes = Number.isSafeInteger(state.bytes) && state.bytes >= 0 ? state.bytes : status.bytes
}
},
async refresh() {
if (!this.alive || this.busy) return
clearTimeout(this.timer)
const generation = ++this.generation
this.controller = new AbortController()
try {
const status = await requestJson('./api/companion/status', { request: { signal: this.controller.signal } })
if (!this.alive || generation !== this.generation) return
this.adopt(status); this.error = ''
} catch (e) {
if (!this.alive || generation !== this.generation) return
this.error = e.message
if (e.status === 401) { this.stop(); this.unauthorized() }
} finally { if (this.alive && generation === this.generation) this.timer = setTimeout(() => this.refresh(), 5000) }
},
async toggle() {
if (this.bluetooth || !this.alive || this.busy || !this.status || this.mode !== 'local') return
clearTimeout(this.timer); this.controller?.abort()
const generation = ++this.generation
this.busy = true
try {
const enabled = this.native ? !this.sharing : !this.status.enabled
if (this.native && window.StarPilotApp.setUplinkEnabled(enabled) === false) { this.sharing = false; return }
const status = await requestJson('./api/companion/settings', { request: { method: 'POST',
headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ enabled }) } })
if (!this.alive || generation !== this.generation) return
this.adopt(status)
if (this.native) this.sharing = enabled
this.error = ''
} catch (e) {
if (!this.alive || generation !== this.generation) return
this.error = e.message
if (e.status === 401) { this.stop(); this.unauthorized() }
} finally {
this.busy = false
if (this.alive && generation === this.generation) this.timer = setTimeout(() => this.refresh(), 1000)
}
},
},
template: `<section class="gx-card gx-panel gx-stack"><h3>Android companion · Connections</h3>
<p v-if="native"><button class="gx-btn gx-btn--tonal" @click="connectionOptions">Bluetooth, Galaxy Wi-Fi or LAN</button></p>
<BluetoothNotice v-if="bluetooth" feature="Media transfers and phone internet">Phone internet requires the Galaxy hotspot. Settings and small requests remain available.</BluetoothNotice>
<template v-if="!native"><p>Join the Android beta on Google Groups to get the app, then join TheGalaxy Wi-Fi.</p>
<a class="gx-btn" :href="betaUrl" target="_blank" rel="noopener">Join the Android beta</a>
</template>
<template v-if="status && mode === 'local'"><p>Status: <strong>{{ status.state }}</strong> {{ status.reason }} · {{ ((native ? nativeBytes : status.bytes) / 1048576).toFixed(1) }} MB today</p>
</template><GxNotice v-if="error" tone="danger">{{ error }}</GxNotice>
</section>`,
}
@@ -0,0 +1,78 @@
const motions = new WeakMap()
const interrupted = new WeakMap()
function reducedMotion() { return globalThis.matchMedia?.('(prefers-reduced-motion: reduce)').matches === true }
function cancel(element) {
const motion = motions.get(element)
if (!motion) return
interrupted.set(element, element.getBoundingClientRect().height)
motion.animation.cancel()
element.style.overflow = motion.overflow
motions.delete(element)
}
// Animate the outer box, including bordered cards, using Galaxy's shared timing.
function resize(element, from, to, done, expanded) {
cancel(element)
interrupted.delete(element)
if (reducedMotion() || !element.animate || from === to) { done(); return }
const token = getComputedStyle(element).getPropertyValue('--motion-base').trim()
const [time, ...curve] = token.split(/\s+/)
const duration = Number.parseFloat(time) * (time?.endsWith('ms') ? 1 : 1000) || 240
const overflow = element.style.overflow
element.style.overflow = 'hidden'
const animation = element.animate([{ height: `${from}px` }, { height: `${to}px` }], {
duration, easing: curve.join(' ') || 'ease-out',
})
motions.set(element, { animation, overflow, expanded })
animation.onfinish = () => {
if (motions.get(element)?.animation !== animation) return
motions.delete(element)
element.style.overflow = overflow
done()
}
}
// One delegated handler covers every native disclosure, including dynamic/nested ones.
export function installDisclosureMotion(root = document) {
const click = event => {
if (event.defaultPrevented || event.button !== 0 || reducedMotion()) return
const summary = event.target.closest?.('summary')
const details = summary?.parentElement
if (details?.tagName !== 'DETAILS' || details.querySelector('summary') !== summary || !details.animate) return
if (event.target.closest('a, button, input, select, textarea')) return
event.preventDefault()
const expanded = !(motions.get(details)?.expanded ?? details.open)
const from = details.getBoundingClientRect().height
cancel(details)
details.open = expanded
const to = details.getBoundingClientRect().height
// Keep content rendered during closing; update native state when it finishes.
details.open = true
resize(details, from, to, () => { details.open = expanded }, expanded)
}
root.addEventListener('click', click)
return () => root.removeEventListener('click', click)
}
// The same resize implementation for Vue-controlled panels; no extra wrapper DOM.
export const GxCollapse = {
name: 'GxCollapse',
methods: {
enter(element, done) {
if (!element.animate || reducedMotion()) { cancel(element); interrupted.delete(element); done(); return }
const from = interrupted.get(element) ?? 0
cancel(element)
const to = element.getBoundingClientRect().height
resize(element, from, to, done, true)
},
leave(element, done) {
if (!element.animate || reducedMotion()) { cancel(element); interrupted.delete(element); done(); return }
const from = interrupted.get(element) ?? element.getBoundingClientRect().height
resize(element, from, 0, done, false)
},
cancel,
},
template: `<Transition :css="false" @enter="enter" @leave="leave" @enter-cancelled="cancel" @leave-cancelled="cancel"><slot /></Transition>`,
}
+1 -1
View File
@@ -322,7 +322,7 @@ export const FlmPage = {
</nav>
<section v-if="view === 'overview'" id="tuner-panel-overview" role="tabpanel" aria-labelledby="tuner-tab-overview" class="gx-tuner__panel">
<section class="gx-card gx-tuner__drive" :data-tone="review.tone" aria-label="Drive review">
<div class="gx-tuner__drive-mark" aria-hidden="true"><i class="bi" :class="review.tone === 'saved' ? 'bi-check2-circle' : review.count ? 'bi-lightbulb' : 'bi-steering-wheel'"></i></div>
<div class="gx-tuner__drive-mark" aria-hidden="true"><i class="bi" :class="review.tone === 'saved' ? 'bi-check2-circle' : review.count ? 'bi-lightbulb' : 'bi-speedometer2'"></i></div>
<div class="gx-tuner__drive-copy"><p class="gx-tuner__eyebrow">COMPLETED DRIVE REVIEW</p><h3>{{ review.title }}</h3><p>{{ review.description }}</p><p class="gx-tuner__summary"><template v-if="current?.status === 'unavailable'">Latest review incomplete · </template><template v-else><template v-if="offroad?.evidenceDrives > 1">{{ offroad.evidenceDrives }} drives in your steering history · </template>{{ review.count }} {{ review.count === 1 ? 'finding' : 'findings' }} · </template><template v-if="offroad">{{ savedSummary }}</template><template v-else-if="trackingValues">{{ amount(acceptedCount) }} accepted · saving not confirmed</template><template v-else>Saved tune not reported</template></p><p v-if="offroad?.earlierDrive" class="gx-tuner__caption" data-role="retained-drive-findings">These suggestions come from an earlier drive. Newer driving is reviewed separately.</p></div>
<div class="gx-tuner__drive-actions"><button v-if="review.saved.length" type="button" class="gx-btn gx-btn--tonal" @click="selectView('tune')">{{ review.historical ? 'View earlier saved values' : 'View saved change' }}<i class="bi bi-arrow-right" aria-hidden="true"></i></button><button v-if="review.count" type="button" class="gx-btn gx-btn--tonal gx-tuner__review-button" data-action="view-findings" @click="selectView('tune')">{{ review.saved.length ? 'View other findings' : 'View ' + review.count + (review.count === 1 ? ' finding' : ' findings') }}<i class="bi bi-arrow-right" aria-hidden="true"></i></button></div>
</section>
+25 -151
View File
@@ -1,155 +1,29 @@
import { GxState } from "./state.js"
import { GxNotice } from "./notice.js"
import { requestJson } from "./startup.js"
import { ANDROID_BETA_URL, InstallApp, isIosDevice } from "./install-app.js"
import { GalaxyCompanion, newerCompanionVersion } from "./companion.js"
import { GalaxyHotspot } from "./hotspot.js"
import { LocalAccess } from "./local-access.js"
import { BluetoothNotice, bluetoothConnection } from "./bluetooth-notice.js"
const DISMISSED_UPDATE = 'galaxy.companion.dismissedUpdateVersion'
const dismissedUpdate = () => { try { return localStorage.getItem(DISMISSED_UPDATE) || '' } catch { return '' } }
import { AppStoreLinks } from './app-downloads.js'
import { InstallApp } from './install-app.js'
import { RemoteAccess } from './remote-access.js'
import { CompanionUpdates } from './companion-updates.js'
import { GalaxyHotspot } from './hotspot.js'
export const GalaxyPage = {
name: "GalaxyPage",
components: { GxState, GxNotice, BluetoothNotice, InstallApp, GalaxyHotspot, GalaxyCompanion, LocalAccess },
name: 'GalaxyPage',
components: { AppStoreLinks, InstallApp, RemoteAccess, CompanionUpdates, GalaxyHotspot },
props: { mode: { type: String, required: true }, unauthorized: { type: Function, required: true } },
data: () => ({ loading: true, paired: false, url: "", tunnelClientAvailable: false, legacyPassword: false,
appKey: '', keyVisible: false, betaUrl: ANDROID_BETA_URL, legacyPairingAvailable: false, password: "", busy: false, error: "", companionStatus: null,
bluetooth: bluetoothConnection(), nativeVersion: window.StarPilotApp?.version?.() || '', dismissedUpdateVersion: dismissedUpdate(),
ios: isIosDevice() }),
computed: {
availableAppVersion() { return this.companionStatus?.appAvailable ? this.companionStatus.shippedVersion : '' },
installedAppVersion() { return this.nativeVersion || this.companionStatus?.version || '' },
playDistribution() { return window.StarPilotApp?.distribution?.() === 'play' },
appUpdateAvailable() {
return !this.playDistribution && this.mode === 'local' && newerCompanionVersion(this.availableAppVersion, this.installedAppVersion)
},
nativeInstallerAvailable() { return typeof window.StarPilotApp?.installUpdate === 'function' },
showAppUpdate() {
return this.appUpdateAvailable && this.availableAppVersion !== this.dismissedUpdateVersion
},
},
mounted() { this.load() },
methods: {
async showAppKey() {
const url = this.url
try { const data = await this.request('./api/galaxy/session'); if (this.url !== url || !this.paired) return; this.appKey = data.paired ? decodeURIComponent(data.sessionToken) : ''; this.keyVisible = !!this.appKey }
catch (error) { this.error = error.message }
},
async copyAppKey() {
try { await navigator.clipboard.writeText(this.appKey) } catch { this.error = 'Select and copy the displayed key.' }
},
installAppUpdate() { window.StarPilotApp?.installUpdate?.() },
dismissAppUpdate() {
this.dismissedUpdateVersion = this.availableAppVersion
try { localStorage.setItem(DISMISSED_UPDATE, this.dismissedUpdateVersion) } catch {}
},
async request(path, body) {
try {
return await requestJson(path, { request: body === undefined ? {} : {
method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body),
} })
} catch (error) {
if (error.status === 401) this.unauthorized()
throw error
}
},
async load() {
if (this.mode !== "local") { this.loading = false; return }
try {
const data = await this.request("./api/galaxy/status")
this.paired = data.paired
this.url = data.url
this.tunnelClientAvailable = data.tunnelClientAvailable === true
this.legacyPassword = data.legacyPassword === true
this.legacyPairingAvailable = data.legacyPairingAvailable === true
} catch (error) { this.error = error.message }
finally { this.loading = false }
},
async pair() {
this.busy = true
this.error = ""
try {
const data = await this.request("./api/galaxy/pair", { password: this.password })
this.paired = data.paired
this.url = data.url
this.appKey = ''
this.keyVisible = false
this.password = ""
} catch (error) { this.error = error.message }
finally { this.busy = false }
},
async unpair() {
if (!window.confirm("Unpair from Galaxy? Remote access will stop until you pair again.")) return
this.busy = true
this.error = ""
try {
await this.request("./api/galaxy/unpair", {})
this.paired = false
this.url = ""
this.appKey = ''
this.keyVisible = false
} catch (error) { this.error = error.message }
finally { this.busy = false }
},
},
template: `
<div class="gx-settings gx-tunnel" :inert="busy" :aria-busy="busy || undefined"><header class="gx-settings__header gx-page-header"><div><h2>Galaxy Access & Install</h2>
<p>Pair your comma, then install Galaxy from your remote link.</p></div></header>
<p v-if="playDistribution" class="gx-note">Updates come from Google Play.</p>
<BluetoothNotice v-if="showAppUpdate && bluetooth && !ios" :feature="'Android app update ' + availableAppVersion">
Installed: {{ installedAppVersion }}.
<button type="button" class="gx-btn gx-btn--tonal" aria-label="Dismiss app update notice" @click="dismissAppUpdate">Dismiss</button>
</BluetoothNotice>
<GxNotice v-else-if="showAppUpdate && !ios" tone="warn" title="Android app update available">
Version {{ availableAppVersion }} is available. Installed: {{ installedAppVersion }}.
<template #actions><button v-if="nativeInstallerAvailable" type="button" class="gx-btn" @click="installAppUpdate">Update app</button>
<a v-else class="gx-btn" :href="betaUrl" target="_blank" rel="noopener">Update app</a>
<button type="button" class="gx-btn gx-btn--tonal" aria-label="Dismiss app update notice" @click="dismissAppUpdate">Dismiss</button></template>
</GxNotice>
<GxState v-if="mode !== 'local'">Connect to your comma to set up remote access.</GxState>
<GxState v-else-if="loading" loading>Checking pairing status…</GxState>
<ol v-else class="gx-starport__steps">
<li class="gx-card gx-starport-step" :class="{'gx-starport-step--done': paired}">
<div class="gx-starport-step__head"><span class="gx-starport-step__num" aria-hidden="true"><i v-if="paired" class="bi bi-check-lg"></i><template v-else>1</template></span>
<div><h3>Remote pairing</h3><p>Pair your comma to get a secure Galaxy link.</p></div></div>
<div class="gx-starport-step__body">
<template v-if="paired">
<GxNotice v-if="!tunnelClientAvailable" tone="warn">The remote tunnel client is unavailable. Your link will work when it is installed.</GxNotice>
<BluetoothNotice v-if="bluetooth" feature="Galaxy QR code">Your Galaxy link remains available below.</BluetoothNotice>
<img v-else src="./api/galaxy/qr.svg" alt="QR code for your Galaxy link" class="gx-tunnel__qr" />
<p><a :href="url" target="_blank" rel="noopener" class="gx-btn gx-btn--tonal gx-wrap">Open your Galaxy link</a></p>
<section class="gx-card"><h3>App key</h3><p>Keep this key private. It grants remote access to this comma.</p>
<button v-if="!keyVisible" class="gx-btn" @click="showAppKey">Show</button>
<template v-else><code class="gx-wrap">{{ appKey }}</code><button class="gx-btn" @click="copyAppKey">Copy</button>
<img src="./api/galaxy/session/qr.svg" class="gx-tunnel__qr" alt="Add remote access to Galaxy" /></template>
</section>
<div class="gx-actions"><button type="button" class="gx-btn gx-btn--danger" @click="unpair">{{ busy ? 'Unpairing…' : 'Unpair' }}</button></div>
</template>
<template v-else>
<p v-if="legacyPassword">Enter your existing password to keep your Galaxy link.</p>
<p v-else-if="legacyPairingAvailable">Enter your old password to keep the link, or choose a new one with at least 8 characters.</p>
<p v-else>Choose a password to pair your comma.</p>
<div class="gx-actions"><input class="gx-field gx-filter-field" type="password" v-model="password" :minlength="legacyPassword || legacyPairingAvailable ? 6 : 8" maxlength="255" :autocomplete="legacyPassword ? 'current-password' : 'new-password'" :placeholder="legacyPassword ? 'Existing Galaxy password' : legacyPairingAvailable ? 'Existing or new Galaxy password' : 'New password (at least 8 characters)'" @keydown.enter="pair" />
<button type="button" class="gx-btn" :disabled="password.trim().length < (legacyPassword || legacyPairingAvailable ? 6 : 8)" @click="pair">{{ busy ? 'Pairing…' : 'Pair' }}</button></div>
</template>
<GxNotice tone="danger" v-if="error">{{ error }}</GxNotice>
</div>
</li>
<li class="gx-card gx-starport-step">
<div class="gx-starport-step__head"><span class="gx-starport-step__num" aria-hidden="true">2</span>
<div><h3>Install Galaxy</h3><p>Launch Galaxy from your home screen or desktop.</p></div></div>
<div class="gx-starport-step__body"><InstallApp :url="url" :update-available="appUpdateAvailable" />
<p v-if="availableAppVersion && !ios">Android offline app version: <strong>{{ availableAppVersion }}</strong><span v-if="installedAppVersion"> · {{ nativeVersion ? 'Installed' : 'Connected phone' }}: {{ installedAppVersion }}</span></p>
<p v-if="!ios"><strong>Android users:</strong> join the Android beta on Google Groups to get the app for use over Galaxy Wi-Fi or your local network without Internet.</p>
<LocalAccess v-if="!ios" :mode="mode" :on-unauthorized="unauthorized" />
<p class="gx-note">Your remote link needs Internet and an active tunnel. For offline local access, bookmark your hotspot or local address.</p>
</div>
</li>
</ol>
<GalaxyHotspot :mode="mode" :unauthorized="unauthorized" />
<GalaxyCompanion v-if="!ios" :mode="mode" :unauthorized="unauthorized" @status="companionStatus = $event" />
</div>
`,
data: () => ({ url: '' }),
template: `<div class="gx-settings gx-tunnel">
<header class="gx-settings__header gx-page-header"><div><h2>Galaxy Access & Install</h2>
<p>Set up your link, then choose how to open Galaxy.</p></div></header>
<ol class="gx-steps">
<RemoteAccess title="Set up remote access" :mode="mode" :unauthorized="unauthorized" @link="url = $event" />
<li class="gx-card gx-step" aria-label="Get the app">
<div class="gx-step__head"><span class="gx-step__num" aria-hidden="true">2</span>
<div><h3>Get the app</h3><p>Choose the phone app or install Galaxy in your browser.</p></div></div>
<div class="gx-step__body">
<AppStoreLinks><InstallApp :url="url" /></AppStoreLinks>
<p>Connect through your Firestar Link, nearby Wi-Fi, or Bluetooth.</p>
<CompanionUpdates :mode="mode" :unauthorized="unauthorized" />
</div>
</li>
</ol>
<GalaxyHotspot :mode="mode" :unauthorized="unauthorized" />
</div>`,
}
@@ -18,14 +18,11 @@ export function installHelp({ secure = window.isSecureContext, agent = navigator
return 'This browser cannot install Galaxy automatically. Open the browser menu and choose Install app or Add to Home Screen. On a Mac in Safari, choose File → Add to Dock.'
}
export const ANDROID_BETA_URL = 'https://groups.google.com/g/galaxy-starpilot-android-beta'
export const InstallApp = {
name: 'InstallApp',
props: { url: { type: String, default: '' }, updateAvailable: { type: Boolean, default: false } },
data: () => ({ prompt: null, installed: false, message: '', betaUrl: ANDROID_BETA_URL,
android: isAndroidDevice(), ios: isIosDevice() }),
computed: { playDistribution() { return window.StarPilotApp?.distribution?.() === 'play' }, onPublicGalaxy() { return window.location?.hostname === 'galaxy.firestar.link' } },
props: { url: { type: String, default: '' } },
data: () => ({ prompt: null, installed: false, message: '' }),
computed: { onPublicGalaxy() { return window.location?.hostname === 'galaxy.firestar.link' } },
mounted() {
this.prompt = deferredPrompt
this.displayMode = window.matchMedia('(display-mode: standalone)')
@@ -54,13 +51,6 @@ export const InstallApp = {
await prompt.userChoice
} catch { this.message = installHelp() }
},
installAndroid() {
if (this.updateAvailable && typeof window.StarPilotApp?.installUpdate === 'function') {
window.StarPilotApp.installUpdate()
return
}
location.assign(ANDROID_BETA_URL)
},
},
template: `<div class="gx-install-app">
<p v-if="installed" class="gx-note" role="status">Galaxy is installed.</p>
@@ -70,10 +60,6 @@ export const InstallApp = {
<p v-if="message" class="gx-note">{{ message }}</p>
</template>
<a v-else-if="url" class="gx-btn" :href="url" target="_blank" rel="noopener"><i class="bi bi-box-arrow-up-right" aria-hidden="true"></i> Install web app</a>
<p v-else class="gx-note">Pair in step 1 to get your install link.</p>
<a v-if="ios" class="gx-btn" href="https://apps.apple.com/ca/app/starpilot-bt/id6821039119" target="_blank" rel="noopener"><i class="bi bi-apple" aria-hidden="true"></i> Download StarPilot BT on the App Store</a>
<button v-if="android && !ios && !playDistribution && updateAvailable" type="button" class="gx-btn" @click="installAndroid"><i class="bi bi-download" aria-hidden="true"></i><span>Update offline app (Android)</span></button>
<a v-else-if="android && !ios && !playDistribution && !installed" class="gx-btn" :href="betaUrl" target="_blank" rel="noopener"><i class="bi bi-google-play" aria-hidden="true"></i><span>Join the Android beta</span></a>
<p v-if="playDistribution" class="gx-note">Updates come from Google Play.</p>
<p v-else class="gx-note">Set up remote access to get your web app link.</p>
</div>`,
}
@@ -64,9 +64,9 @@ export const LocalAccess = {
<div class="gx-section__header"><i class="bi bi-router" aria-hidden="true"></i><span class="gx-section__title">Local access</span></div>
<GxNotice v-if="state.error" tone="danger">{{ state.error }}</GxNotice>
<template v-else-if="state.data?.available">
<p>Connect your phone to the Galaxy hotspot, or put your phone and comma on the same Wi-Fi or Ethernet network, then open a local address:</p>
<p>Connect your phone to the Galaxy hotspot or the same network as your comma, then open an address below. No Internet or Galaxy password needed.</p>
<ul class="gx-stack"><li v-for="address in state.data.addresses" :key="address.interface + address.url"><a :href="address.url" target="_blank" rel="noopener" class="gx-btn gx-btn--tonal gx-wrap">{{ address.label }} · {{ address.url }}</a></li></ul>
<p class="gx-note">For local access, type or paste the full http:// address into a new browser tab and bookmark it. The public Galaxy link uses the Internet tunnel, independently of hotspot access. If your browser or phone asks for local-network permission, allow access to this comma.</p>
<p class="gx-note">Use the full http:// address and bookmark it. Allow local-network access if prompted. Your Firestar Link uses Internet instead.</p>
</template>
<p v-else-if="state.data" class="gx-note" role="status">{{ state.data.reason || 'The comma has no local network address available.' }}</p>
</section>`,
+20 -19
View File
@@ -1,3 +1,4 @@
import { GxCollapse } from './disclosure.js'
import { isMapLink } from "./share-destination.js"
import { GxNotice } from "./notice.js"
import { BluetoothNotice, bluetoothConnection } from "./bluetooth-notice.js"
@@ -308,7 +309,7 @@ export const FavoriteChoices = {
export const NavigationPage = {
name: "NavigationPage",
components: { GxNotice, BluetoothNotice, MapOperationsPanel, NavigationMap, OfflineRoadMapsPanel, FavoriteChoices, GalaxySelect, ChoiceGroup, SourceCompare },
components: { GxCollapse, GxNotice, BluetoothNotice, MapOperationsPanel, NavigationMap, OfflineRoadMapsPanel, FavoriteChoices, GalaxySelect, ChoiceGroup, SourceCompare },
props: { mode: { type: String, required: true }, unauthorized: { type: Function, required: true },
go: { type: Function, default: null }, initialTab: { type: String, default: "route" }, tabs: { type: Array, required: true } },
data() { return { bluetooth: bluetoothConnection(), data: null, results: [], busy: false, error: "", stale: false, tab: this.initialTab, gpsGuide: "android", query: "", token: "", googleKey: "", googleTest: null, mapboxOpen: false, googleOpen: false, searched: false,
@@ -573,16 +574,16 @@ export const NavigationPage = {
</div>
</section>
<section class="gx-card gx-starport-step" :class="{ 'gx-starport-step--done': data?.hasKey }">
<div class="gx-starport-step__head">
<span class="gx-starport-step__num" aria-hidden="true"><i v-if="data?.hasKey" class="bi bi-check-lg"></i><template v-else>1</template></span>
<section class="gx-card gx-step" :class="{ 'gx-step--done': data?.hasKey }">
<div class="gx-step__head">
<span class="gx-step__num" aria-hidden="true"><i v-if="data?.hasKey" class="bi bi-check-lg"></i><template v-else>1</template></span>
<div>
<div class="gx-navigation__step-title"><h3>Mapbox key</h3><span class="gx-starport-pill" :class="data?.hasKey ? 'gx-starport-pill--ready' : 'gx-starport-pill--soon'" role="status">{{ !data ? 'Loading…' : data.hasKey ? 'Key saved' : 'Needs a key' }}</span></div>
<p>Required, with or without Google. Finds places, saves offline roads, plans routes and backs up Google.</p>
</div>
<button v-if="data?.hasKey" type="button" class="gx-btn gx-btn--tonal" :aria-expanded="mapboxOpen" aria-controls="navigation-mapbox" @click="mapboxOpen = !mapboxOpen">{{ mapboxOpen ? 'Hide' : 'Manage' }}</button>
</div>
<div id="navigation-mapbox" v-show="!data?.hasKey || mapboxOpen" class="gx-starport-step__body">
<GxCollapse><div id="navigation-mapbox" v-show="!data?.hasKey || mapboxOpen" class="gx-step__body">
<details class="gx-starport-wiki gx-navigation__guide" :open="!data?.hasKey"><summary>Setup your mapbox key</summary>
<ol><li><strong>Create an account.</strong> Sign up free at <a href="https://account.mapbox.com/auth/signup/" target="_blank" rel="noopener noreferrer">Mapbox ↗</a>, or sign in if you already have one.</li>
<li><strong>Open your tokens.</strong> Go to <a href="https://account.mapbox.com/access-tokens/" target="_blank" rel="noopener noreferrer">Access tokens ↗</a>. The <strong>Default public token</strong> is the one you need. It starts with <strong>pk.</strong></li>
@@ -601,12 +602,12 @@ export const NavigationPage = {
<p>Use the public token that starts with pk. A secret token isn't needed, and URL-restricted tokens may be rejected. Galaxy keeps the token on your comma and never shows it again.</p>
<p>Typing suggestions, address lookups and offline road maps stop just short of their free monthly allowances and resume on the 1st. Routes, full searches and map views are counted but not limited. Saved places and recents skip search entirely.</p>
</details>
</div>
</div></GxCollapse>
</section>
<section class="gx-card gx-starport-step" :class="{ 'gx-starport-step--done': data?.hasGoogleKey }">
<div class="gx-starport-step__head">
<span class="gx-starport-step__num" aria-hidden="true"><i v-if="data?.hasGoogleKey" class="bi bi-check-lg"></i><template v-else>2</template></span>
<section class="gx-card gx-step" :class="{ 'gx-step--done': data?.hasGoogleKey }">
<div class="gx-step__head">
<span class="gx-step__num" aria-hidden="true"><i v-if="data?.hasGoogleKey" class="bi bi-check-lg"></i><template v-else>2</template></span>
<div>
<div class="gx-navigation__step-title"><h3>Google key</h3><span class="gx-starport-pill" :class="data?.hasGoogleKey ? 'gx-starport-pill--ready' : ''" role="status">{{ data?.hasGoogleKey ? (googleWorking ? 'Key saved · ' + googleWorking : 'Key saved') : 'Optional' }}</span></div>
<p>Added on top of the Mapbox key. Unlocks Google's street &amp; traffic map, live-traffic routes and place search.</p>
@@ -614,7 +615,7 @@ export const NavigationPage = {
<button type="button" class="gx-btn gx-btn--tonal" :aria-expanded="googleOpen" aria-controls="navigation-google" @click="googleOpen = !googleOpen">{{ googleOpen ? 'Hide' : data?.hasGoogleKey ? 'Manage' : 'Add key' }}</button>
</div>
<GxNotice v-if="data?.hasGoogleKey && !data?.hasKey" tone="warn">Google isn't used until the Mapbox key above is added too.</GxNotice>
<div id="navigation-google" v-show="googleOpen" class="gx-starport-step__body">
<GxCollapse><div id="navigation-google" v-show="googleOpen" class="gx-step__body">
<details class="gx-starport-wiki gx-navigation__guide" :open="!data?.hasGoogleKey"><summary>Setup your google key</summary>
<ol><li><strong>Create a project.</strong> Sign in to <a href="https://console.cloud.google.com/projectcreate" target="_blank" rel="noopener noreferrer">Google Cloud ↗</a> and create a project.</li>
<li><strong>Turn on billing.</strong> Open <a href="https://console.cloud.google.com/billing" target="_blank" rel="noopener noreferrer">Google Cloud Billing ↗</a>. Google asks for a card and puts a temporary $50 hold on it, like a gas station does. It is not a charge and it drops off on its own. StarPilot blocks Google at 99% of the free usage, so you won't be charged.</li>
@@ -645,15 +646,15 @@ export const NavigationPage = {
<p>The comma stops at 99% of Google's free allowance: 100,000 map tiles a month (15,000 a day), 10,000 routes, 5,000 traffic routes, 5,000 place searches (shared places included) and 10,000 typing suggestions. Every route and reroute uses live traffic, and one more request every 7½ minutes corrects the arrival time.</p>
<p>Past 20 reroutes in an hour, or when traffic routes run out, routes ignore traffic. Past both limits the comma uses Mapbox until they reset. Google routes have no lane arrows. Place search uses Google when Google gives directions, and Mapbox if Google can't answer.</p>
</details>
</div>
</div></GxCollapse>
</section>
<section class="gx-card gx-starport-step">
<div class="gx-starport-step__head">
<span class="gx-starport-step__num" aria-hidden="true">3</span>
<section class="gx-card gx-step">
<div class="gx-step__head">
<span class="gx-step__num" aria-hidden="true">3</span>
<div><h3>Choose your sources</h3><p>Google choices need both keys. Each one falls back to Mapbox if it can't work.</p></div>
</div>
<div class="gx-starport-step__body">
<div class="gx-step__body">
<ChoiceGroup label="Map picture" :model-value="data?.mapProvider || 'mapbox'" :options="mapChoices" :disabled="!available || !data"
@update:model-value="reportSave(() => client.action('configure', {patch: {mapProvider: $event}}))" />
<ChoiceGroup label="Directions" :model-value="data?.routeProvider || 'mapbox'" :options="routeChoices" :disabled="!available || !data"
@@ -695,12 +696,12 @@ export const NavigationPage = {
</div>
</section>
<section class="gx-card gx-starport-step">
<div class="gx-starport-step__head">
<span class="gx-starport-step__num" aria-hidden="true"><i class="bi bi-send"></i></span>
<section class="gx-card gx-step">
<div class="gx-step__head">
<span class="gx-step__num" aria-hidden="true"><i class="bi bi-send"></i></span>
<div><h3>Ways to send a destination</h3><p>Start a trip from Galaxy or share a place straight from your phone.</p></div>
</div>
<div class="gx-starport-step__body">
<div class="gx-step__body">
<ul class="gx-starport-list" aria-label="Ways to set a destination">
<li v-for="way in destinationWays" :key="way.title" class="gx-starport-row"><i class="bi" :class="way.icon" aria-hidden="true"></i>
<span class="gx-starport-row__text"><strong>{{ way.title }}</strong><small>{{ way.detail }}</small></span></li>
@@ -235,7 +235,7 @@ export const OfflineRoadMapsPanel = {
template: `
<section class="gx-card gx-offline-roads" aria-label="Offline road maps" :inert="busy" :aria-busy="busy || undefined">
<div class="gx-offline-roads__head">
<span class="gx-starport-step__num" aria-hidden="true"><i class="bi bi-cloud-download"></i></span>
<span class="gx-step__num" aria-hidden="true"><i class="bi bi-cloud-download"></i></span>
<div>
<div class="gx-navigation__step-title">
<h3 class="gx-section__title">Offline Map Management</h3>
@@ -14,10 +14,10 @@ export const ONROAD_LAYOUT_TEMPLATE = `
:aria-pressed="state.profile === tab.id" :disabled="!!state.drag" @click="selectProfile(tab.id)">{{ tab.label }}<span v-if="state.data.activeProfile === tab.id" class="gx-layout__active" title="Active UI on the comma"><span class="gx-sr-only"> (active UI)</span></span></button>
</div>
</div>
<div v-show="state.aboutOpen" id="gx-layout-about" class="gx-layout__about">
<GxCollapse><div v-show="state.aboutOpen" id="gx-layout-about" class="gx-layout__about">
<p v-if="!projection" class="gx-note">Choose a widget to move it or change its colors. Edit the layout available on this comma.</p><p v-else class="gx-note">Move widgets for the last connected StarPort screen. The comma layout stays separate. Colors follow the comma theme. Changes apply on the next connection.</p>
<p v-if="projection && state.data?.screen" class="gx-note">Last usable screen: {{ state.data.screen.width - state.data.screen.margin_width }} × {{ state.data.screen.height - state.data.screen.margin_height }} pixels.</p>
</div>
</div></GxCollapse>
<p v-if="projection && state.data?.reason" class="gx-note">{{ state.data.reason }}</p>
<GxState v-if="mode !== 'local'">Connect to local Galaxy to edit this device’s colors and layouts.</GxState>
<template v-else>
@@ -164,7 +164,7 @@ export const ONROAD_LAYOUT_TEMPLATE = `
</div>
<!-- The Small screen is too short to carry the chip over the layout; it sits underneath instead. -->
<span v-if="!projection && state.showFavoriteZones && state.showEditingAids && state.profile === 'compact'" class="gx-layout__stage-chip gx-layout__stage-chip--below" aria-hidden="true"><i class="bi bi-grid-3x3-gap"></i>Tap areas</span>
<div v-show="state.tipsOpen" id="gx-layout-tips" class="gx-layout__tips">
<GxCollapse><div v-show="state.tipsOpen" id="gx-layout-tips" class="gx-layout__tips">
<p class="gx-note">Drag widgets to place them. Behind them is the comma's own screen for the chosen scene, including its border, road and alerts. Readings are samples.</p>
<p class="gx-note">Widgets snap to the screen edges, the center and other widgets. Turn snapping off with the magnet button, or hold Option (Alt) while dragging.</p>
<p class="gx-note">General edit shows samples of all enabled widgets together. Driving scenes hide widgets that would be absent, and the eyes follow the scene. Eye changes stay with that scene; your General edit eyes are remembered.</p>
@@ -173,7 +173,7 @@ export const ONROAD_LAYOUT_TEMPLATE = `
<p class="gx-note">The steering wheel and driver monitoring icon can be resized in each layout.{{ profile.widgets.nav_map ? ' The map overlay has adjustable size and opacity.' : '' }} Existing display preferences and driving state still control when widgets appear.</p>
<p v-if="!projection" class="gx-note">Small speed-limit signs can overlap confirmation actions. Live confirmations hide an overlapping sign until the decision ends. Select either widget in the list to edit it.</p>
<p v-if="!projection && state.showFavoriteZones" class="gx-note">Favorite tap areas apply to enabled slots. Speed-limit controls and the steering wheel take priority when the drawer is closed.</p>
</div>
</div></GxCollapse>
<GxNotice v-if="state.placementError" tone="warn">{{ state.placementError }}</GxNotice>
</section>
<section class="gx-card gx-layout__inspector" aria-label="Widget placement" @focusin="revealField"> <!-- codespell:ignore focusin -->
@@ -186,9 +186,9 @@ export const ONROAD_LAYOUT_TEMPLATE = `
<div v-show="state.inspectorPanel === 'widgets'" class="gx-layout__panel">
<div ref="widgetsHelp" class="gx-layout__subhead gx-layout__help-anchor"><h3>Widgets</h3><span>{{ activeWidgets.length }} active</span>
<button class="gx-icon-btn gx-layout__info" type="button" :aria-expanded="state.widgetsHelpOpen" aria-controls="gx-layout-widgets-help" aria-label="How the widget list works" title="How the widget list works" @click="toggleFloating('widgetsHelpOpen', 'widgetsHelp')"><i class="bi bi-info-circle" aria-hidden="true"></i></button>
<div v-show="state.widgetsHelpOpen" id="gx-layout-widgets-help" class="gx-layout__popover" @click="closeFloating('widgetsHelpOpen')" @keydown.esc="closeFloating('widgetsHelpOpen')">
<GxCollapse><div v-show="state.widgetsHelpOpen" id="gx-layout-widgets-help" class="gx-layout__popover" @click="closeFloating('widgetsHelpOpen')" @keydown.esc="closeFloating('widgetsHelpOpen')">
<p>Tap a widget to edit it.</p><p>Drag ⠿ to reorder. The top row is in front, and alerts stay above all widgets.</p><p>The eyes follow the chosen scene. Choose General edit to arrange every enabled widget. Hiding a widget with the eye affects only this scene's preview.</p>
</div>
</div></GxCollapse>
</div>
<div class="gx-layout__widget-list"><div v-for="widget in listWidgets" :key="widget.id" class="gx-layout__layer" :data-layer-id="widget.id"
:class="{'is-dragging': state.layerDrag?.id === widget.id && state.layerDrag?.moved, 'is-drop-target': state.layerDrag?.target === widget.id && state.layerDrag?.id !== widget.id, 'is-drop-after': state.layerDrag?.after}">
@@ -1,3 +1,4 @@
import { GxCollapse } from './disclosure.js'
import { ONROAD_LAYOUT_TEMPLATE } from "./onroad-layout-template.js"
import { GxState } from "./state.js"
import { guardUnload } from "./unload-guard.js"
@@ -385,7 +386,7 @@ export const LayoutWidgetPreview = {
}
export const OnroadLayoutPage = {
components: { GxState, LayoutWidgetPreview, GalaxySelect, GxNotice, GxDialog, GalaxySettingRow },
components: { GxCollapse, GxState, LayoutWidgetPreview, GalaxySelect, GxNotice, GxDialog, GalaxySettingRow },
props: {
projection: { type: Boolean, default: false }, mode: { type: String, required: true }, unauthorized: { type: Function, required: true },
initialPanel: { type: String, default: "widgets" }
@@ -1,9 +1,10 @@
import { GxCollapse } from './disclosure.js'
import { GxDialog } from "./dialog.js"
import { GxNotice } from "./notice.js"
import { requestJson } from "./startup.js"
export const RecordingActions = {
components: { GxDialog, GxNotice },
components: { GxCollapse, GxDialog, GxNotice },
props: { recording: { type: Object, required: true }, all: Boolean, compact: Boolean, collapsed: Boolean,
unauthorized: { type: Function, required: true } },
emits: ["changed"],
@@ -38,8 +39,10 @@ export const RecordingActions = {
<button class="gx-icon-btn" :aria-label="recording.preserved ? 'Unpreserve drive' : 'Preserve drive'" :title="recording.preserved ? 'Unpreserve' : 'Preserve'" @click="save('preserve')"><i class="bi" :class="recording.preserved ? 'bi-heart-fill' : 'bi-heart'"></i></button>
<slot></slot>
<button v-if="!compact && collapsed" class="gx-icon-btn" aria-label="More route actions" title="More route actions" :aria-expanded="managementOpen" @click="managementOpen=!managementOpen" @keydown.esc="managementOpen=false"><i class="bi bi-three-dots" aria-hidden="true"></i></button>
<button v-if="!compact && (!collapsed || managementOpen)" class="gx-icon-btn" aria-label="Rename drive" title="Rename" @click="edit('rename')"><i class="bi bi-pencil"></i></button>
<button v-if="!compact && (!collapsed || managementOpen)" class="gx-icon-btn gx-recordings__danger" aria-label="Delete drive" title="Delete" @click="edit('delete')"><i class="bi bi-trash"></i></button>
<GxCollapse><div v-if="!compact && (!collapsed || managementOpen)" class="gx-actions">
<button class="gx-icon-btn" aria-label="Rename drive" title="Rename" @click="edit('rename')"><i class="bi bi-pencil"></i></button>
<button class="gx-icon-btn gx-recordings__danger" aria-label="Delete drive" title="Delete" @click="edit('delete')"><i class="bi bi-trash"></i></button>
</div></GxCollapse>
</template>
<template v-else>
<button class="gx-btn gx-btn--tonal" @click="includePreserved=false; edit('delete')">Delete non-preserved</button>
@@ -0,0 +1,121 @@
import { GxState } from './state.js'
import { GxNotice } from './notice.js'
import { requestJson } from './startup.js'
import { BluetoothNotice, bluetoothConnection } from './bluetooth-notice.js'
export const RemoteAccess = {
name: 'RemoteAccess',
components: { GxState, GxNotice, BluetoothNotice },
props: { title: { type: String, default: 'Remote access' }, step: { type: Number, default: 1 }, mode: { type: String, required: true }, unauthorized: { type: Function, required: true } },
emits: ['link'],
data: () => ({ loading: true, paired: false, url: '', tunnelClientAvailable: false, legacyPassword: false,
appKey: '', keyVisible: false, legacyPairingAvailable: false, password: '', busy: false, error: '', generation: 0, bluetooth: bluetoothConnection() }),
mounted() { this.load() },
watch: { mode() {
this.generation++
this.busy = false
this.error = ''
this.password = ''
this.setPairing({ paired: false, url: '' })
this.load()
} },
beforeUnmount() { this.generation++; this.appKey = ''; this.keyVisible = false },
methods: {
setPairing({ paired, url }) {
this.paired = paired
this.url = paired ? url : ''
this.appKey = ''
this.keyVisible = false
this.$emit('link', this.url)
},
async showAppKey() {
const url = this.url
try { const data = await this.request('./api/galaxy/session'); if (this.url !== url || !this.paired) return; this.appKey = data.paired ? decodeURIComponent(data.sessionToken) : ''; this.keyVisible = !!this.appKey }
catch (error) { if (error.name !== 'AbortError') this.error = error.message }
},
async copyAppKey() {
try { await navigator.clipboard.writeText(this.appKey) } catch { this.error = 'Select and copy the displayed key.' }
},
async request(path, body) {
const generation = this.generation
try {
const result = await requestJson(path, { request: body === undefined ? {} : {
method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body),
} })
if (generation !== this.generation) throw new DOMException('Access page changed', 'AbortError')
return result
} catch (error) {
if (generation !== this.generation) throw new DOMException('Access page changed', 'AbortError')
if (generation === this.generation && error.status === 401) this.unauthorized()
throw error
}
},
async load() {
const generation = this.generation
this.loading = true
if (this.mode !== "local") { this.loading = false; return }
try {
const data = await this.request("./api/galaxy/status")
this.setPairing(data)
this.tunnelClientAvailable = data.tunnelClientAvailable === true
this.legacyPassword = data.legacyPassword === true
this.legacyPairingAvailable = data.legacyPairingAvailable === true
} catch (error) { if (error.name !== 'AbortError') this.error = error.message }
finally { if (generation === this.generation) this.loading = false }
},
async pair() {
if (this.mode !== 'local' || this.busy) return
this.busy = true
this.error = ""
try {
const data = await this.request("./api/galaxy/pair", { password: this.password })
this.setPairing(data)
this.password = ""
} catch (error) { if (error.name !== 'AbortError') this.error = error.message }
finally { this.busy = false }
},
async unpair() {
if (this.mode !== 'local' || this.busy) return
if (!window.confirm("Unpair from Galaxy? Remote access will stop until you pair again.")) return
this.busy = true
this.error = ""
try {
await this.request("./api/galaxy/unpair", {})
this.setPairing({ paired: false, url: '' })
} catch (error) { if (error.name !== 'AbortError') this.error = error.message }
finally { this.busy = false }
},
},
template: `<li class="gx-card gx-step" :class="{'gx-step--done': paired}" :inert="busy" :aria-busy="busy || undefined">
<div class="gx-step__head">
<span class="gx-step__num" aria-hidden="true"><i v-if="paired" class="bi bi-check-lg"></i><template v-else>{{ step }}</template></span>
<div><h3>{{ title }}</h3><p>Use a Firestar Link in the app or browser when you are away from your comma. Both devices need Internet.</p></div>
</div>
<div class="gx-step__body">
<GxState v-if="mode !== 'local'">Connect to your comma to set up remote access.</GxState>
<GxState v-else-if="loading" loading>Checking pairing status…</GxState>
<template v-else>
<template v-if="paired">
<GxNotice v-if="!tunnelClientAvailable" tone="warn">Remote access is not ready on this comma yet.</GxNotice>
<BluetoothNotice v-if="bluetooth" feature="Galaxy QR code">Your Galaxy link remains available below.</BluetoothNotice>
<img v-else src="./api/galaxy/qr.svg" alt="QR code for your Galaxy link" class="gx-tunnel__qr" />
<p><a :href="url" target="_blank" rel="noopener" class="gx-btn gx-btn--tonal gx-wrap">Open your Galaxy link</a></p>
<section class="gx-card gx-panel gx-stack"><h3>App key</h3><p>Use this key to add remote access in the phone app. Keep it private.</p>
<div v-if="!keyVisible" class="gx-actions"><button class="gx-btn" @click="showAppKey">Show</button></div>
<template v-else><code class="gx-wrap">{{ appKey }}</code><div class="gx-actions"><button class="gx-btn" @click="copyAppKey">Copy</button></div>
<img src="./api/galaxy/session/qr.svg" class="gx-tunnel__qr" alt="Add remote access to Galaxy" /></template>
</section>
<div class="gx-actions"><button type="button" class="gx-btn gx-btn--danger" @click="unpair">{{ busy ? 'Disconnecting…' : 'Turn off remote access' }}</button></div>
</template>
<template v-else>
<p v-if="legacyPassword">Enter your existing password to keep your Galaxy link.</p>
<p v-else-if="legacyPairingAvailable">Enter your old password to keep the link, or choose a new one with at least 8 characters.</p>
<p v-else>Choose a password to pair your comma.</p>
<div class="gx-actions"><input class="gx-field gx-filter-field" type="password" v-model="password" :minlength="legacyPassword || legacyPairingAvailable ? 6 : 8" maxlength="255" :autocomplete="legacyPassword ? 'current-password' : 'new-password'" :placeholder="legacyPassword ? 'Existing Galaxy password' : legacyPairingAvailable ? 'Existing or new Galaxy password' : 'New password (at least 8 characters)'" @keydown.enter="pair" />
<button type="button" class="gx-btn" :disabled="password.trim().length < (legacyPassword || legacyPairingAvailable ? 6 : 8)" @click="pair">{{ busy ? 'Setting up…' : 'Set up remote access' }}</button></div>
</template>
<GxNotice tone="danger" v-if="error">{{ error }}</GxNotice>
</template>
</div>
</li>`,
}
@@ -32,12 +32,12 @@ export const RouteCleanup = {
<p class="gx-note">Remove all saved driving routes and their logs. This does not reset settings or software.</p>
<GxNotice v-if="error" tone="danger">{{ error }}</GxNotice>
<GxNotice v-if="notice" tone="success">{{ notice }}</GxNotice>
<div class="gx-actions"><button type="button" class="gx-btn gx-recordings__danger" @click="confirmOpen=true" :disabled="busy">Delete all driving routes</button></div>
<div class="gx-actions"><button type="button" class="gx-btn gx-btn--danger" @click="confirmOpen=true" :disabled="busy">Delete all driving routes</button></div>
<GxDialog v-if="confirmOpen" labelledby="gx-route-cleanup-title" :alert="true" @close="!busy && (confirmOpen=false)">
<h3 id="gx-route-cleanup-title">Delete all driving routes?</h3>
<p>This permanently removes every saved route, including preserved routes and their logs. Settings and software are not changed.</p>
<div class="gx-actions"><button type="button" class="gx-btn gx-btn--tonal" @click="confirmOpen=false" :disabled="busy">Cancel</button>
<button type="button" class="gx-btn gx-recordings__danger" @click="removeAll" :disabled="busy">Delete routes</button></div>
<button type="button" class="gx-btn gx-btn--danger" @click="removeAll" :disabled="busy">Delete routes</button></div>
</GxDialog>
</section>`,
}
@@ -1,3 +1,4 @@
import { GxCollapse } from './disclosure.js'
import { GxNotice } from "./notice.js"
import { reportSave } from "./save-feedback.js"
export const channels = ["webPush", "discord", "webhook", "ntfy"]
@@ -58,7 +59,7 @@ export class NotificationClient {
}
export const SentryNotifications = {
components: { GxNotice },
components: { GxCollapse, GxNotice },
name: "SentryNotifications",
props: { mode: { type: String, required: true }, unauthorized: { type: Function, required: true } },
data: () => ({ nativePush: !!window.StarPilotApp?.sentryPush, pushState: {}, testingId: '', testPoll: null, relayUrl: '', enrollmentCode: '', relayConfirmed: false, channels, labels, notifications: null, notificationBusy: false, notificationTesting: false, notificationError: "",
@@ -237,7 +238,7 @@ export const SentryNotifications = {
<label class="gx-switch"><input type="checkbox" role="switch" :aria-label="labels[name] + ' notifications'" :checked="channelExpanded(name)"
:disabled="notificationBusy"
@change="$event.target.checked=channelExpanded(name); toggleChannel(name)"><span class="gx-switch__track"></span><span class="gx-switch__thumb"></span></label></div>
<div v-if="channelExpanded(name)" class="gx-panel gx-stack">
<GxCollapse><div v-if="channelExpanded(name)" class="gx-panel gx-stack">
<p class="gx-note" role="status">{{ notifications.channels[name].configured ? 'Configured' : 'Not configured' }}<template v-if="notifications.channels[name].configured && notifications.channels[name].lastState !== 'idle'">, last delivery {{ notifications.channels[name].lastState }}<template v-if="notifications.channels[name].pending">, {{ notifications.channels[name].pending }} pending</template></template></p>
<GxNotice tone="danger" v-if="notifications.channels[name].lastError">Delivery status: {{ notifications.channels[name].lastError.replaceAll('_', ' ') }}</GxNotice>
<div v-if="name !== 'webPush'" class="gx-sentry-channel__fields">
@@ -249,7 +250,7 @@ export const SentryNotifications = {
<button v-else class="gx-btn gx-btn--tonal" type="button" @click="subscribe">Subscribe this browser</button>
<button class="gx-btn gx-btn--tonal" type="button" :disabled="!notifications.channels[name].enabled || !notifications.channels[name].configured" @click="test(name)">Send test</button>
<button class="gx-btn gx-btn--tonal" type="button" @click="forget(name)">Forget configuration</button>
</div></div>
</div></div></GxCollapse>
</section>
<div v-if="notifications.subscriptionCount" class="gx-actions"><span class="gx-note">Subscribed browsers: {{ notifications.subscriptionCount }}</span>
<button v-for="(subscription, index) in notifications.subscriptions" :key="subscription.id" class="gx-btn gx-btn--tonal" type="button" @click="remove(subscription.id)">Remove browser {{ index + 1 }}</button></div>
@@ -1,3 +1,4 @@
import { GxCollapse } from './disclosure.js'
import { requestJson } from "./startup.js"
import { GxDialog } from "./dialog.js"
import { GxState } from "./state.js"
@@ -274,7 +275,7 @@ export class SettingsFeed {
export const SettingsPage = {
emits: ["nested"],
components: { AppReminderSettings, GxDialog, GxState, GalaxySettingRow, OnroadLayoutPage, FavoritesPage, SoundPacks, CloudProviderPage, ReverseProxySettings, GxNotice, VehicleControlsPage },
components: { GxCollapse, AppReminderSettings, GxDialog, GxState, GalaxySettingRow, OnroadLayoutPage, FavoritesPage, SoundPacks, CloudProviderPage, ReverseProxySettings, GxNotice, VehicleControlsPage },
props: {
mode: { type: String, required: true }, unauthorized: { type: Function, required: true },
initialPage: { type: String, default: "hub" }, title: { type: String, default: "Toggles" },
@@ -511,9 +512,11 @@ export const SettingsPage = {
<button v-if="state.data.page !== 'hub' && state.data.rows.length" type="button" class="gx-icon-btn" :aria-label="state.searchOpen ? 'Close page search' : 'Search within this page'" :aria-pressed="state.searchOpen" @click="togglePageSearch"><i class="bi" :class="state.searchOpen ? 'bi-x-lg' : 'bi-search'" aria-hidden="true"></i></button>
</div>
<div v-if="state.searchOpen && !cardIndex" class="gx-settings__search"><input ref="pageSearch" v-model="state.query" class="gx-field" type="search" aria-label="Search within this page" placeholder="Search within…"></div>
<GalaxySettingRow v-for="{ row, index } in (card.open ? card.entries : [])" :key="rowKey(row, index)" :row="row" :index="index"
<GxCollapse><div v-if="card.open">
<GalaxySettingRow v-for="{ row, index } in card.entries" :key="rowKey(row, index)" :row="row" :index="index"
:busy="busy" :disabled="!!state.error || !row.available" :save-value="(index, value) => feed.previewValue(index, value)" :test-alert="state.data.page === 'sounds' ? testAlert : null"
@open="open" @review="(index, direction) => feed.preview(index, direction)" @reset-default="index => feed.resetDefault(index)" />
</div></GxCollapse>
<div v-if="!cardIndex && !visibleRows.length" class="gx-empty">No matching settings.</div>
</section>
<SoundPacks v-if="state.data.page === 'sounds'" :unauthorized="unauthorized" :busy="busy" @installed="refreshSoundChoices" />
+36 -36
View File
@@ -436,7 +436,7 @@ export const SpotifyPage = {
</template>
</GxNotice>
<section v-if="setup" class="gx-card gx-starport-step" aria-labelledby="gx-music-source-title">
<section v-if="setup" class="gx-card gx-step" aria-labelledby="gx-music-source-title">
<h3 id="gx-music-source-title">Music Source</h3>
<label class="gx-stack"><span>Play music from</span>
<select class="gx-field" :value="setup.preferences.source || 'spotify'" :disabled="busy" @change="chooseSource">
@@ -481,7 +481,7 @@ export const SpotifyPage = {
<small v-if="phoneSource && !setup.parked" class="gx-note">Put the car in Park or use offroad mode to change the phone.</small>
</section>
<section v-if="setup && setupDone && !phoneSource" class="gx-card gx-starport-step gx-starport-home gx-spotify-now" aria-labelledby="gx-spotify-now-title">
<section v-if="setup && setupDone && !phoneSource" class="gx-card gx-step gx-starport-home gx-spotify-now" aria-labelledby="gx-spotify-now-title">
<div class="gx-spotify-now__main">
<div class="gx-spotify-now__text">
<h3 id="gx-spotify-now-title" class="gx-truncate"><span translate="no">{{ track?.title || setup.preferences.deviceName }}</span></h3>
@@ -516,13 +516,13 @@ export const SpotifyPage = {
</div>
</section>
<ol v-if="setup" v-show="phoneSource || !setupDone || showSetup" id="gx-spotify-steps" class="gx-starport__steps">
<li v-if="!phoneSource" class="gx-card gx-starport-step" :class="{ 'gx-starport-step--done': installed }">
<div class="gx-starport-step__head">
<span class="gx-starport-step__num" aria-hidden="true"><i v-if="installed" class="bi bi-check-lg"></i><template v-else>1</template></span>
<ol v-if="setup" v-show="phoneSource || !setupDone || showSetup" id="gx-spotify-steps" class="gx-steps">
<li v-if="!phoneSource" class="gx-card gx-step" :class="{ 'gx-step--done': installed }">
<div class="gx-step__head">
<span class="gx-step__num" aria-hidden="true"><i v-if="installed" class="bi bi-check-lg"></i><template v-else>1</template></span>
<div><h3>Spotify Soloist</h3><p>Spotify’s player for devices like your comma. You download it from Spotify, then upload it here.</p></div>
</div>
<div class="gx-starport-step__body">
<div class="gx-step__body">
<div class="gx-starport-status">
<span class="gx-starport-pill" :class="'gx-starport-pill--' + release.level" role="status">{{ release.label }}</span>
<div class="gx-actions gx-starport-status__actions">
@@ -537,12 +537,12 @@ export const SpotifyPage = {
</div>
</li>
<li v-if="!phoneSource" class="gx-card gx-starport-step" :class="{ 'gx-starport-step--done': setup.keyPresent }">
<div class="gx-starport-step__head">
<span class="gx-starport-step__num" aria-hidden="true"><i v-if="setup.keyPresent" class="bi bi-check-lg"></i><template v-else>2</template></span>
<li v-if="!phoneSource" class="gx-card gx-step" :class="{ 'gx-step--done': setup.keyPresent }">
<div class="gx-step__head">
<span class="gx-step__num" aria-hidden="true"><i v-if="setup.keyPresent" class="bi bi-check-lg"></i><template v-else>2</template></span>
<div><h3>Your API Key</h3><p>Spotify gives each person their own key. Creating one needs Spotify Premium.</p></div>
</div>
<div class="gx-starport-step__body">
<div class="gx-step__body">
<template v-if="setup.keyPresent && !keyEditing">
<span class="gx-starport-pill gx-starport-pill--ok" role="status">Key saved on this comma</span>
<div class="gx-actions">
@@ -567,12 +567,12 @@ export const SpotifyPage = {
</div>
</li>
<li class="gx-card gx-starport-step" :class="{ 'gx-starport-step--done': outputChosen }">
<div class="gx-starport-step__head">
<span class="gx-starport-step__num" aria-hidden="true"><i v-if="outputChosen" class="bi bi-check-lg"></i><template v-else>3</template></span>
<li class="gx-card gx-step" :class="{ 'gx-step--done': outputChosen }">
<div class="gx-step__head">
<span class="gx-step__num" aria-hidden="true"><i v-if="outputChosen" class="bi bi-check-lg"></i><template v-else>3</template></span>
<div><h3>Where Music Plays</h3><p>Send music from the comma to your car speakers through StarPort (Android Auto), or to a Bluetooth car stereo or speaker. Alerts keep playing from the comma itself.</p></div>
</div>
<div class="gx-starport-step__body">
<div class="gx-step__body">
<label class="gx-stack"><span>Send audio to</span>
<select class="gx-field" :value="setup.preferences.output === 'bluetooth' ? setup.preferences.outputAddress : setup.preferences.output" :disabled="busy || !setup.parked" @change="chooseOutput">
<option value="" disabled>Choose an audio output…</option>
@@ -590,12 +590,12 @@ export const SpotifyPage = {
</div>
</li>
<li v-if="!phoneSource" class="gx-card gx-starport-step" :class="{ 'gx-starport-step--done': setupDone && setup.enabled && player?.loggedIn }">
<div class="gx-starport-step__head">
<span class="gx-starport-step__num" aria-hidden="true"><i v-if="setupDone && setup.enabled && player?.loggedIn" class="bi bi-check-lg"></i><template v-else>4</template></span>
<li v-if="!phoneSource" class="gx-card gx-step" :class="{ 'gx-step--done': setupDone && setup.enabled && player?.loggedIn }">
<div class="gx-step__head">
<span class="gx-step__num" aria-hidden="true"><i v-if="setupDone && setup.enabled && player?.loggedIn" class="bi bi-check-lg"></i><template v-else>4</template></span>
<div><h3>Connect Spotify</h3><p>Turn it on, then pick <strong><span translate="no">{{ setup.preferences.deviceName }}</span></strong> in the Spotify app’s device list.</p></div>
</div>
<div class="gx-starport-step__body">
<div class="gx-step__body">
<GalaxySettingRow :row="switchRow('Spotify', setup.enabled, 'Runs Spotify on your comma. Turn off to stop playing; your setup stays saved.')"
:index="0" :busy="busy" :save-value="(index, value) => setEnabled(value === 'On')" />
<p v-if="setup.enabled" class="gx-note" role="status">{{ statusText }}</p>
@@ -609,7 +609,7 @@ export const SpotifyPage = {
</li>
</ol>
<section v-if="setup && !phoneSource && (setupDone ? showSetup : setup.release.installed)" class="gx-card gx-starport-step" aria-labelledby="gx-spotify-manage-title">
<section v-if="setup && !phoneSource && (setupDone ? showSetup : setup.release.installed)" class="gx-card gx-step" aria-labelledby="gx-spotify-manage-title">
<h3 id="gx-spotify-manage-title">Storage and Account</h3>
<label class="gx-stack"><span>Music cache</span>
<select class="gx-field" :value="setup.preferences.cacheMb" :disabled="busy" @change="saveCache">
@@ -689,14 +689,14 @@ export const SpotifyPage = {
<h3 id="gx-spotify-install-title">{{ setup.release.installed ? 'Install a Newer Soloist' : 'Install Spotify Soloist' }}</h3>
<p class="gx-note">{{ setup.release.installed ? release.label + '. Your settings and Spotify sign-in stay as they are.' : 'Download it from Spotify, then send it to your comma.' }}</p>
</div>
<ol class="gx-starport-sheet__steps">
<li class="gx-starport-step-card" :class="{ 'gx-starport-sheet__step--muted': installState !== 'choose' }">
<div class="gx-starport-step-card__head">
<span class="gx-starport-step__num gx-starport-step-card__num">1</span>
<div class="gx-starport-step-card__title"><strong>Download Soloist</strong>
<ol class="gx-steps gx-steps--compact">
<li class="gx-step-card" :class="{ 'gx-starport-sheet__step--muted': installState !== 'choose' }">
<div class="gx-step-card__head">
<span class="gx-step__num gx-step-card__num">1</span>
<div class="gx-step-card__title"><strong>Download Soloist</strong>
<small>From Spotify’s Downloads page, to this {{ onPhone ? 'phone' : 'computer' }}</small></div>
</div>
<div class="gx-starport-step-card__body">
<div class="gx-step-card__body">
<a class="gx-btn gx-btn--tonal" :href="setup.links.download" target="_blank" rel="noopener noreferrer" @click="markDownloadStarted">
<i class="bi bi-box-arrow-up-right" aria-hidden="true"></i> Open Spotify Downloads</a>
<ol class="gx-note gx-starport-mirror-steps">
@@ -705,13 +705,13 @@ export const SpotifyPage = {
</ol>
</div>
</li>
<li class="gx-starport-step-card" :class="{ 'gx-starport-sheet__step--muted': installState !== 'choose' }">
<div class="gx-starport-step-card__head">
<span class="gx-starport-step__num gx-starport-step-card__num">2</span>
<div class="gx-starport-step-card__title"><strong>Choose the downloaded file</strong>
<li class="gx-step-card" :class="{ 'gx-starport-sheet__step--muted': installState !== 'choose' }">
<div class="gx-step-card__head">
<span class="gx-step__num gx-step-card__num">2</span>
<div class="gx-step-card__title"><strong>Choose the downloaded file</strong>
<small>{{ downloadStarted && downloadsHint ? downloadsHint : 'The file you just downloaded' }}</small></div>
</div>
<div class="gx-starport-step-card__body">
<div class="gx-step-card__body">
<label class="gx-btn gx-btn--tonal gx-starport-file" :class="{ 'gx-starport-file--disabled': installState !== 'choose' }">
<input type="file" :accept="onPhone ? undefined : '.gz,.tgz,application/gzip'" aria-label="Soloist .tar.gz download" :disabled="installState !== 'choose'" @change="chooseArchive" />
<i class="bi bi-folder2-open"></i> {{ archiveFile ? 'Choose a Different File' : 'Choose File' }}
@@ -723,12 +723,12 @@ export const SpotifyPage = {
<small v-if="archiveError" class="gx-starport-bad" role="alert">{{ archiveError }}</small>
</div>
</li>
<li class="gx-starport-step-card">
<div class="gx-starport-step-card__head">
<span class="gx-starport-step__num gx-starport-step-card__num">3</span>
<div class="gx-starport-step-card__title"><strong>Install</strong><small>Send it to your comma and check it with Spotify</small></div>
<li class="gx-step-card">
<div class="gx-step-card__head">
<span class="gx-step__num gx-step-card__num">3</span>
<div class="gx-step-card__title"><strong>Install</strong><small>Send it to your comma and check it with Spotify</small></div>
</div>
<div class="gx-starport-step-card__body">
<div class="gx-step-card__body">
<button v-if="installState === 'choose'" class="gx-btn gx-starport-cta" :disabled="!!uploadReason" @click="upload">Install</button>
<small v-if="installState === 'choose' && uploadReason && archiveFile && !archiveError" class="gx-note" role="status">{{ uploadReason }}</small>
<div v-if="installState === 'uploading'" role="status" aria-live="polite" class="gx-stack">
+42 -41
View File
@@ -1,3 +1,4 @@
import { GxCollapse } from './disclosure.js'
import { GxState } from "./state.js"
import { GxDialog } from "./dialog.js"
import { GxIconButton } from "./icon-button.js"
@@ -570,7 +571,7 @@ export function connectionProgress(runtime, { wired = false, app = "", selected
}
export const StarPortPage = {
components: { GxState, GxIconButton, GxNotice, BluetoothNotice, GxDialog, GalaxySettingRow, StarPortGuidedSetup },
components: { GxCollapse, GxState, GxIconButton, GxNotice, BluetoothNotice, GxDialog, GalaxySettingRow, StarPortGuidedSetup },
props: {
mode: { type: String, required: true }, localAccess: { type: Boolean, required: true },
unauthorized: { type: Function, required: true }
@@ -930,13 +931,13 @@ export const StarPortPage = {
<GxNotice tone="warn" v-if="!wired && !app && runtime?.dedicated_wifi_interface === false">StarPort uses the comma’s Wi-Fi to connect to your car and disconnects it from your current Wi-Fi network. Use the Galaxy hotspot for local access during projection. Remote Galaxy access requires Internet on the comma.</GxNotice>
<GxNotice tone="danger" v-if="error && setup">{{ error }}</GxNotice>
<GxNotice v-if="!setup" :busy="!error" :tone="error ? 'danger' : 'info'">{{ error || "Checking StarPort setup… Reconnecting automatically…" }}</GxNotice>
<section v-if="setup" class="gx-card gx-starport-step" :class="{ 'gx-starport-step--done': supportReady }">
<div class="gx-starport-step__head">
<span class="gx-starport-step__num" aria-hidden="true"><i v-if="supportReady" class="bi bi-check-lg"></i><template v-else>1</template></span>
<section v-if="setup" class="gx-card gx-step" :class="{ 'gx-step--done': supportReady }">
<div class="gx-step__head">
<span class="gx-step__num" aria-hidden="true"><i v-if="supportReady" class="bi bi-check-lg"></i><template v-else>1</template></span>
<div><h3>StarPort Support</h3><p v-if="supportCollapsed" role="status">{{ expiry.label }}</p><p v-else>Turn on StarPort and install support. Wireless pairing also needs Bluetooth on; Galaxy will offer to enable it.</p></div>
<button v-if="supportReady && setup.installReady" type="button" class="gx-btn gx-btn--tonal" :aria-expanded="!supportCollapsed" aria-controls="gx-starport-support" @click="supportOpen = !supportOpen">{{ supportCollapsed ? 'Manage' : 'Hide' }}</button>
</div>
<div id="gx-starport-support" v-show="!supportCollapsed" class="gx-starport-step__body">
<GxCollapse><div id="gx-starport-support" v-show="!supportCollapsed" class="gx-step__body">
<p v-if="!setup.installReady" class="gx-starport-pill gx-starport-pill--expired" role="status">Not available on this build — the StarPort display and encoder are missing.</p>
<template v-else>
<div class="gx-starport-status">
@@ -968,7 +969,7 @@ export const StarPortPage = {
<li><strong>Why is this needed?</strong> Car screens only talk to devices that present Google’s Android Auto certificate. Your comma reads it from your own copy of the app, on the device. No Android app is installed on the comma.</li>
</ul>
</details>
</div>
</div></GxCollapse>
</section>
<StarPortGuidedSetup v-if="setup && newSetup && guided.show" id="gx-starport-guided" :state="guided" :busy="busy" :choices-disabled="appDisabled"
@choose-type="chooseType" @choose-adapter="chooseAdapter" @choose-app="chooseApp" @use-car="useCar" @classic="useClassic" @reset-handshake="resetHandshake" @continue-ladder="continueLadder" @dismiss-suggestion="dismissSuggestion" @done="showSteps = false">
@@ -991,13 +992,13 @@ export const StarPortPage = {
</template>
</StarPortGuidedSetup>
<p v-else-if="setup && !newSetup && !setupDone" class="gx-note"><button type="button" class="gx-btn gx-btn--tonal" :disabled="busy" @click="useGuided">Try the guided setup</button></p>
<ol v-if="setup && !newSetup" id="gx-starport-steps" class="gx-starport__steps">
<li v-show="!setupDone || showSteps" class="gx-card gx-starport-step" :class="{ 'gx-starport-step--done': !!selected && !pairing?.active }">
<div class="gx-starport-step__head">
<span class="gx-starport-step__num" aria-hidden="true"><i v-if="selected && !pairing?.active" class="bi bi-check-lg"></i><template v-else>2</template></span>
<ol v-if="setup && !newSetup" id="gx-steps" class="gx-steps">
<li v-show="!setupDone || showSteps" class="gx-card gx-step" :class="{ 'gx-step--done': !!selected && !pairing?.active }">
<div class="gx-step__head">
<span class="gx-step__num" aria-hidden="true"><i v-if="selected && !pairing?.active" class="bi bi-check-lg"></i><template v-else>2</template></span>
<div><h3>{{ carType === 'usb' ? 'Set Up Wired AA' : carType === 'app' ? 'Set Up Your App' : adapterSetup ? 'Pair Your Adapter' : 'Pair Your Car' }}</h3><p>{{ adapterSetup ? 'Put the adapter in pairing mode, then tap Find adapter. Your car doesn’t need to be paired.' : pairsHere ? 'Open your car’s phone pairing screen, then tap Find car. You can do this before step 1 is finished.' : 'No Bluetooth pairing is needed for this setup.' }}</p></div>
</div>
<div class="gx-starport-step__body">
<div class="gx-step__body">
<button v-if="setupDone && showSteps" class="gx-btn gx-btn--tonal" @click="showSteps = false">Hide Setup</button>
<GalaxySettingRow :row="carTypeRow" :index="0" :busy="busy" :disabled="appDisabled" :save-value="saveCarType" />
<GxNotice v-if="wiredUnavailable" tone="warn">Wired AA is unavailable: {{ runtime.wired_blocked }}.</GxNotice>
@@ -1030,13 +1031,13 @@ export const StarPortPage = {
</li>
</ol>
<section v-if="setup && setupDone && !showSteps && (!newSetup || !guided.show)" class="gx-card gx-starport-step gx-starport-home" aria-labelledby="gx-starport-home-title">
<div class="gx-starport-step__head">
<span class="gx-starport-step__num" :class="{ 'gx-starport-home__icon--live': projecting }" aria-hidden="true"><i class="bi bi-car-front"></i></span>
<section v-if="setup && setupDone && !showSteps && (!newSetup || !guided.show)" class="gx-card gx-step gx-starport-home" aria-labelledby="gx-starport-home-title">
<div class="gx-step__head">
<span class="gx-step__num" :class="{ 'gx-starport-home__icon--live': projecting }" aria-hidden="true"><i class="bi bi-car-front"></i></span>
<div><h3 id="gx-starport-home-title">{{ homeTitle }}</h3>
<p role="status">{{ runtime?.running && runtime.state !== 'streaming' ? connectionProgress.title : projecting ? 'Showing StarPilot on your car’s screen.' : wired ? wiredStatus.label : runtime?.auto_connect ? 'Connects automatically when you start driving.' : 'Ready to connect.' }}</p></div>
</div>
<div class="gx-starport-step__body">
<div class="gx-step__body">
<p v-if="expiry.level === 'soon'" class="gx-starport-pill gx-starport-pill--soon" role="status">{{ expiry.label }}</p>
<template v-if="!newSetup">
<GalaxySettingRow :row="carTypeRow" :index="0" :busy="busy" :disabled="appDisabled" :save-value="saveCarType" />
@@ -1061,7 +1062,7 @@ export const StarPortPage = {
${CONNECT}
<div class="gx-actions">
<a class="gx-btn gx-btn--tonal" href="#/theme_maker/starport"><i class="bi bi-layout-text-window" aria-hidden="true"></i> Customize Layout</a>
<button type="button" class="gx-btn gx-btn--tonal" :aria-expanded="showSteps" :aria-controls="newSetup ? 'gx-starport-guided' : 'gx-starport-steps'" @click="showSteps = !showSteps">
<button type="button" class="gx-btn gx-btn--tonal" :aria-expanded="showSteps" :aria-controls="newSetup ? 'gx-starport-guided' : 'gx-steps'" @click="showSteps = !showSteps">
<i :class="showSteps ? 'bi bi-chevron-up' : 'bi bi-gear'" aria-hidden="true"></i> {{ showSteps ? 'Hide Setup' : newSetup ? 'Change how your car connects' : 'Setup and Pairing' }}</button>
<button v-if="canResetHandshake" type="button" class="gx-btn gx-btn--tonal" :disabled="busy" @click="resetHandshake"
title="Go back to the standard handshake. Your Bluetooth pairing is kept.">
@@ -1069,13 +1070,13 @@ export const StarPortPage = {
</div>
</div>
</section>
<ol v-if="setup" class="gx-starport__steps">
<li v-show="!setupDone || showSteps" class="gx-card gx-starport-step">
<div class="gx-starport-step__head">
<span class="gx-starport-step__num" aria-hidden="true">3</span>
<ol v-if="setup" class="gx-steps">
<li v-show="!setupDone || showSteps" class="gx-card gx-step">
<div class="gx-step__head">
<span class="gx-step__num" aria-hidden="true">3</span>
<div><h3>Customize Your Dashboard</h3><p>Once connected, customize your dashboard setup.</p></div>
</div>
<div class="gx-starport-step__body">
<div class="gx-step__body">
<a class="gx-btn gx-btn--tonal gx-starport-cta" href="#/starport/audio"><i class="bi bi-spotify" aria-hidden="true"></i> Spotify and Phone Audio</a>
<a class="gx-btn gx-btn--tonal gx-starport-cta" href="#/theme_maker/starport">Customize Layout</a>
<a class="gx-btn gx-btn--tonal gx-starport-cta" href="#/navigation/maps"><i class="bi bi-map" aria-hidden="true"></i> Offline Road Maps</a>
@@ -1084,12 +1085,12 @@ export const StarPortPage = {
</li>
</ol>
<section v-if="setup" class="gx-card gx-starport-step" aria-labelledby="gx-starport-help-title">
<div class="gx-starport-step__head">
<span class="gx-starport-step__num" aria-hidden="true"><i class="bi bi-question-circle"></i></span>
<section v-if="setup" class="gx-card gx-step" aria-labelledby="gx-starport-help-title">
<div class="gx-step__head">
<span class="gx-step__num" aria-hidden="true"><i class="bi bi-question-circle"></i></span>
<div><h3 id="gx-starport-help-title">Still having trouble?</h3><p>Our wiki has detailed help for pairing, connection status, other phones, wireless adapters, and screen problems.</p></div>
</div>
<div class="gx-starport-step__body">
<div class="gx-step__body">
<div class="gx-driving__actions gx-actions">
<a class="gx-btn" href="https://wiki.firestar.link/exclusive/android-auto/" target="_blank" rel="noopener noreferrer">Read the Android Auto troubleshooting guide</a>
<a class="gx-btn gx-btn--tonal" href="#/logs/starport"><i class="bi bi-journal-text"></i> Connection Logs</a>
@@ -1140,16 +1141,16 @@ export const StarPortPage = {
</div>
</div>
</div>
<ol class="gx-starport-sheet__steps">
<li class="gx-starport-step-card" :class="{ 'gx-starport-sheet__step--muted': installState !== 'choose' }">
<div class="gx-starport-step-card__head">
<span class="gx-starport-step__num gx-starport-step-card__num">1</span>
<div class="gx-starport-step-card__title">
<ol class="gx-steps gx-steps--compact">
<li class="gx-step-card" :class="{ 'gx-starport-sheet__step--muted': installState !== 'choose' }">
<div class="gx-step-card__head">
<span class="gx-step__num gx-step-card__num">1</span>
<div class="gx-step-card__title">
<strong>Download Android Auto</strong>
<small>{{ download.direct ? 'Saves the app to this ' + (onPhone ? 'phone' : 'computer') : download.pending ? 'Looking up the newest release…' : 'Get the newest release from APKMirror' }}<template v-if="installedVersion"> · You have {{ installedVersion }}</template></small>
</div>
</div>
<div class="gx-starport-step-card__body">
<div class="gx-step-card__body">
<a v-if="download.direct" class="gx-btn gx-btn--tonal" :href="download.url" rel="noreferrer" download @click="markDownloadStarted">
<i class="bi bi-download" aria-hidden="true"></i> Download Android Auto {{ download.version }} · {{ download.megabytes }} MB
</a>
@@ -1169,15 +1170,15 @@ export const StarPortPage = {
<small v-if="download.direct" class="gx-note">From APKPure, a third-party mirror (<a class="gx-link" href="https://apkpure.com/terms.html" target="_blank" rel="noopener noreferrer">terms</a>). Don’t unzip it.</small>
</div>
</li>
<li class="gx-starport-step-card" :class="{ 'gx-starport-sheet__step--muted': installState !== 'choose' }">
<div class="gx-starport-step-card__head">
<span class="gx-starport-step__num gx-starport-step-card__num">2</span>
<div class="gx-starport-step-card__title">
<li class="gx-step-card" :class="{ 'gx-starport-sheet__step--muted': installState !== 'choose' }">
<div class="gx-step-card__head">
<span class="gx-step__num gx-step-card__num">2</span>
<div class="gx-step-card__title">
<strong>Choose the downloaded file</strong>
<small>{{ downloadStarted && downloadsHint ? downloadsHint : 'The file you just downloaded' }}</small>
</div>
</div>
<div class="gx-starport-step-card__body">
<div class="gx-step-card__body">
<label class="gx-btn gx-btn--tonal gx-starport-file" :class="{ 'gx-starport-file--disabled': installState !== 'choose' }">
<input type="file" :accept="onPhone ? undefined : '.apk,.xapk,.apkm,.zip'" aria-label="Android Auto APK, XAPK, APKM, or ZIP" :disabled="installState !== 'choose'" @change="choosePackage" />
<i class="bi bi-folder2-open"></i> {{ packageFile ? 'Choose a Different File' : 'Choose File' }}
@@ -1191,15 +1192,15 @@ export const StarPortPage = {
<small v-if="packageError" class="gx-starport-bad" role="alert">{{ packageError }}</small>
</div>
</li>
<li class="gx-starport-step-card">
<div class="gx-starport-step-card__head">
<span class="gx-starport-step__num gx-starport-step-card__num">3</span>
<div class="gx-starport-step-card__title">
<li class="gx-step-card">
<div class="gx-step-card__head">
<span class="gx-step__num gx-step-card__num">3</span>
<div class="gx-step-card__title">
<strong>Install</strong>
<small>Send it to your comma and check the certificate</small>
</div>
</div>
<div class="gx-starport-step-card__body">
<div class="gx-step-card__body">
<button v-if="installState === 'choose'" class="gx-btn gx-starport-cta" :disabled="!!uploadReason" @click="upload">
{{ setup.enabled ? 'Install' : 'Turn On and Install' }}
</button>