Prefer direct Gitea release assets
ci / test (push) Has been cancelled
ci / fuzz-smoke (push) Has been cancelled
ci / windows-client (push) Has been cancelled
ci / package-release (linux-x86_64, ubuntu-latest) (push) Has been cancelled
ci / package-release (macos-aarch64, macos-14) (push) Has been cancelled
ci / package-release (macos-x86_64, macos-13) (push) Has been cancelled
ci / package-release (windows-x86_64, windows-latest) (push) Has been cancelled
ci / remote-bench (push) Has been cancelled

This commit is contained in:
DuProcess
2026-06-21 15:52:42 -04:00
parent b21c2eed9d
commit 6f40ff9e25
3 changed files with 42 additions and 11 deletions
+33
View File
@@ -70,6 +70,36 @@ function Release-DownloadUrl {
"$web/releases/download/$BinaryVersion/$name"
}
function Release-LatestTagDownloadUrl {
if ($BinaryUrl -or $BinaryBase -or $BinaryVersion -ne "latest") {
return $null
}
$web = Repo-WebBase $Repo
if (-not $web) {
return $null
}
try {
$response = Invoke-WebRequest -UseBasicParsing -Uri "$web/releases/latest" -MaximumRedirection 5
$effective = $null
if ($response.BaseResponse.ResponseUri) {
$effective = $response.BaseResponse.ResponseUri.AbsoluteUri
} elseif ($response.BaseResponse.RequestMessage -and $response.BaseResponse.RequestMessage.RequestUri) {
$effective = $response.BaseResponse.RequestMessage.RequestUri.AbsoluteUri
}
$prefix = "$web/releases/tag/"
if ($effective -and $effective.StartsWith($prefix)) {
$tag = $effective.Substring($prefix.Length)
if ($tag) {
return "$web/releases/download/$tag/$(Release-ArtifactName)"
}
}
}
catch {
return $null
}
return $null
}
function Verify-ArchiveChecksum($Url, $Archive) {
$checksumPath = "$Archive.sha256"
try {
@@ -91,7 +121,10 @@ $configDir = Join-Path $HOME ".config\dosh"
New-Item -ItemType Directory -Force -Path $bindir, $configDir | Out-Null
function Install-Prebuilt {
$url = Release-LatestTagDownloadUrl
if (-not $url) {
$url = Release-DownloadUrl
}
if (-not $url) {
return $false
}
+2 -2
View File
@@ -265,7 +265,7 @@ verify_archive_checksum() {
}
try_install_prebuilt() {
download_url="$(release_download_url)" || return 1
download_url="$(release_latest_tag_download_url || release_download_url)" || return 1
tmpdir="$(mktemp -d)"
archive="$tmpdir/$(release_artifact_name)"
checksum_file="$archive.sha256"
@@ -273,7 +273,7 @@ try_install_prebuilt() {
need curl
need tar
if ! curl -fsL "$download_url" -o "$archive" 2>/dev/null; then
alt_download_url="$(release_latest_tag_download_url || true)"
alt_download_url="$(release_download_url || true)"
if [ -z "$alt_download_url" ] || ! curl -fsL "$alt_download_url" -o "$archive"; then
echo "prebuilt unavailable: $download_url" >&2
[ -z "$alt_download_url" ] || echo "prebuilt unavailable: $alt_download_url" >&2
+6 -8
View File
@@ -1431,13 +1431,13 @@ fn run_update(config: &dosh::config::ClientConfig, check_only: bool) -> Result<(
if let Some(latest_url) = latest_release_download_url(&repo, artifact) {
let mut status = "missing";
let mut display_url = latest_url.clone();
if url_reachable(&latest_url)? {
status = "available";
} else if let Some(tag_url) = latest_release_tag_download_url(&repo, artifact)?
if let Some(tag_url) = latest_release_tag_download_url(&repo, artifact)?
&& url_reachable(&tag_url)?
{
status = "available";
display_url = tag_url;
} else if url_reachable(&latest_url)? {
status = "available";
}
println!("prebuilt: {status} ({artifact})");
println!("prebuilt_url: {display_url}");
@@ -4848,17 +4848,15 @@ impl DisconnectStatus {
Ok(())
}
/// Paint `text` on the terminal's bottom row using save/restore cursor so the
/// app's cursor is untouched. Sequence: save cursor (ESC 7), move to the last
/// row col 1, clear that row, set reverse-video cyan, write text, reset
/// attributes, restore cursor (ESC 8).
/// Paint `text` on the terminal's top row using save/restore cursor so the
/// app's cursor is untouched.
fn emit(&self, text: &str) -> Result<()> {
let (_, rows) = terminal_size();
let bytes = render_status_overlay(text, rows);
emit_status(&bytes)
}
/// Erase the bottom-row status line, again with save/restore cursor.
/// Erase the top-row status bar, again with save/restore cursor.
fn emit_clear(&self) -> Result<()> {
let (_, rows) = terminal_size();
emit_status(&render_status_clear(rows))