mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-30 03:13:48 +08:00
link commits
This commit is contained in:
@@ -37,6 +37,29 @@ function githubCommitUrl(remote, commitsUrl, commit) {
|
||||
return base ? `${base}/commit/${sha}` : ""
|
||||
}
|
||||
|
||||
function githubCommitsUrl(remote, commitsUrl, branch) {
|
||||
const suppliedUrl = String(commitsUrl || "").trim()
|
||||
if (suppliedUrl) {
|
||||
try {
|
||||
const parsed = new URL(suppliedUrl)
|
||||
if (parsed.protocol === "https:" && parsed.hostname === "github.com" && parsed.pathname.includes("/commits/")) {
|
||||
return parsed.href
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
const base = githubRemoteUrl(remote, commitsUrl)
|
||||
const normalizedBranch = String(branch || "").trim()
|
||||
if (!base || !normalizedBranch) return ""
|
||||
try {
|
||||
if (new URL(base).hostname !== "github.com") return ""
|
||||
} catch (e) {
|
||||
return ""
|
||||
}
|
||||
return `${base}/commits/${encodeURIComponent(normalizedBranch)}/`
|
||||
}
|
||||
|
||||
const CORE_UPDATE_BRANCHES = ["StarPilot", "Dom"]
|
||||
const REBOOT_PENDING_STORAGE_KEY = "galaxy-update-reboot-pending"
|
||||
const LOCAL_DEVICE_SCOPE = "local"
|
||||
@@ -176,6 +199,7 @@ export const SystemTools = {
|
||||
},
|
||||
updateAvailable() { return this.checkedForUpdates && !!this.fastStatus?.updateAvailable && !this.updateInProgress },
|
||||
remoteCommitUrl() { return githubCommitUrl(this.fastStatus?.originRemote, this.fastStatus?.commitsUrl, this.fastStatus?.remoteCommit) },
|
||||
recentCommitsUrl() { return githubCommitsUrl(this.fastStatus?.originRemote, this.fastStatus?.commitsUrl, this.fastStatus?.branch || this.currentBranch) },
|
||||
factoryResetStatus() {
|
||||
const s = this.fastStatus
|
||||
if (!s || String(s?.lastMode || "").trim() !== "factory-reset") return null
|
||||
@@ -642,6 +666,7 @@ export const SystemTools = {
|
||||
<div v-if="updateInProgress && !rebootPending" class="gx-row" style="border-top:none; min-height:0; padding:4px 0;"><span class="gx-row__label">Stage</span><span class="gx-row__value">{{ fastStatus.stage }} · {{ fastStatus.progressLabel }}</span></div>
|
||||
<div class="gx-row" style="border-top:none; min-height:0; padding:4px 0;"><span class="gx-row__label">Local</span><span class="gx-row__value" style="font-family:monospace;">{{ shortCommit(fastStatus.localCommit) }}</span></div>
|
||||
<div class="gx-row" style="border-top:none; min-height:0; padding:4px 0;"><span class="gx-row__label">Remote</span><span class="gx-row__value" style="font-family:monospace;"><a v-if="remoteCommitUrl" class="gx-link" :href="remoteCommitUrl" target="_blank" rel="noopener noreferrer" :title="fastStatus.remoteCommit">{{ shortCommit(fastStatus.remoteCommit) }}</a><template v-else>{{ shortCommit(fastStatus.remoteCommit) }}</template></span></div>
|
||||
<a v-if="recentCommitsUrl" class="gx-btn gx-btn--tonal" style="justify-self:start; margin-top:4px;" :href="recentCommitsUrl" target="_blank" rel="noopener noreferrer"><i class="bi bi-github" aria-hidden="true"></i> Show recent commits on GitHub</a>
|
||||
<div v-if="updateInProgress && !rebootPending" class="gx-update-progress" role="progressbar" aria-label="Update progress"
|
||||
:aria-valuenow="Math.round(fastStatus.progressPercent || 0)" aria-valuemin="0" aria-valuemax="100">
|
||||
<div class="gx-update-progress__track">
|
||||
|
||||
Reference in New Issue
Block a user