Show Fork name in Warning

This commit is contained in:
Danny
2026-11-25 07:57:58 -08:00
parent bb2cd1407e
commit b9f349c72d
4 changed files with 22 additions and 6 deletions
@@ -10,7 +10,7 @@ from io import BytesIO
from urllib.parse import quote
from zipfile import BadZipFile, ZipFile
from openpilot.starpilot.galaxy.starport_send import DISCORD_FILE_LIMIT, official_install
from openpilot.starpilot.galaxy.starport_send import DISCORD_FILE_LIMIT, install_repo, official_install
STAGE_URL = "https://starpilot-log-relay.nathan-g-hubbard.workers.dev/report/galaxy/stage"
CLAIM_RE = re.compile(r"^https://starpilot-log-relay\.nathan-g-hubbard\.workers\.dev/report/galaxy/claim/[a-f0-9]{64}$")
@@ -123,18 +123,20 @@ class LogRelayStager:
post=None,
stage_url: Callable[[], str] | str = STAGE_URL,
official: Callable[[], bool] = official_install,
repo: Callable[[], str] = install_repo,
):
self._starport_bundle = starport_bundle
self._connection_zip = connection_zip
self._controller_zip = controller_zip
self._post = post
self._stage_url: Callable[[], str] | str = stage_url
self._official = official
self._official, self._repo_source = official, repo
self._lock = threading.Lock()
self._thread: threading.Thread | None = None
self._state = {"state": "idle", "message": "", "claimUrl": "", "kind": ""}
self._session = None
self._fork: bool | None = None
self._repo = ""
def _url(self) -> str:
stage_url = self._stage_url
@@ -144,10 +146,12 @@ class LogRelayStager:
with self._lock:
if self._fork is None:
self._fork = not self._official()
self._repo = self._repo_source() if self._fork else ""
return {
**(self._state if session == self._session else {"state": "idle", "message": "", "claimUrl": "", "kind": ""}),
"available": bool(self._url()),
"fork": self._fork,
"repo": self._repo,
"noteLimit": NOTE_LIMIT,
"modelLimit": MODEL_LIMIT,
}
+7 -2
View File
@@ -38,9 +38,14 @@ class SendBusy(Exception):
pass
def install_repo() -> str:
from openpilot.starpilot.system.starport.bugsink_transport import device_metadata
return device_metadata().get("repo", "")
def official_install() -> bool:
from openpilot.starpilot.system.starport.bugsink_transport import device_metadata, is_official_repo
return is_official_repo(device_metadata().get("repo"))
from openpilot.starpilot.system.starport.bugsink_transport import is_official_repo
return is_official_repo(install_repo())
def webhook_url(override_path: Path = WEBHOOK_OVERRIDE_PATH) -> str:
@@ -98,11 +98,13 @@ class LogRelayStagerTest(unittest.TestCase):
lambda: b"controller-zip",
post=fake_post,
official=lambda: False,
repo=lambda: "dirwin31/openpilot",
)
initial = stager.status()
self.assertEqual(initial["state"], "idle")
self.assertTrue(initial["available"])
self.assertTrue(initial["fork"])
self.assertEqual(initial["repo"], "dirwin31/openpilot")
self.assertEqual(initial["noteLimit"], NOTE_LIMIT)
self.assertEqual(initial["modelLimit"], MODEL_LIMIT)
@@ -114,6 +114,7 @@ export class LogStageClient {
kind,
available: body.available !== false,
fork: body.fork === true,
repo: typeof body.repo === "string" ? body.repo : "",
noteLimit: body.noteLimit || NOTE_LIMIT,
modelLimit: body.modelLimit || MODEL_LIMIT,
error: "",
@@ -254,7 +255,7 @@ export const LogHelp = {
data() {
return {
selected: KINDS.includes(this.topic) ? this.topic : "starport",
stage: { state: "idle", message: "", claimUrl: "", kind: "", available: true, fork: false, noteLimit: NOTE_LIMIT, modelLimit: MODEL_LIMIT, error: "" },
stage: { state: "idle", message: "", claimUrl: "", kind: "", available: true, fork: false, repo: "", noteLimit: NOTE_LIMIT, modelLimit: MODEL_LIMIT, error: "" },
starportLogs: { sessions: [], others: [], status: "idle", error: "" },
sessionsOpen: false,
bluetooth: bluetoothConnection(),
@@ -279,6 +280,10 @@ export const LogHelp = {
claimReady() {
return this.stage.state === "ready" && !!this.stage.claimUrl && this.stage.kind === this.selected
},
forkTitle() {
const repo = this.stage.repo.includes("/") ? this.stage.repo : ""
return "This device is running a StarPilot fork" + (repo ? " (" + repo + ")" : "")
},
missingHint() {
if (this.selected === "controller") return "Enter your controller model and a short note above to send."
return "Add a short note about what happened above to send."
@@ -406,7 +411,7 @@ export const LogHelp = {
<p v-if="mode !== 'local'" class="gx-note">Connect to your comma to send or download diagnostic logs.</p>
<template v-else>
<GxNotice v-if="selected === 'starport' && stage.fork" class="gx-starport-send__fork" tone="warn" title="This device is running a StarPilot fork">
<GxNotice v-if="selected === 'starport' && stage.fork" class="gx-starport-send__fork" tone="warn" :title="forkTitle">
Custom forks may have changed StarPort or be out of date. Make sure your branch is up to date with StarPilotHQ before sending, or share the logs with your branch's maintainer or in the StarPilot Discord.
</GxNotice>
<BluetoothNotice v-if="bluetooth" feature="ZIP downloads">Direct log sending from the comma remains available.</BluetoothNotice>