mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 06:19:44 +00:00
update marketplace url to reflect build version (#2914)
* update marketplace url to reflect build version * adjust marketplace config * use helper function to compare urls * rework some registry stuff * #2900, #2899, and other registry changes * alpha.1 * trailing / * add startosRegistry * fix migration --------- Co-authored-by: Matt Hill <mattnine@protonmail.com> Co-authored-by: Aiden McClelland <me@drbonez.dev> Co-authored-by: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com>
This commit is contained in:
@@ -40,8 +40,9 @@ mod v0_3_6_alpha_17;
|
||||
mod v0_3_6_alpha_18;
|
||||
|
||||
mod v0_4_0_alpha_0;
|
||||
mod v0_4_0_alpha_1;
|
||||
|
||||
pub type Current = v0_4_0_alpha_0::Version; // VERSION_BUMP
|
||||
pub type Current = v0_4_0_alpha_1::Version; // VERSION_BUMP
|
||||
|
||||
impl Current {
|
||||
#[instrument(skip(self, db))]
|
||||
@@ -145,7 +146,8 @@ enum Version {
|
||||
V0_3_6_alpha_16(Wrapper<v0_3_6_alpha_16::Version>),
|
||||
V0_3_6_alpha_17(Wrapper<v0_3_6_alpha_17::Version>),
|
||||
V0_3_6_alpha_18(Wrapper<v0_3_6_alpha_18::Version>),
|
||||
V0_4_0_alpha_0(Wrapper<v0_4_0_alpha_0::Version>), // VERSION_BUMP
|
||||
V0_4_0_alpha_0(Wrapper<v0_4_0_alpha_0::Version>),
|
||||
V0_4_0_alpha_1(Wrapper<v0_4_0_alpha_1::Version>), // VERSION_BUMP
|
||||
Other(exver::Version),
|
||||
}
|
||||
|
||||
@@ -187,8 +189,9 @@ impl Version {
|
||||
Self::V0_3_6_alpha_15(v) => DynVersion(Box::new(v.0)),
|
||||
Self::V0_3_6_alpha_16(v) => DynVersion(Box::new(v.0)),
|
||||
Self::V0_3_6_alpha_17(v) => DynVersion(Box::new(v.0)),
|
||||
Self::V0_3_6_alpha_18(v) => DynVersion(Box::new(v.0)), // VERSION_BUMP
|
||||
Self::V0_4_0_alpha_0(v) => DynVersion(Box::new(v.0)), // VERSION_BUMP
|
||||
Self::V0_3_6_alpha_18(v) => DynVersion(Box::new(v.0)),
|
||||
Self::V0_4_0_alpha_0(v) => DynVersion(Box::new(v.0)),
|
||||
Self::V0_4_0_alpha_1(v) => DynVersion(Box::new(v.0)), // VERSION_BUMP
|
||||
Self::Other(v) => {
|
||||
return Err(Error::new(
|
||||
eyre!("unknown version {v}"),
|
||||
@@ -223,7 +226,8 @@ impl Version {
|
||||
Version::V0_3_6_alpha_16(Wrapper(x)) => x.semver(),
|
||||
Version::V0_3_6_alpha_17(Wrapper(x)) => x.semver(),
|
||||
Version::V0_3_6_alpha_18(Wrapper(x)) => x.semver(),
|
||||
Version::V0_4_0_alpha_0(Wrapper(x)) => x.semver(), // VERSION_BUMP
|
||||
Version::V0_4_0_alpha_0(Wrapper(x)) => x.semver(),
|
||||
Version::V0_4_0_alpha_1(Wrapper(x)) => x.semver(), // VERSION_BUMP
|
||||
Version::Other(x) => x.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
72
core/startos/src/version/v0_4_0_alpha_1.rs
Normal file
72
core/startos/src/version/v0_4_0_alpha_1.rs
Normal file
@@ -0,0 +1,72 @@
|
||||
use exver::{PreReleaseSegment, VersionRange};
|
||||
use imbl_value::json;
|
||||
|
||||
use super::v0_3_5::V0_3_0_COMPAT;
|
||||
use super::{v0_4_0_alpha_0, VersionT};
|
||||
use crate::prelude::*;
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref V0_4_0_alpha_1: exver::Version = exver::Version::new(
|
||||
[0, 4, 0],
|
||||
[PreReleaseSegment::String("alpha".into()), 1.into()]
|
||||
);
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
pub struct Version;
|
||||
|
||||
impl VersionT for Version {
|
||||
type Previous = v0_4_0_alpha_0::Version;
|
||||
type PreUpRes = ();
|
||||
|
||||
async fn pre_up(self) -> Result<Self::PreUpRes, Error> {
|
||||
Ok(())
|
||||
}
|
||||
fn semver(self) -> exver::Version {
|
||||
V0_4_0_alpha_1.clone()
|
||||
}
|
||||
fn compat(self) -> &'static VersionRange {
|
||||
&V0_3_0_COMPAT
|
||||
}
|
||||
fn up(self, db: &mut Value, _: Self::PreUpRes) -> Result<(), Error> {
|
||||
let Some(ui) = db["public"]["ui"].as_object_mut() else {
|
||||
return Err(Error::new(
|
||||
eyre!("db.public.ui is not an object"),
|
||||
ErrorKind::Database,
|
||||
));
|
||||
};
|
||||
ui.insert(
|
||||
"registries".into(),
|
||||
Value::Object(
|
||||
ui.get("marketplace")
|
||||
.and_then(|m| m.get("knownHosts"))
|
||||
.and_then(|kh| kh.as_object())
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.map(|(k, v)| (k.clone(), v["name"].clone()))
|
||||
.collect(),
|
||||
),
|
||||
);
|
||||
if let Some(highscore) = ui
|
||||
.get_mut("gaming")
|
||||
.and_then(|g| g.get_mut("snake"))
|
||||
.and_then(|s| s.get_mut("highScore"))
|
||||
.map(|hs| hs.take())
|
||||
.filter(|s| s.is_number())
|
||||
{
|
||||
ui.insert("snakeHighScore".into(), highscore);
|
||||
}
|
||||
ui.insert(
|
||||
"startosRegistry".into(),
|
||||
json!("https://registry.start9.com/"),
|
||||
);
|
||||
ui.remove("marketplace");
|
||||
ui.remove("gaming");
|
||||
ui.remove("theme");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
fn down(self, _db: &mut Value) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user