diff --git a/openpilot/starpilot/galaxy/README.md b/openpilot/starpilot/galaxy/README.md index 3137067b89..fc5fb8abac 100644 --- a/openpilot/starpilot/galaxy/README.md +++ b/openpilot/starpilot/galaxy/README.md @@ -63,7 +63,7 @@ No docs build, sync, or network lookup is required; update this file when a wiki | Maps | Local map status and a parked catalog-region download, progress, or cancellation. A completed selection takes effect at the next map service start. | | Cameras and Sentry | Saved PiP and V-ASM settings and bounded Sentry event metadata. The crop editor uses a browser-local still image; it does not upload that image. | | Sound packs | Catalog status, verified download and cancellation through the local sound owner. | -| Galaxy Access & Install | Remote link pairing, Galaxy installation, and an opt-in Wi-Fi hotspot. Local addresses are on Home. | +| Galaxy Access & Connections | Remote link pairing, Galaxy installation, Networks, Bluetooth, and support. Local addresses are on Home. | `Refresh` and branch changes request filtered history metadata in a separate Git cache and worker. They remain available during diff --git a/openpilot/starpilot/galaxy/controller_diagnostics.py b/openpilot/starpilot/galaxy/controller_diagnostics.py new file mode 100644 index 0000000000..25f8ca1daf --- /dev/null +++ b/openpilot/starpilot/galaxy/controller_diagnostics.py @@ -0,0 +1,56 @@ +"""Capture the USB and Bluetooth input inventory without opening any event device.""" + +from base64 import b64encode +from datetime import datetime, timezone +import hashlib +from io import BytesIO +import json +import secrets +from zipfile import ZIP_DEFLATED, ZipFile + +from openpilot.starpilot.controllers import input as controller_input + + +def controller_input_report(): + """Include interfaces filtered out of Attached Controllers and mask device names per report.""" + devices = [] + groups = {} + salt = secrets.token_bytes(8) + truncated = False + for entry in sorted(controller_input.SYS_ROOT.iterdir()): + if not controller_input.EVENT_NAME.fullmatch(entry.name): + continue + device = entry / 'device' + match = controller_input.MODALIAS.match(controller_input._text(device / 'modalias')) + if match is None or int(match[1], 16) not in controller_input.EXTERNAL_BUSES: + continue + if len(devices) == controller_input.MAX_CANDIDATES: + truncated = True + break + node = controller_input.DEV_ROOT / entry.name + identity = controller_input._inspect(node) + if identity is not None: + groups.setdefault(identity.device_id, []).append(entry.name) + name = controller_input._text(device / 'name') + devices.append({ + 'event': entry.name, + 'name': f'masked-{hashlib.sha256(salt + name.encode()).hexdigest()[:8]}' if name else '', + 'inputId': match[0], + 'properties': controller_input._text(device / 'properties'), + 'capabilities': {key: controller_input._text(device / 'capabilities' / key) for key in ('ev', 'key', 'rel', 'abs')}, + 'discovery': 'eligible' if identity else 'filtered', + 'eventNodePresent': node.exists(), + }) + duplicates = {event: events for events in groups.values() if len(events) > 1 for event in events} + for row in devices: + if row['event'] in duplicates: + row.update(discovery='duplicate identity', matchingEvents=duplicates[row['event']]) + return {'externalInputInterfaces': devices, 'truncated': truncated} + + +def controller_capture(): + report = {'schemaVersion': 1, 'capturedAt': datetime.now(timezone.utc).isoformat(timespec='seconds'), **controller_input_report()} + output = BytesIO() + with ZipFile(output, 'w', compression=ZIP_DEFLATED) as archive: + archive.writestr('bluetooth-log.json', json.dumps(report, indent=2) + '\n') + return {'schemaVersion': 1, 'zipBase64': b64encode(output.getvalue()).decode('ascii')} diff --git a/openpilot/starpilot/galaxy/http_server.py b/openpilot/starpilot/galaxy/http_server.py index 359b5122e1..a7b10ea77a 100644 --- a/openpilot/starpilot/galaxy/http_server.py +++ b/openpilot/starpilot/galaxy/http_server.py @@ -246,7 +246,7 @@ class _LocalHTTPHandler(BaseHTTPRequestHandler): if cookie is not None: self.send_header('Set-Cookie', cookie) self.send_header('Content-Security-Policy', "default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; " + - "img-src 'self' data: blob:; media-src 'self' blob:; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'") + "img-src 'self' data: blob:; media-src 'self' blob:; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action https://starpilot-log-relay.nathan-g-hubbard.workers.dev/report/galaxy/fresh/") self.end_headers() if self.command != 'HEAD': self.wfile.write(body) diff --git a/openpilot/starpilot/galaxy/local_access.py b/openpilot/starpilot/galaxy/local_access.py index 911f35e039..c8d7cead04 100644 --- a/openpilot/starpilot/galaxy/local_access.py +++ b/openpilot/starpilot/galaxy/local_access.py @@ -1,10 +1,16 @@ """Actual LAN addresses for direct Galaxy access, independent of the tunnel.""" +from base64 import b64encode +from concurrent.futures import ThreadPoolExecutor +from io import BytesIO +from datetime import datetime, timezone from ipaddress import IPv4Address, ip_network import json +import re import subprocess import threading import time +from zipfile import ZIP_DEFLATED, ZipFile LAN = tuple(ip_network(value) for value in ('10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16', '169.254.0.0/16')) @@ -73,3 +79,158 @@ class LocalAccess: 'reason': '' if addresses else reason} self.expiry = self.clock() + 5.0 return self.cached + + +DISCOVERY_UNIT = 'galaxy-lan-discovery.service' +DISCOVERY_MESSAGE = re.compile( + r'(Galaxy Wi-Fi discovery available on [0-9]{1,3} local interface\(s\)|' + r'Wi-Fi discovery unavailable: [A-Za-z][A-Za-z0-9_]{0,63}|LAN publisher cleanup failed)\Z', +) + + +BLE_UNIT = 'galaxy-ble-fork.service' +BLE_MESSAGE = re.compile( + r'(Pairing credentials changed; [0-9]{1,4} phone\(s\) paired|Phone claimed pairing window|' + r'Galaxy BLE handshake challenge requested; active sessions=[0-9]{1,4}|' + r'Rejected invalid or unauthenticated BLE message|Notification transfer interrupted \([A-Za-z0-9_]{1,64}\); reconnect to check request outcome|' + r'BLE advertisement released by BlueZ; bridge will re-register after restart|Registering Galaxy BLE advertisement|' + r'Starting Galaxy bridge pid=[0-9]{1,10} source=[0-9a-f]{12}|' + r'Galaxy BLE bridge ready on /org/bluez/hci[0-9]{1,3}; forwarding to localhost:[0-9]{1,5}|' + r'Stopping Galaxy bridge; clearing ready status and Bluetooth sessions)\Z', +) +INTERFACE_NAME = re.compile(r'[A-Za-z0-9_.:-]{1,32}\Z') + + +def _network_inventory(run): + lines = [] + try: + result = run(['ip', '-j', '-4', 'address', 'show'], capture_output=True, timeout=1, check=True) + rows = json.loads(result.stdout) if len(result.stdout) <= 65536 else None + if not isinstance(rows, list): + raise ValueError('Invalid network inventory') + for row in rows[:64]: + if not isinstance(row, dict): + continue + name = row.get('ifname') + if not isinstance(name, str) or not INTERFACE_NAME.fullmatch(name): + continue + state = row.get('operstate') + if state not in ('UNKNOWN', 'NOTPRESENT', 'DOWN', 'LOWERLAYERDOWN', 'TESTING', 'DORMANT', 'UP'): + state = 'unknown' + flags = row.get('flags', []) + if not isinstance(flags, list): + flags = [] + flags = ','.join(flag for flag in ('UP', 'LOWER_UP', 'RUNNING', 'MULTICAST', 'LOOPBACK') if flag in flags) + addresses = [] + info_rows = row.get('addr_info', []) + for info in info_rows[:16] if isinstance(info_rows, list) else []: + if not isinstance(info, dict): + continue + try: + address, prefix = IPv4Address(info.get('local')), info.get('prefixlen') + except ValueError: + continue + if any(address in network for network in LAN) and type(prefix) is int and 0 <= prefix <= 32: + addresses.append(f'{address}/{prefix}') + lines.append(f'{name}: state={state}; flags={flags or "none"}; private IPv4={", ".join(addresses) or "none"}') + except (OSError, subprocess.SubprocessError, ValueError): + lines.append('Network interface inventory unavailable') + try: + result = run(['ip', '-j', '-4', 'route', 'show', 'default'], capture_output=True, timeout=1, check=True) + rows = json.loads(result.stdout) if len(result.stdout) <= 65536 else None + if not isinstance(rows, list): + raise ValueError('Invalid route inventory') + interfaces = [row['dev'] for row in rows[:16] if isinstance(row, dict) + and isinstance(row.get('dev'), str) and INTERFACE_NAME.fullmatch(row['dev'])] + lines.append('IPv4 default route interfaces: ' + (', '.join(interfaces) or 'none')) + except (OSError, subprocess.SubprocessError, ValueError): + lines.append('IPv4 default route inventory unavailable') + try: + result = run(['ss', '-H', '-lnt', 'sport = :8082'], capture_output=True, timeout=1, check=True) + bindings = set() + for line in result.stdout.decode('ascii', errors='replace').splitlines()[:32]: + fields = line.split() + if len(fields) < 5 or fields[0] != 'LISTEN' or not fields[3].endswith(':8082'): + continue + host = fields[3][:-5] + if host in ('*', '0.0.0.0', '[::]'): + bindings.add('all interfaces') + elif host.startswith('127.') or host == '[::1]': + bindings.add('loopback') + else: + bindings.add('specific interface') + lines.append('TCP port 8082 listening: ' + (', '.join(sorted(bindings)) or 'no')) + except (OSError, subprocess.SubprocessError): + lines.append('TCP port 8082 listener state unavailable') + return lines + + +def _service_capture(run, unit, pattern, label): + state = 'unavailable' + details = [] + try: + result = run(['systemctl', 'show', unit, '--property=ActiveState,SubState,Result,NRestarts,ExecMainStatus'], + capture_output=True, timeout=1, check=True) + for line in result.stdout.decode('ascii', errors='replace').splitlines()[:12]: + if re.fullmatch(r'(?:ActiveState|SubState|Result)=[a-z][a-z0-9-]{0,39}|(?:NRestarts|ExecMainStatus)=[0-9]{1,10}', line): + if line.startswith('ActiveState='): + state = line.split('=', 1)[1] + else: + details.append(line) + except (OSError, subprocess.SubprocessError): + pass + lines = [f'{label}: {state}', *details, 'Recent service events (last 2 hours, up to 120 journal records read)'] + try: + result = run(['journalctl', '--no-pager', '--quiet', '-u', unit, '--since', '-2h', + '-n', '120', '-o', 'json', '--output-fields=MESSAGE'], + capture_output=True, timeout=2, check=True) + events = [] + for raw in result.stdout.splitlines()[-120:]: + if len(raw) > 8192: + continue + try: + entry = json.loads(raw) + message = entry.get('MESSAGE') if isinstance(entry, dict) else None + if isinstance(message, str) and pattern.fullmatch(message): + stamp = entry.get('__REALTIME_TIMESTAMP', '') + if isinstance(stamp, str) and re.fullmatch(r'[0-9]{1,16}', stamp): + timestamp = datetime.fromtimestamp(int(stamp) / 1e6, timezone.utc).isoformat(timespec='seconds') + message = f'{timestamp} {message}' + events.append(message) + except (ValueError, OSError, OverflowError): + continue + lines.extend(events or ['No matching events']) + except (OSError, subprocess.SubprocessError): + lines.append('Advertiser journal unavailable' if unit == DISCOVERY_UNIT else 'BLE journal unavailable') + return lines + + +def connection_capture(addresses, *, configuration_allowed=None, run=subprocess.run): + lines = ['StarPilot connection capture', 'Capture schema: 2', + f'Captured at (UTC): {datetime.now(timezone.utc).isoformat(timespec="seconds")}', + 'Galaxy endpoint: HTTP port 8082', 'Bonjour service: _sp-galaxy._tcp.local.'] + try: + with open('/proc/uptime') as stream: + lines.append(f'Comma uptime: {float(stream.read(128).split()[0]):.0f} seconds') + except (OSError, ValueError, IndexError): + lines.append('Comma uptime: unavailable') + if configuration_allowed is not None: + try: + lines.append(f'Parked configuration allowed: {bool(configuration_allowed())}') + except Exception: + lines.append('Parked configuration allowed: unavailable') + lines.extend(['', 'Advertisable local addresses']) + lines.extend(f'{row["interface"]}: {row["url"]}' for row in addresses['addresses']) + if not addresses['available']: + lines.append(addresses['reason'] or 'No eligible local address') + with ThreadPoolExecutor(max_workers=3) as pool: + network = pool.submit(_network_inventory, run) + discovery = pool.submit(_service_capture, run, DISCOVERY_UNIT, DISCOVERY_MESSAGE, 'Bonjour advertiser') + bluetooth = pool.submit(_service_capture, run, BLE_UNIT, BLE_MESSAGE, 'Bluetooth bridge') + lines.extend(['', 'Network interfaces', *network.result(), '', *discovery.result(), '', *bluetooth.result()]) + report = '\n'.join(lines) + '\n' + output = BytesIO() + with ZipFile(output, 'w', compression=ZIP_DEFLATED) as archive: + archive.writestr('connection-logs.txt', report) + # Keep the original text field for browsers still running the previous page. + return {'schemaVersion': 1, 'text': report[:16384], 'zipBase64': b64encode(output.getvalue()).decode('ascii')} diff --git a/openpilot/starpilot/galaxy/server.py b/openpilot/starpilot/galaxy/server.py index a13753b455..3b18a92d7f 100644 --- a/openpilot/starpilot/galaxy/server.py +++ b/openpilot/starpilot/galaxy/server.py @@ -51,7 +51,7 @@ from openpilot.starpilot.ui.layout_preview_transport import (request_profile) from openpilot.starpilot.favorites.owner import FavoritesChanged from openpilot.starpilot.galaxy.favorites import FavoritesGateway from openpilot.starpilot.galaxy.system_monitor import SystemMonitor -from openpilot.starpilot.galaxy.local_access import LocalAccess +from openpilot.starpilot.galaxy.local_access import LocalAccess, connection_capture from openpilot.starpilot.galaxy.tmux_live import TmuxLive from openpilot.starpilot.galaxy.vehicle_selection import VehicleSelectionChanged, VehicleSelectionGateway, VehicleSelectionUnverified from openpilot.starpilot.bluetooth.owner import BluetoothOwner, BluetoothRejected, BluetoothUnavailable, normalized_address @@ -186,6 +186,7 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe summary_lock = threading.Lock() motion_events = sentry_events if sentry_events is not None else SentryEvents() sentry_events_lock = threading.Lock() + simulation_busy = threading.Event() last_simulation = [float("-inf")] notification_owner = notifications snapshots = camera_snapshot if camera_snapshot is not None else CameraSnapshot() @@ -693,9 +694,11 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe return False def settings_session(self): - token = self.session_token() + return self.current_settings_session(self.session_token(), self.direct_local()) + + def current_settings_session(self, token, direct_local): with session_lock: - if self.direct_local() and sessions.valid(token, local_generation): + if direct_local and sessions.valid(token, local_generation): return token, local_generation generation = access.current_generation() if getattr(self.server, 'remote_transport', False): @@ -954,7 +957,7 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe return from openpilot.starpilot.galaxy.pairing_ready import bridge_state, pairing_readiness self.json(200, pairing_readiness(parked=configuration_allowed, snapshot=lambda: bluetooth_owner().snapshot(), bridge=bridge_state)) - elif path in ('/api/local-access', '/api/tmux/live', '/api/troubleshoot'): + elif path in ('/api/local-access', '/api/local-access/capture', '/api/controllers/log/capture', '/api/tmux/live', '/api/troubleshoot'): if not self.require_session(): return identity = self.settings_session() @@ -964,6 +967,11 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe try: if path == '/api/local-access': result = address_source.snapshot() + elif path == '/api/local-access/capture': + result = connection_capture(address_source.snapshot(), configuration_allowed=configuration_allowed) + elif path == '/api/controllers/log/capture': + from openpilot.starpilot.galaxy.controller_diagnostics import controller_capture + result = controller_capture() elif path == '/api/tmux/live': result = console_source.snapshot() else: @@ -1090,7 +1098,7 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe except ValueError: route_key = '' try: - result = navigation_owner().snapshot(route_key if re.fullmatch(r'[0-9a-f]{16}', route_key) else None) + result = navigation_owner().snapshot(route_key if re.fullmatch(r'[0-9a-hjkmnp-tv-z]{12}', route_key) else None) except (OSError, ValueError, RuntimeError): self.json(503, {'error': 'Navigation status is unavailable'}) else: @@ -1457,7 +1465,9 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe self.json(400, {'error': 'Choose an event image'}) return try: - body = motion_events.image(parts[0], parts[1]) + body = notification_owner.test_image(parts[0]) if parts[1] == 'test' else motion_events.image(parts[0], parts[1]) + if body is None: + raise SentryEventsUnavailable except SentryEventsUnavailable: self.json(404, {'error': 'Event image unavailable'}) else: @@ -1743,7 +1753,7 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe '/api/galaxy/pair', '/api/galaxy/unpair', '/api/galaxy/device-name', '/api/galaxy/hotspot', '/api/galaxy/networks', '/api/cameras/snapshot', '/api/cameras/white-balance', '/api/starport/layout', '/api/starport/enable', '/api/starport/control', '/api/starport/pairing', - '/api/starport/logs/send', + '/api/starport/logs/send', '/api/companion/support-ticket', '/api/starport/pairing/response', '/api/starport/pairing/cancel', '/api/starport/pairing/select', '/api/spotify/enable', '/api/spotify/key', '/api/spotify/preferences', '/api/spotify/control', '/api/spotify/maintenance', '/api/ui/layout', '/api/ui/layout/preview', '/api/favorites/slots', @@ -1753,7 +1763,7 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe '/api/models/cancel', '/api/models/delete', '/api/models/refresh_manifest', '/api/models/jetlink', '/api/models/laboratory', '/api/models/laboratory/download', '/api/models/laboratory/delete', '/api/sounds/preview', '/api/sounds/download', '/api/sounds/cancel', '/api/software/action', '/api/drives/ignore', - '/api/recordings/delete-videos', '/api/sentry/notifications', '/api/sentry/events/delete', '/api/crash-reports/delete', + '/api/recordings/delete-videos', '/api/sentry/notifications', '/api/sentry/notifications/photo-test', '/api/sentry/events/delete', '/api/crash-reports/delete', '/api/navigation/search', '/api/navigation/action', '/api/navigation/offline', '/api/drive-state/action', '/api/toyota-tools/action', '/api/vehicle-selection/preview', '/api/vehicle-selection/confirm'): self.json(405, {'error': 'Method unavailable'}) @@ -1817,6 +1827,51 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe else: self.json(200 if authorized() else 401, result if authorized() else {'error': 'Sign in to Galaxy'}) return + if path == '/api/companion/support-ticket': + import requests + identity = self.settings_session() + if identity is None: + self.json(401, {'error': 'Sign in to Galaxy'}) + return + if (not isinstance(payload, dict) or not isinstance(payload.get('code'), str) or + not re.fullmatch(r'[0-9a-f]{16}', payload['code']) or payload.get('action') not in ('check', 'send')): + self.json(400, {'error': 'Enter the code from the Discord request.'}) + return + relay = 'https://starpilot-log-relay.nathan-g-hubbard.workers.dev/report/galaxy/device' + def relay_post(body): + response = requests.post(relay, json=body, allow_redirects=False, timeout=(5, 30)) + if response.status_code == 410: + raise LookupError() + response.raise_for_status() + if response.status_code != 200: + raise ValueError() + return response.json() + try: + code = payload['code'] + ticket = relay_post({'action': 'check', 'code': code}) + kind = ticket['kind'] + if kind not in ('controller', 'connection'): + raise ValueError() + if payload['action'] == 'check': + self.json(200, {'kind': kind, 'title': ticket['title']}) + return + if kind == 'controller': + from openpilot.starpilot.galaxy.controller_diagnostics import controller_capture + capture = controller_capture() + else: + capture = connection_capture(address_source.snapshot(), configuration_allowed=configuration_allowed) + if self.settings_session() != identity: + self.json(401, {'error': 'Sign in to Galaxy'}) + return + result = relay_post({'action': 'send', 'code': code, 'archive': capture['zipBase64']}) + if result.get('sent') is not True: + raise ValueError() + self.json(200, {'sent': True}) + except LookupError: + self.json(410, {'error': 'Code expired or incorrect. Reopen the request in Discord.'}) + except (requests.RequestException, OSError, RuntimeError, TypeError, ValueError): + self.json(503, {'error': 'Could not confirm delivery. Check the comma internet connection and your Discord thread.'}) + return if path == '/api/settings/flm-finding/accept': identity = self.settings_session() if identity is None: @@ -1929,6 +1984,43 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe if self.require_session(): self.json(200, result) return + if path == '/api/sentry/notifications/photo-test': + if (type(payload) is not dict or set(payload) != {'camera', 'id'} or payload['camera'] not in ('wide', 'cabin') or + not isinstance(payload['id'], str) or not re.fullmatch(r'[0-9a-f]{12}', payload['id'])): + self.json(400, {'error': 'Choose a phone and camera'}) + return + identity = self.settings_session() + if identity is None: + self.json(401, {'error': 'Sign in to Galaxy'}) + return + + def permitted(): + readable, _, _ = select.select([self.connection], [], [], 0) + if readable and not self.connection.recv(1, socket.MSG_PEEK | socket.MSG_DONTWAIT): + return False + return self.settings_session() == identity and parked() + + try: + photo = snapshots.capture(payload['camera'], permitted=permitted, parked=True) + notification_owner.photo_test(payload['id'], payload['camera'], photo, permitted=permitted) + except (SnapshotDenied, PermissionError): + if self.require_session(): + self.json(409, {'error': 'Park the car before sending a photo test'}) + except SnapshotUnavailable: + if self.require_session(): + self.json(503, {'error': 'No fresh camera frame. Try again shortly.'}) + except LookupError: + self.json(404, {'error': 'Phone subscription not found'}) + except ValueError as error: + self.json(400, {'error': str(error)}) + except (NotificationUnavailable, OSError): + self.json(503, {'error': 'Sentry phone push is unavailable. Check Galaxy Sentry settings.'}) + else: + if self.settings_session() == identity: + self.json(200, {'queued': True}) + else: + self.json(401, {'error': 'Sign in to Galaxy'}) + return if path == '/api/sentry/notifications': identity = self.settings_session() if identity is None: @@ -1942,11 +2034,32 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe if not parked(): self.json(403, {'error': 'Park the car before simulating an event'}) return - if clock() - last_simulation[0] < 10: + if simulation_busy.is_set() or clock() - last_simulation[0] < 10: self.json(429, {'error': 'Wait ten seconds before simulating another event'}) return - notification_owner.store.record('warning', time.monotonic_ns(), simulated=True, - permitted=lambda: self.settings_session() == identity and parked()) + from openpilot.starpilot.sentry_mode.capture import record_motion_event + direct_local = self.direct_local() + + def permitted(): + return self.current_settings_session(identity[0], direct_local) == identity and parked() + + def capture_simulation(): + try: + record_motion_event(notification_owner.store, snapshots, 'warning', time.monotonic_ns(), + permitted, simulated=True) + except SnapshotDenied: + pass + except Exception: + cloudlog.exception("Sentry simulation could not record the event") + finally: + simulation_busy.clear() + + simulation_busy.set() + try: + threading.Thread(target=capture_simulation, name='sentry-simulation', daemon=True).start() + except RuntimeError: + simulation_busy.clear() + raise NotificationUnavailable("Could not start Sentry simulation") last_simulation[0] = clock() result = notification_owner.snapshot() else: diff --git a/openpilot/starpilot/galaxy/tests/browser/regressions.cjs b/openpilot/starpilot/galaxy/tests/browser/regressions.cjs index 82cbbacaa1..4b3d2432c5 100644 --- a/openpilot/starpilot/galaxy/tests/browser/regressions.cjs +++ b/openpilot/starpilot/galaxy/tests/browser/regressions.cjs @@ -137,7 +137,7 @@ const layout = JSON.parse(execFileSync(process.env.PYTHON || 'python3', ['-c', await page.evaluate(()=>location.hash='/tools') await page.getByRole('heading',{name:'Tools',exact:true}).waitFor() const sidebar=page.locator('.gx-nav-section').filter({has:page.locator('.gx-nav-section__title',{hasText:/^Tools$/})}) - assert.deepEqual(await sidebar.locator('.gx-nav-item span').allTextContents(), (await page.locator('.gx-menu-tile > span').allTextContents()).filter(name => name !== 'Galaxy Access & Install')) + assert.deepEqual(await sidebar.locator('.gx-nav-item span').allTextContents(), (await page.locator('.gx-menu-tile > span').allTextContents()).filter(name => name !== 'Galaxy Access & Connections')) assert.deepEqual(errors,[]) console.log('Browser checks passed: VASM frame/default/reactive updates, PiP crop frame, widget registry, recordings and phone layout. Captures:',draws) await browser.close() diff --git a/openpilot/starpilot/galaxy/tests/test_bluetooth.mjs b/openpilot/starpilot/galaxy/tests/test_bluetooth.mjs index 396152686b..c582aeb2ba 100644 --- a/openpilot/starpilot/galaxy/tests/test_bluetooth.mjs +++ b/openpilot/starpilot/galaxy/tests/test_bluetooth.mjs @@ -1,3 +1,4 @@ +import { ConnectionLogs } from "../web/js/local-access.js" import assert from "node:assert/strict" import { BluetoothFeed, BluetoothPage, validBluetoothStatus, validPairInput } from "../web/js/bluetooth.js" @@ -111,3 +112,6 @@ assert.equal(validBluetoothStatus({ ...status, pairing: { address: "not-an-addre assert.equal(validBluetoothStatus({ ...status, adapterName: 5 }), false) assert.match(BluetoothPage.template, /Pair phone/) assert.match(BluetoothPage.template, /action\('accept_pair'\)/) + +assert.equal(BluetoothPage.components.ConnectionLogs, ConnectionLogs) +assert.ok(BluetoothPage.template.includes(" [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 { tools } = JSON.parse(readFileSync(new URL('../web/data/catalog.json', import.meta.url))) +const galaxy = tools.find(tool => tool.path === '/galaxy') +const visits = [] const app = renderer.createApp({ ...GalaxyPage, components: { ...GalaxyPage.components, - GalaxyHotspot: { template: '
Hotspot settings
' }, InstallApp: { props: ['url'], template: '' }, -} }, { mode: 'local', unauthorized() { unauthorized++ } }) +} }, { mode: 'local', tools: galaxy.children, go: path => visits.push(path), unauthorized() { unauthorized++ } }) app.config.compilerOptions.decodeEntities = value => value.replaceAll('&', '&') const vm = app.mount(host) await flush() @@ -53,7 +56,14 @@ try { 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.match(text(host), /Galaxy Access & Connections/) + assert.doesNotMatch(text(host), /MB today|Status:|offline app version/) + assert.ok(tools.some(tool => tool.path === '/starport'), 'StarPort remains a standalone tool') + const tiles = nodes.filter(item => item.props.class === 'gx-menu-tile') + assert.deepEqual(tiles.map(item => item.children.find(child => child.type === 'span').text), ['Networks', 'Bluetooth']) + for (const tile of tiles) tile.props.onClick() + nodes.find(item => item.type === 'button' && item.text === 'Get help').props.onClick() + assert.deepEqual(visits, ['/networks', '/bluetooth', '/logs/help']) 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') diff --git a/openpilot/starpilot/galaxy/tests/test_home_polish.mjs b/openpilot/starpilot/galaxy/tests/test_home_polish.mjs index 61d020c91d..83123ce9f3 100644 --- a/openpilot/starpilot/galaxy/tests/test_home_polish.mjs +++ b/openpilot/starpilot/galaxy/tests/test_home_polish.mjs @@ -10,7 +10,7 @@ assert.ok(ids.every(id => recordArt(id).every(path => typeof path === "string" & assert.ok(recordArt("futureRecord").length) assert.ok(Home.template.includes('recordArt(record.id)')) assert.ok(Home.template.includes('aria-hidden="true">Galaxy Access & Install')) +assert.ok(GalaxyPage.template.includes('>Galaxy Access & Connections')) assert.ok(!GalaxyPage.template.includes('Galaxy & App Install')) assert.ok(!GalaxyPage.template.includes('Android users:')) assert.ok(!GalaxyPage.template.includes('Phone companion · Connections')) @@ -18,8 +18,8 @@ assert.ok(GalaxyPage.template.indexOf('Get the app')) assert.ok(GalaxyPage.template.includes('')) -assert.ok(GalaxyPage.template.includes('href="#/networks"')) -assert.ok(GalaxyPage.template.indexOf(' value.replaceAll('&', '&') }) console.log('Galaxy local access remains independent of app installation') + +const capture = { onUnauthorized() { assert.fail('unexpected sign-in request') }, + ...ConnectionLogs.data(), ...ConnectionLogs.methods } +const originalFetch = globalThis.fetch +try { + globalThis.fetch = async (url, options) => { + assert.equal(url, './api/local-access/capture') + assert.equal(options.credentials, 'same-origin') + return { ok: true, json: async () => ({ schemaVersion: 1, zipBase64: 'UEsDBAAAAAAAAAAAAAAAAAAAAAAAAAAA' }) } + } + await capture.captureConnectionLogs() + assert.equal(capture.capture.type, 'application/zip') + assert.equal(capture.captureRequest, null) + capture.resetCapture() + assert.equal(capture.capture, null) +} finally { globalThis.fetch = originalFetch } +const thread = { ...ConnectionLogs.data(), ...ConnectionLogs.methods, supportCode: 'AB12 CD34-EF56' } +try { + globalThis.fetch = async (url, options) => { + assert.equal(url, './api/companion/support-ticket') + const { action, code } = JSON.parse(options.body) + assert.equal(code, 'ab12cd34ef56') + const body = action === 'check' ? { title: 'Lost network', kind: 'connection' } : { sent: true } + return { ok: true, json: async () => body } + } + await thread.threadAction('check') + assert.equal(thread.supportTicket.title, 'Lost network') + assert.equal(thread.supportSent, false) + await thread.threadAction('send') + assert.equal(thread.supportSent, true) +} finally { globalThis.fetch = originalFetch } +assert.equal(LocalAccess.components.ConnectionLogs, ConnectionLogs) +assert.ok(LocalAccess.template.includes("mode === 'local'")) +compile(ConnectionLogs.template, { decodeEntities: value => value }) +assert.ok(ConnectionLogs.template.includes('Send to existing Discord thread')) +assert.ok(ConnectionLogs.components.ReportingGuide.template.includes('#submit-logs-through-discord')) +assert.ok(ConnectionLogs.components.ReportingGuide.template.includes('#report-a-problem-through-discord')) +assert.match(ConnectionLogs.template, /]*>Manual ZIP download<\/small><\/summary>[\s\S]*Download ZIP<\/button>\s*<\/details>/) +for (const endpoint of ['./api/galaxy/qr.svg', './api/galaxy/session/qr.svg']) { + const qr = {endpoint, ...RemoteQR.data(), ...RemoteQR.methods} + try { + globalThis.fetch = async (path, options) => { + assert.equal(path, endpoint) + assert.equal(options.credentials, 'same-origin') + return new Response('',{headers:{'Content-Type':'image/svg+xml'}}) + } + await qr.load() + assert.match(qr.image, /^blob:/) + assert.equal(qr.failed, false) + assert.equal((await originalFetch(qr.image)).headers.get('content-type'), 'image/svg+xml') + RemoteQR.beforeUnmount.call(qr) + await assert.rejects(originalFetch(qr.image)) + } finally { globalThis.fetch = originalFetch } +} diff --git a/openpilot/starpilot/galaxy/tests/test_network_diagnostics.py b/openpilot/starpilot/galaxy/tests/test_network_diagnostics.py index 3b4e65e31f..ed0cb27e5d 100644 --- a/openpilot/starpilot/galaxy/tests/test_network_diagnostics.py +++ b/openpilot/starpilot/galaxy/tests/test_network_diagnostics.py @@ -1,6 +1,9 @@ """Pure bounded network/launcher readers; never imports native vehicle modules.""" import ast +from base64 import b64decode +from io import BytesIO +from zipfile import ZipFile from pathlib import Path import threading import json @@ -8,7 +11,7 @@ import subprocess from types import SimpleNamespace import unittest -from openpilot.starpilot.galaxy.local_access import LocalAccess +from openpilot.starpilot.galaxy.local_access import LocalAccess, connection_capture from openpilot.starpilot.galaxy.tmux_live import TmuxLive, MAX_BYTES @@ -66,6 +69,56 @@ class TestNetworkDiagnostics(unittest.TestCase): for run in [lambda *_a, **_k: SimpleNamespace(stdout=b'x' * 65537), lambda *_a, **_k: (_ for _ in ()).throw(subprocess.TimeoutExpired('ip', 1))]: self.assertFalse(LocalAccess(run=run).snapshot()['available']) + def test_connection_capture_includes_only_known_advertiser_events(self): + source, _ = self.addresses([interface()]) + commands = [] + + def run(args, **_kwargs): + commands.append(args) + if args[0] == 'systemctl': + return SimpleNamespace(stdout=b'ActiveState=active\nSubState=running\nNRestarts=3\n') + if args[0] == 'ip': + state = [{'dev': 'wlan0', 'gateway': '192.168.50.1'}] if 'route' in args else [ + {'ifname': 'wlan0', 'operstate': 'UP', 'address': 'de:ad:be:ef:00:01', + 'addr_info': [{'local': '192.168.50.21', 'prefixlen': 24}, {'local': '8.8.8.8', 'prefixlen': 32}]}] + return SimpleNamespace(stdout=json.dumps(state).encode()) + if args[0] == 'ss': + return SimpleNamespace(stdout=b'LISTEN 0 20 0.0.0.0:8082 0.0.0.0:*') + if 'galaxy-ble-fork.service' in args: + return SimpleNamespace(stdout=b'{"MESSAGE":"Phone claimed pairing window"}') + rows = [{'MESSAGE': 'Galaxy Wi-Fi discovery available on 1 local interface(s)'}, + {'MESSAGE': 'Wi-Fi discovery unavailable: TimeoutExpired'}, + {'MESSAGE': 'Wi-Fi discovery unavailable: cookie=private'}, + {'MESSAGE': 'Tunnel password: private'}] + return SimpleNamespace(stdout='\n'.join(map(json.dumps, rows)).encode()) + + capture = connection_capture(source.snapshot(), run=run) + self.assertEqual(capture['schemaVersion'], 1) + self.assertIn('http://192.168.50.21:8082/', capture['text']) + self.assertIn('Bonjour advertiser: active', capture['text']) + self.assertIn('Galaxy Wi-Fi discovery available on 1 local interface(s)', capture['text']) + self.assertIn('Wi-Fi discovery unavailable: TimeoutExpired', capture['text']) + self.assertNotIn('Tunnel password:', capture['text']) + self.assertTrue(any('galaxy-lan-discovery.service' in args for args in commands)) + with ZipFile(BytesIO(b64decode(capture['zipBase64']))) as archive: + self.assertEqual(archive.namelist(), ['connection-logs.txt']) + report = archive.read('connection-logs.txt').decode() + self.assertIn('192.168.50.21/24', report) + self.assertIn('IPv4 default route interfaces: wlan0', report) + self.assertIn('TCP port 8082 listening: all interfaces', report) + self.assertIn('NRestarts=3', report) + self.assertIn('Phone claimed pairing window', report) + for private_value in ('de:ad:be:ef:00:01', '192.168.50.1', '8.8.8.8', 'cookie=private'): + self.assertNotIn(private_value, report) + + def missing(*_args, **_kwargs): + raise FileNotFoundError() + + partial = connection_capture(source.snapshot(), run=missing)['text'] + self.assertIn('Bonjour advertiser: unavailable', partial) + self.assertIn('Advertiser journal unavailable', partial) + self.assertIn('192.168.50.21', partial) + def test_console_uses_exact_readonly_launcher_pane_and_cache(self): source, calls = self.console(b'first\nsecond\n') result = source.snapshot() diff --git a/openpilot/starpilot/galaxy/tests/test_networks.mjs b/openpilot/starpilot/galaxy/tests/test_networks.mjs index 93d814d236..6c33672abe 100644 --- a/openpilot/starpilot/galaxy/tests/test_networks.mjs +++ b/openpilot/starpilot/galaxy/tests/test_networks.mjs @@ -1,3 +1,4 @@ +import { ConnectionLogs } from "../web/js/local-access.js" import assert from 'node:assert/strict' import { compile } from '../web/vendor/vue/vue.esm-browser.js' import { NetworksPage, validNetworks } from '../web/js/networks.js' @@ -66,3 +67,6 @@ const before = sent.length assert.equal(await vm.send({ action: 'cellular', value: false }), false) assert.equal(sent.length, before) vm.stop() + +assert.equal(NetworksPage.components.ConnectionLogs, ConnectionLogs) +assert.ok(NetworksPage.template.includes(" .gx-section__header { margin: calc(-1 * var(--panel-padding)) calc(-1 * var(--panel-padding)) var(--sp-4); } +.gx-connection-logs.gx-panel > .gx-section__header { margin-bottom: 0; } +.gx-connection-logs .gx-log-form { display: grid; gap: var(--sp-3); margin-top: var(--sp-3); } +.gx-log-form .gx-field { width: 100%; box-sizing: border-box; } +.gx-log-form p { margin: 0; } +.gx-log-form .gx-btn { justify-self: start; } +@media (max-width: 600px) { + .gx-connection-logs .gx-log-form .gx-btn, .gx-connection-logs details > summary.gx-btn { width: 100%; box-sizing: border-box; } +} .gx-panel > :first-child { margin-top: 0; } .gx-panel > :last-child { margin-bottom: 0; } .gx-panel-footer { padding: 0 var(--panel-padding) var(--panel-padding); } diff --git a/openpilot/starpilot/galaxy/web/data/catalog.json b/openpilot/starpilot/galaxy/web/data/catalog.json index 4d7d8ae067..aabffd30b6 100644 --- a/openpilot/starpilot/galaxy/web/data/catalog.json +++ b/openpilot/starpilot/galaxy/web/data/catalog.json @@ -1,13 +1,6 @@ { "mode": "offline-preview", "tools": [ - { - "name": "Bluetooth", - "path": "/bluetooth", - "icon": "bi-bluetooth", - "description": "Adapter power, saved devices and connections", - "availability": "local-only" - }, { "name": "Cameras & Monitoring", "path": "/cameras", @@ -39,11 +32,27 @@ ] }, { - "name": "Galaxy Access & Install", + "name": "Galaxy Access & Connections", "path": "/galaxy", "icon": "bi-globe2", - "description": "Pair for remote access, install Galaxy, or set up a Wi-Fi hotspot", - "availability": "local-only" + "description": "Remote access, app setup, networks, Bluetooth, and support", + "availability": "local-only", + "children": [ + { + "name": "Networks", + "path": "/networks", + "icon": "bi-wifi", + "description": "Preferred Wi-Fi, cellular data and the Galaxy hotspot", + "availability": "local-only" + }, + { + "name": "Bluetooth", + "path": "/bluetooth", + "icon": "bi-bluetooth", + "description": "Adapter power, saved devices and connections", + "availability": "local-only" + } + ] }, { "name": "Logs & Diagnostics", @@ -96,10 +105,10 @@ "availability": "local-only" }, { - "name": "Help & Community", + "name": "Get help", "path": "/logs/help", "icon": "bi-life-preserver", - "description": "Guides and community help", + "description": "Driving, phone connection, controllers, and StarPort support", "availability": "always" } ] @@ -141,13 +150,6 @@ } ] }, - { - "name": "Networks", - "path": "/networks", - "icon": "bi-wifi", - "description": "Preferred Wi-Fi, cellular data and the Galaxy hotspot", - "availability": "local-only" - }, { "name": "System Tools", "path": "/system", diff --git a/openpilot/starpilot/galaxy/web/js/app.js b/openpilot/starpilot/galaxy/web/js/app.js index 86783841ab..d234bd1ec2 100644 --- a/openpilot/starpilot/galaxy/web/js/app.js +++ b/openpilot/starpilot/galaxy/web/js/app.js @@ -154,7 +154,11 @@ createApp({ state.drawerOpen = state.navPinned save(PIN_KEY, String(state.navPinned)) }, - isActive(path) { return route.path === path || route.path.startsWith(path + "/") || (path === "/manage_models" && route.path === "/model_laboratory") }, + isActive(path) { + if (path === "/galaxy" && ["/networks", "/bluetooth"].some(child => + route.path === child || route.path.startsWith(child + "/"))) return true + return route.path === path || route.path.startsWith(path + "/") || (path === "/manage_models" && route.path === "/model_laboratory") + }, async signIn() { const password = authForm.password authForm.password = "" @@ -224,7 +228,7 @@ createApp({
@@ -254,11 +258,11 @@ createApp({ - - + + - + { location.hash = path } }, unidenSettings: Boolean, mode: { type: String, required: true }, unauthorized: { type: Function, required: true } }, data: () => ({ status: null, busy: false, error: "", pairValue: "", now: Date.now(), claimAt: Date.now(), forgetting: null, adding: false, dismissedPairing: null }), mounted() { @@ -322,5 +323,7 @@ export const BluetoothPage = {
- `, + + + `, } diff --git a/openpilot/starpilot/galaxy/web/js/driving-help.js b/openpilot/starpilot/galaxy/web/js/driving-help.js new file mode 100644 index 0000000000..4dfe8bfbe7 --- /dev/null +++ b/openpilot/starpilot/galaxy/web/js/driving-help.js @@ -0,0 +1,42 @@ +export const DrivingHelp = { + props: { + routeId: { type: String, default: "" }, + segment: { type: Number, default: null }, + connect: { type: String, default: "" }, + routesAvailable: Boolean, + }, + emits: ["routes"], + data: () => ({ copied: false }), + computed: { + routeDetails() { + return this.routeId + (this.segment === null ? "" : " · Segment " + this.segment) + }, + }, + watch: { routeDetails() { this.copied = false } }, + methods: { + async copyDetails() { + this.copied = false + const details = this.routeDetails + try { + await navigator.clipboard.writeText(details) + if (details === this.routeDetails) this.copied = true + } catch { + // Local Galaxy commonly runs on HTTP, where the Clipboard API is unavailable. + this.$refs.details?.select() + } + }, + }, + template: `
+

Find the drive, then share the route link and approximate timestamp or segment. Describe what the car did and what you expected.

+
+ + +
+ +

Connect directly to your comma to browse saved Galaxy routes.

+
`, +} diff --git a/openpilot/starpilot/galaxy/web/js/galaxy.js b/openpilot/starpilot/galaxy/web/js/galaxy.js index e17efdf1c3..478868631f 100644 --- a/openpilot/starpilot/galaxy/web/js/galaxy.js +++ b/openpilot/starpilot/galaxy/web/js/galaxy.js @@ -1,3 +1,4 @@ +import { MenuTile } from './menu-tile.js' import { WikiHelp } from './wiki-help.js' import { AppStoreLinks } from './app-downloads.js' import { InstallApp } from './install-app.js' @@ -6,12 +7,25 @@ import { CompanionUpdates } from './companion-updates.js' export const GalaxyPage = { name: 'GalaxyPage', - components: { WikiHelp, AppStoreLinks, InstallApp, RemoteAccess, CompanionUpdates }, - props: { mode: { type: String, required: true }, unauthorized: { type: Function, required: true } }, + components: { WikiHelp, AppStoreLinks, InstallApp, RemoteAccess, CompanionUpdates, MenuTile }, + props: { + mode: { type: String, required: true }, unauthorized: { type: Function, required: true }, + tools: { type: Array, default: () => [] }, go: { type: Function, default: path => { location.hash = path } }, + }, data: () => ({ url: '' }), template: `
-

Galaxy Access & Install

-

Set up your link, then choose how to open Galaxy.

+
+

Galaxy Access & Connections

+
+ + +
+
+
+ +
  1. @@ -24,8 +38,5 @@ export const GalaxyPage = {
-
Galaxy Wi-Fi Hotspot
-

The hotspot, preferred Wi-Fi networks and cellular data are on the Networks page.

-
`, } diff --git a/openpilot/starpilot/galaxy/web/js/home.js b/openpilot/starpilot/galaxy/web/js/home.js index 383150afe1..69746a7a9f 100644 --- a/openpilot/starpilot/galaxy/web/js/home.js +++ b/openpilot/starpilot/galaxy/web/js/home.js @@ -202,7 +202,7 @@ export const Home = { template: `
-

Dashboard

Your saved drives and current device

+

Dashboard

Your saved drives and current device

Dashboard information is available on your device.

{{ state.data.reason || 'The comma has no local network address available.' }}

+ `, } diff --git a/openpilot/starpilot/galaxy/web/js/logs.js b/openpilot/starpilot/galaxy/web/js/logs.js index c38d7554c8..c63fd53457 100644 --- a/openpilot/starpilot/galaxy/web/js/logs.js +++ b/openpilot/starpilot/galaxy/web/js/logs.js @@ -1,3 +1,5 @@ +import { DrivingHelp } from "./driving-help.js" +import { ConnectionLogs } from "./local-access.js" import { WikiHelp } from './wiki-help.js' import { GxState } from "./state.js" import { GxNotice } from "./notice.js" @@ -12,10 +14,10 @@ import { BluetoothNotice, bluetoothConnection } from "./bluetooth-notice.js" export const Logs = { name: "Logs", - components: { WikiHelp, GxState, GxNotice, BluetoothNotice, SystemMonitor, TroubleshootPage, TmuxPage, MenuTile }, + components: { WikiHelp, GxState, GxNotice, BluetoothNotice, SystemMonitor, TroubleshootPage, TmuxPage, MenuTile, DrivingHelp, ConnectionLogs }, props: { path: { type: String, required: true }, mode: { type: String, required: true }, unauthorized: { type: Function, required: true }, - tools: { type: Array, required: true } + tools: { type: Array, required: true }, localRoutes: Boolean }, data: () => ({ crashes: { reports: [], scanIncomplete: false, listLimited: false, status: "idle", error: "", selected: null, preview: null, previewStatus: "idle", deleting: false, storageBytes: 0, reportCount: 0 }, search: "", @@ -23,6 +25,10 @@ export const Logs = { logSend: { state: "idle", message: "", available: true, fork: false, error: "" }, sendNote: "", sendDiscord: "", messageLimit: MESSAGE_LIMIT }), computed: { + freshRequest() { + const match = /^\/logs\/help\/fresh\/(connection|controller)\/([a-f0-9]{64})$/.exec(this.path) + return match && { controller: match[1] === "controller", token: match[2] } + }, visibleReports() { return this.crashes.reports.filter((item) => item.name.toLowerCase().includes(this.search.toLowerCase())) }, }, created() { @@ -70,11 +76,40 @@ export const Logs = { :availability="mode !== 'local' && tool.availability === 'local-only' ? 'Unavailable in preview' : ''" :disabled="mode !== 'local' && tool.availability === 'local-only'" @select="go(tool.path)" />
+
+

Requested {{ freshRequest.controller ? 'controller' : 'connection' }} logs

+

Capture fresh diagnostics for your support report. Only support staff receive the log file.

+ +

Connect to your comma to capture these logs.

+
-

Help & Community

Guides and help from the community.

-
Discord
-

Ask the community for help, share what you have tried, and follow StarPilot announcements.

- Join Discord
+

Get help

Choose what went wrong.

+
+

Driving behavior or a specific drive

+ +
+
+

Mobile App Support

+

For Wi-Fi, Bluetooth pairing, or Galaxy Tunnel issues. Send connection logs privately with your Discord account. If you use StarPilot on iPhone, you can also report from Logs & support.

+ +

Connect to your comma to capture its connection logs.

+ +
+
+

Bluetooth Controller Support

+

Connect and wake your USB or Bluetooth controller before capturing its input report. Include the controller model and what went wrong when you send it.

+ +

Connect to your comma to capture a controller log.

+
+ + +
+
+
+

StarPort / Android Auto Support

+

Open StarPort Logs to download your session bundle or send it to the developer.

+ +
diff --git a/openpilot/starpilot/galaxy/web/js/networks.js b/openpilot/starpilot/galaxy/web/js/networks.js index ff98c429a8..6e2c97a6cb 100644 --- a/openpilot/starpilot/galaxy/web/js/networks.js +++ b/openpilot/starpilot/galaxy/web/js/networks.js @@ -1,3 +1,4 @@ +import { ConnectionLogs, ReportingGuide } from "./local-access.js" import { WikiHelp } from './wiki-help.js' import { requestJson } from "./startup.js" import { GxNotice } from "./notice.js" @@ -28,8 +29,8 @@ export const choiceRow = (label, value, choices, reason = '') => ({ label, value export const NetworksPage = { name: "NetworksPage", - components: { WikiHelp, GxNotice, GxState, GalaxySettingRow, GalaxyHotspot, GxDialog }, - props: { mode: { type: String, required: true }, unauthorized: { type: Function, required: true } }, + components: { WikiHelp, GxNotice, GxState, GalaxySettingRow, GalaxyHotspot, GxDialog, ConnectionLogs, ReportingGuide }, + props: { go: { type: Function, required: true }, mode: { type: String, required: true }, unauthorized: { type: Function, required: true } }, data: () => ({ snapshot: null, busy: false, error: '', openUuid: null, adding: false, joiningSsid: '', joinPassword: '', hiddenOpen: false, hiddenSsid: '', showJoinPassword: false, forgetUuid: null, timer: null, controller: null, generation: 0, active: false }), computed: { @@ -261,5 +262,7 @@ export const NetworksPage = { {{ error }} + + `, } diff --git a/openpilot/starpilot/galaxy/web/js/remote-access.js b/openpilot/starpilot/galaxy/web/js/remote-access.js index 6899e21085..fe0001622f 100644 --- a/openpilot/starpilot/galaxy/web/js/remote-access.js +++ b/openpilot/starpilot/galaxy/web/js/remote-access.js @@ -3,9 +3,33 @@ import { GxNotice } from './notice.js' import { requestJson } from './startup.js' import { BluetoothNotice, bluetoothConnection } from './bluetooth-notice.js' +export const RemoteQR = { + props: { endpoint: {type: String, required: true}, alt: {type: String, required: true} }, + data: () => ({image: '', failed: false, request: null}), + mounted() { this.load() }, + beforeUnmount() { this.request?.abort(); if (this.image) URL.revokeObjectURL(this.image) }, + methods: { + async load() { + this.request?.abort() + const request = new AbortController() + this.request = request + this.failed = false + try { + const response = await fetch(this.endpoint, {credentials: 'same-origin', cache: 'no-store', signal: request.signal}) + if (!response.ok || response.headers.get('content-type')?.split(';')[0] !== 'image/svg+xml') throw Error() + const blob = await response.blob() + if (request.signal.aborted) return + if (this.image) URL.revokeObjectURL(this.image) + this.image = URL.createObjectURL(blob) + } catch { if (!request.signal.aborted) this.failed = true } + }, + }, + template: '
', +} + export const RemoteAccess = { name: 'RemoteAccess', - components: { GxState, GxNotice, BluetoothNotice }, + components: { GxState, GxNotice, BluetoothNotice, RemoteQR }, 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, @@ -98,12 +122,12 @@ export const RemoteAccess = {
diff --git a/openpilot/starpilot/galaxy/web/js/route-workspace.js b/openpilot/starpilot/galaxy/web/js/route-workspace.js index 4a17d1cd81..55dcbf92e4 100644 --- a/openpilot/starpilot/galaxy/web/js/route-workspace.js +++ b/openpilot/starpilot/galaxy/web/js/route-workspace.js @@ -1,3 +1,4 @@ +import { DrivingHelp } from "./driving-help.js" import { GxState } from "./state.js" import { GxNotice } from "./notice.js" import { GxIconButton } from "./icon-button.js" @@ -11,7 +12,7 @@ import { LOCAL, VIDEOS, hasVideo, availableFiles, validRouteDetail, routeDate, c logUrl, logArchiveUrl, connectRouteUrl, formatBytes, detailMetric, segmentSummaryUrl, validSegmentSummary } from "./recording-data.js" export const RouteWorkspace = { - components: { GxState, GxNotice, GxIconButton, GxDialog, GalaxySelect, RecordingActions, CameraViewer, ReplayViewer }, + components: { GxState, GxNotice, GxIconButton, GxDialog, GalaxySelect, RecordingActions, CameraViewer, ReplayViewer, DrivingHelp }, props: { routeId: { type: String, required: true }, summary: { type: Object, default: null }, initialMode: { type: String, default: "footage" }, exports: { type: Object, required: true }, unauthorized: { type: Function, required: true } }, emits: ["back", "changed"], @@ -198,6 +199,10 @@ export const RouteWorkspace = { Reading saved route… {{ error }}