Migrate CI to Gitea and improve live map diagnostics
CI / Real Minecraft installs (manual) (push) Skipped
CI / Rust, web and container (push) Canceled after 0s
CI / Windows launcher (push) Canceled after 0s
Server integrations / paper (push) Canceled after 0s
Server integrations / Fabric and Forge / 1.20.1 (push) Canceled after 0s
Server integrations / Fabric and Forge / 1.21.1 (push) Canceled after 0s
Server integrations / Fabric and Forge / 26.1.2 (push) Canceled after 0s
Server integrations / Fabric and Forge / 26.2 (push) Canceled after 0s
Server integrations / Fabric and Forge / 26.3 (push) Canceled after 0s

This commit is contained in:
SCOPEDD committed 2026-10-01 00:07:35 -04:00
1 parent d72d7c2e80
commit 7809d47d39
32 files changed
+518 -325

No files matched your search

+3 -3
View File
@@ -6,17 +6,17 @@ use scopenet_shared::LauncherManifest;
use std::path::PathBuf;
use std::sync::{Mutex, RwLock};
/// Values baked in at build time by CI (see `.github/workflows/release.yml`).
/// Values baked in at build time by CI (see `.gitea/workflows/release.yml`).
pub mod build {
/// Default panel URL for this build.
pub const PANEL_URL: Option<&str> = match option_env!("SCOPENET_PANEL_URL") {
Some(u) if !u.is_empty() => Some(u),
_ => Some("https://scopenetmcpanel.scopedd.lol"),
};
/// `owner/repo` used to check GitHub releases for updates.
/// Full Gitea repository URL used to check releases for updates.
pub const REPO: Option<&str> = match option_env!("SCOPENET_REPO") {
Some(r) if !r.is_empty() => Some(r),
_ => Some("scopeddlol/SCOPENET-MC"),
_ => Some("https://gitea.jadonsandbox.com/blade/scopenet-mc"),
};
/// When set to "1", players can't change the panel URL.
pub const LOCK_PANEL: Option<&str> = option_env!("SCOPENET_LOCK_PANEL");
+10 -10
View File
@@ -1,4 +1,4 @@
//! Self-update via GitHub Releases: find a newer `*-setup.exe`, download
//! Self-update via Gitea Releases: find a newer `*-setup.exe`, download
//! it and hand over to the installer.
use crate::state::build;
@@ -42,14 +42,12 @@ pub fn is_newer(candidate: &str, current: &str) -> bool {
pub async fn check(http: &reqwest::Client) -> Result<Option<UpdateInfo>> {
let Some(repo) = build::REPO.filter(|r| !r.is_empty()) else { return Ok(None) };
let release: Release = http
.get(format!("https://api.github.com/repos/{repo}/releases/latest"))
.header("Accept", "application/vnd.github+json")
.send()
.await?
.error_for_status()?
.json()
.await?;
let repo = reqwest::Url::parse(repo).context("invalid release repository URL")?;
if repo.scheme() != "https" {
anyhow::bail!("release repository must use HTTPS");
}
let api = format!("{}/api/v1/repos{}/releases/latest", repo.origin().ascii_serialization(), repo.path());
let release: Release = http.get(api).header("Accept", "application/json").send().await?.error_for_status()?.json().await?;
if release.draft || release.prerelease || !is_newer(&release.tag_name, env!("CARGO_PKG_VERSION")) {
return Ok(None);
}
@@ -68,7 +66,9 @@ pub async fn check(http: &reqwest::Client) -> Result<Option<UpdateInfo>> {
/// Download the installer and start it. The caller exits the app afterwards.
pub async fn download_and_run(http: &reqwest::Client, url: &str) -> Result<()> {
if !url.starts_with("https://github.com/") && !url.starts_with("https://objects.githubusercontent.com/") {
let expected = reqwest::Url::parse(build::REPO.unwrap_or_default()).context("invalid release repository URL")?;
let actual = reqwest::Url::parse(url).context("invalid update URL")?;
if actual.scheme() != "https" || actual.origin() != expected.origin() {
anyhow::bail!("refusing to download an update from an unexpected host");
}
let dest = std::env::temp_dir().join("scopenet-launcher-setup.exe");