mirror of
https://github.com/storytold/craft-launcher.git
synced 2026-11-14 14:12:50 +00:00
refactor: name OCI migration controls oci_migration
This commit is contained in:
8 files changed
+12
-12
No files matched your search
@@ -14,7 +14,7 @@ workspace = true
|
||||
|
||||
[features]
|
||||
# Compatibility feature; migration now requires the saved Advanced setting.
|
||||
experimental-oci-migration = ["artcraft-launcher-native/experimental-oci-migration"]
|
||||
oci_migration = ["artcraft-launcher-native/oci_migration"]
|
||||
# Development only: install from `cargo xtask local serve` (see the README).
|
||||
local-mirror = ["artcraft-launcher-native/local-mirror"]
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ pub struct BackendOptions {
|
||||
/// Offer pre-releases (`0.6.0-rc.1`) as updates.
|
||||
pub prereleases: bool,
|
||||
/// Opt in to migrating first party Flatpak bundles to the ArtCraft OCI repository.
|
||||
pub experimental_oci_migration: bool,
|
||||
pub oci_migration: bool,
|
||||
}
|
||||
|
||||
/// The answer to "what's the latest release of this app?".
|
||||
|
||||
@@ -12,7 +12,7 @@ workspace = true
|
||||
|
||||
[features]
|
||||
# Compatibility feature; migration now requires the saved Advanced setting.
|
||||
experimental-oci-migration = []
|
||||
oci_migration = []
|
||||
# Lets ARTCRAFT_LAUNCHER_DOWNLOAD_BASE point the launcher at a developer's own loopback mirror
|
||||
# (`cargo xtask local serve`). Development only: release builds never enable it, so a shipped
|
||||
# launcher can't be steered away from GitHub's releases by an environment variable.
|
||||
|
||||
@@ -567,7 +567,7 @@ fn run_install(
|
||||
return Err("the selected version isn't available yet. Check for updates before installing.".into());
|
||||
}
|
||||
#[cfg(target_os = "linux")]
|
||||
if options.experimental_oci_migration
|
||||
if options.oci_migration
|
||||
&& matches!(track, VersionTrack::Stable)
|
||||
&& !release.prerelease
|
||||
&& !replace
|
||||
|
||||
@@ -1226,7 +1226,7 @@ pub(crate) mod linux {
|
||||
}
|
||||
}
|
||||
|
||||
/// Experimental in-place migration; only an absent ref permits bundle fallback.
|
||||
/// Opt-in OCI migration; only an absent ref permits bundle fallback.
|
||||
pub fn migrate_bundle_to_oci(app: &CraftApp, installed: &Installed, expected: &super::version::Version, stop: &Stop) -> Result<bool, String> {
|
||||
if installed.source != InstallSource::Flatpak || installed.externally_managed || !app.repo.starts_with("storytold/") {
|
||||
return Ok(false);
|
||||
|
||||
@@ -436,7 +436,7 @@ impl LauncherUi {
|
||||
let options = BackendOptions {
|
||||
kinds: self.settings.preferred_kinds.clone(),
|
||||
prereleases: self.settings.prereleases,
|
||||
experimental_oci_migration: self.settings.experimental_oci_migration,
|
||||
oci_migration: self.settings.oci_migration,
|
||||
versions: self.settings.versions.clone(),
|
||||
launcher_version: self.settings.launcher_version.clone(),
|
||||
install_locations: self.settings.install_locations.clone(),
|
||||
|
||||
@@ -109,7 +109,7 @@ pub struct Settings {
|
||||
pub notify: bool,
|
||||
pub prereleases: bool,
|
||||
/// Opt in to migrating first party Flatpak bundles to the ArtCraft OCI repository.
|
||||
pub experimental_oci_migration: bool,
|
||||
pub oci_migration: bool,
|
||||
/// Version track per app. Missing entries follow stable releases.
|
||||
pub versions: BTreeMap<String, artcraft_launcher_core::protocol::VersionTrack>,
|
||||
pub launcher_version: artcraft_launcher_core::protocol::VersionTrack,
|
||||
@@ -204,7 +204,7 @@ impl Default for Settings {
|
||||
auto_update: false,
|
||||
notify: true,
|
||||
prereleases: false,
|
||||
experimental_oci_migration: false,
|
||||
oci_migration: false,
|
||||
versions: BTreeMap::new(),
|
||||
launcher_version: Default::default(),
|
||||
preferred_kinds: default_preferred_kinds(),
|
||||
@@ -226,9 +226,9 @@ mod oci_settings_tests {
|
||||
#[test]
|
||||
fn migration_requires_opt_in_and_survives_settings_roundtrip() {
|
||||
let old: Settings = serde_json::from_str("{}").unwrap();
|
||||
assert!(!old.experimental_oci_migration);
|
||||
let enabled = Settings { experimental_oci_migration: true, ..old };
|
||||
assert!(!old.oci_migration);
|
||||
let enabled = Settings { oci_migration: true, ..old };
|
||||
let restored: Settings = serde_json::from_str(&serde_json::to_string(&enabled).unwrap()).unwrap();
|
||||
assert!(restored.experimental_oci_migration);
|
||||
assert!(restored.oci_migration);
|
||||
}
|
||||
}
|
||||
@@ -208,7 +208,7 @@ impl LauncherUi {
|
||||
return;
|
||||
}
|
||||
sheet::panel(ui, tl!("Advanced"), |ui| {
|
||||
ui.checkbox(&mut self.settings.experimental_oci_migration, tl!("Migrate Flatpak bundles to ArtCraft OCI (experimental)"));
|
||||
ui.checkbox(&mut self.settings.oci_migration, tl!("Migrate Flatpak bundles to ArtCraft OCI (experimental)"));
|
||||
note(ui, tl!("On update, switch first party apps when the matching package is available. Otherwise, keep using bundles."));
|
||||
note(ui, tl!("The OCI repository is a preview with GPG verification disabled."));
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user