feat: integrate StarLight updates and improve font settings and skin editor loading
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled

This commit is contained in:
Disy committed 2026-09-19 18:14:41 +08:00
1 parent a47d309103
commit a477b1fb9a
24 files changed
+665 -74

No files matched your search

+39 -15
View File
@@ -3,21 +3,23 @@ use futures::StreamExt;
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use std::sync::{Arc, Mutex};
use tauri::http::HeaderValue;
use tauri::http::header::ACCEPT;
use tauri::http::HeaderValue;
use tauri::{Manager, ResourceId, Runtime, Webview};
use tauri_plugin_http::reqwest;
use tauri_plugin_http::reqwest::ClientBuilder;
use tauri_plugin_updater::{Error, Update, UpdaterExt};
use theseus::{
LoadingBarType, emit_loading, init_loading, launcher_user_agent,
emit_loading, init_loading, launcher_user_agent, LoadingBarType,
};
use tokio::time::Instant;
use url::Url;
const UPDATE_SERVER_LATEST_URL: &str = "https://update.axlmc.org/latest";
const UPDATE_SERVER_API: &str = "https://update.axlmc.org/api/versions";
const UPDATE_SERVER_BASE: &str = "https://update.axlmc.org/";
const STARLIGHT_UPDATE_LATEST_URL: &str =
"https://skin.starlight.cool/starlight/launcher/latest";
const STARLIGHT_UPDATE_VERSIONS_URL: &str =
"https://skin.starlight.cool/starlight/launcher/versions";
const STARLIGHT_UPDATE_BASE_URL: &str = "https://skin.starlight.cool/";
// The updater plugin builds `Update` with no request timeout, so a stalled
// connection would hang the download forever. Bound the whole download.
@@ -62,7 +64,10 @@ struct ArtifactEntry {
variant: Option<String>,
platform: String,
architecture: String,
relative_path: String,
#[serde(default)]
relative_path: Option<String>,
#[serde(default)]
download_url: Option<String>,
#[serde(default)]
sha256: Option<String>,
#[serde(default)]
@@ -94,7 +99,7 @@ async fn fetch_apt_deb_asset(version: &str) -> Result<AptDebAsset> {
.user_agent(launcher_user_agent())
.timeout(UPDATE_DOWNLOAD_TIMEOUT)
.build()?
.get(UPDATE_SERVER_API)
.get(STARLIGHT_UPDATE_VERSIONS_URL)
.send()
.await?;
@@ -139,13 +144,7 @@ async fn fetch_apt_deb_asset(version: &str) -> Result<AptDebAsset> {
)))
})?;
let url =
Url::parse(&format!("{UPDATE_SERVER_BASE}{}", artifact.relative_path))
.map_err(|error| {
theseus::Error::from(theseus::ErrorKind::OtherError(
error.to_string(),
))
})?;
let url = artifact_download_url(artifact)?;
Ok(AptDebAsset {
url,
@@ -154,6 +153,31 @@ async fn fetch_apt_deb_asset(version: &str) -> Result<AptDebAsset> {
})
}
fn artifact_download_url(artifact: &ArtifactEntry) -> Result<Url> {
if let Some(download_url) = artifact.download_url.as_deref() {
return Url::parse(download_url).map_err(|error| {
theseus::Error::from(theseus::ErrorKind::OtherError(
error.to_string(),
))
.into()
});
}
let relative_path = artifact.relative_path.as_deref().ok_or_else(|| {
theseus::Error::from(theseus::ErrorKind::OtherError(
"Update catalog artifact has no download URL".to_string(),
))
})?;
Url::parse(STARLIGHT_UPDATE_BASE_URL)
.and_then(|base| base.join(relative_path))
.map_err(|error| {
theseus::Error::from(theseus::ErrorKind::OtherError(
error.to_string(),
))
.into()
})
}
// ── Updater plugin helpers ───────────────────────────────────────
fn update_channel(channel: &str) -> Result<&str> {
@@ -183,7 +207,7 @@ fn update_platform() -> Result<&'static str> {
}
fn update_endpoint() -> Result<Url> {
Url::parse(UPDATE_SERVER_LATEST_URL).map_err(|error| {
Url::parse(STARLIGHT_UPDATE_LATEST_URL).map_err(|error| {
theseus::Error::from(theseus::ErrorKind::OtherError(error.to_string()))
.into()
})