From 178391e7b2f0db5493bc75c256f8ff230597761d Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Mon, 16 Jan 2023 13:15:43 -0700 Subject: [PATCH] integration/refactors wip: Refactoring the service -> Made new skeleton -> Added service manager -> Manager Refactored -> Cleanup -> Add gid struct -> remove synchronizer -> Added backup into manager -> Fix the configure signal not send -> Fixes around backup and sync wip: Moved over the config into the service manager js effect for subscribing to config js effect for subscribing to config fix errors chore: Fix some things in the manager for clippy add interfaces from manifest automatically make OsApi manager-based wip: Starting down the bind for the effects todo: complete a ip todo chore: Fix the result type on something todo: Address returning chore: JS with callbacks chore: Add in the chown and permissions chore: Add in the binds and unbinds in feat: Add in the ability to get configs makefile changes add start/stop/restart to effects config hooks fix: add a default always to the get status chore: Only do updates when the thing is installed. use nistp256 to satisfy firefox use ed25519 if available chore: Make the thing buildable for testing chore: Add in the debugging fix ip signing chore: Remove the bluj tracing fix SQL error chore: Fix the build update prettytable to fix segfault Chore: Make these fn's instead of allways ran. chore: Fix the testing fix: The stopping/ restarting service fix: Fix the restarting. remove current-dependents, derive instead remove pointers from current-dependencies remove pointers and system pointers from FE v0.3.4 remove health checks from manifest remove "restarting" bool on "starting" status remove restarting attr update makefile fix add efi support fix efi add redirect if connecting to https over http clean up lan port forwarding add `make update` and `make update-overlay` fix migration more protections fix: Fix a lint chore: remove the limit on the long-running fix: Starting sometimes. fix: Make it so the stop of the main works fix: Bind local and tor with package. wip: envs closes #2152, closes #2155, closes #2157 fix TS error import config types from sdk update package.json --- backend/src/manager/js_api.rs | 1 + backend/src/net/ssl.rs | 1 + backend/src/procedure/js_scripts.rs | 36 +++++++++++++++++----- backend/src/version/mod.rs | 23 +++++++++++--- frontend/patchdb-ui-seed.json | 2 +- libs/helpers/src/os_api.rs | 1 + libs/js_engine/src/artifacts/loadModule.js | 1 - libs/js_engine/src/lib.rs | 1 - 8 files changed, 51 insertions(+), 15 deletions(-) diff --git a/backend/src/manager/js_api.rs b/backend/src/manager/js_api.rs index 8f26f2d50..74e030242 100644 --- a/backend/src/manager/js_api.rs +++ b/backend/src/manager/js_api.rs @@ -12,6 +12,7 @@ use sqlx::Acquire; use crate::{ config::hook::ConfigHook, manager::{start_stop::StartStop, Manager}, + net::keys::Key, }; use super::try_get_running_ip; diff --git a/backend/src/net/ssl.rs b/backend/src/net/ssl.rs index 13179da1d..af785d476 100644 --- a/backend/src/net/ssl.rs +++ b/backend/src/net/ssl.rs @@ -20,6 +20,7 @@ use crate::account::AccountInfo; use crate::hostname::Hostname; use crate::net::dhcp::ips; use crate::net::keys::{Key, KeyInfo}; +use crate::s9pk::manifest::PackageId; use crate::{Error, ErrorKind, ResultExt}; static CERTIFICATE_VERSION: i32 = 2; // X509 version 3 is actually encoded as '2' in the cert because fuck you. diff --git a/backend/src/procedure/js_scripts.rs b/backend/src/procedure/js_scripts.rs index d49f1a86c..1e1a48405 100644 --- a/backend/src/procedure/js_scripts.rs +++ b/backend/src/procedure/js_scripts.rs @@ -253,11 +253,13 @@ mod tests { &self, id: PackageId, path: &str, - callback: Callback, - ) -> Result { - println!("Adding callback"); - self.config_callbacks.send_modify(|x| x.push(callback)); - Ok(Value::Null) + callback: Option, + ) -> Result, Report> { + if let Some(callback) = callback { + println!("Adding callback"); + self.config_callbacks.send_modify(|x| x.push(callback)); + } + Ok(vec![Value::Null]) } #[allow(unused_variables)] async fn bind_local( @@ -265,7 +267,7 @@ mod tests { internal_port: u16, address_schema: AddressSchemaLocal, ) -> Result { - todo!() + unimplemented!() } #[allow(unused_variables)] async fn bind_onion( @@ -273,7 +275,27 @@ mod tests { internal_port: u16, address_schema: AddressSchemaOnion, ) -> Result { - todo!() + unimplemented!() + } + #[allow(unused_variables)] + async fn unbind_local(&self, id: InterfaceId, external: u16) -> Result<(), Report> { + unimplemented!() + } + #[allow(unused_variables)] + async fn unbind_onion(&self, id: InterfaceId, external: u16) -> Result<(), Report> { + unimplemented!() + } + fn set_started(&self) -> Result<(), Report> { + unimplemented!() + } + async fn restart(&self) -> Result<(), Report> { + unimplemented!() + } + async fn start(&self) -> Result<(), Report> { + unimplemented!() + } + async fn stop(&self) -> Result<(), Report> { + unimplemented!() } } #[tokio::test] diff --git a/backend/src/version/mod.rs b/backend/src/version/mod.rs index f7c7821e8..99977a627 100644 --- a/backend/src/version/mod.rs +++ b/backend/src/version/mod.rs @@ -35,7 +35,7 @@ impl Version { #[cfg(test)] fn as_sem_ver(&self) -> emver::Version { match self { - Version::LT0_3_4_3(LTWrapper(_, x)) => x.semver(), + Version::LT0_3_4_3(LTWrapper(_, x)) => x.clone(), Version::V0_3_4_3(Wrapper(x)) => x.semver(), Version::V0_4_0(Wrapper(x)) => x.semver(), Version::Other(x) => x.clone(), @@ -187,7 +187,7 @@ where let v = crate::util::Version::deserialize(deserializer)?; let version = T::new(); if *v == version.semver() { - Ok(Wrapper(version)) + Ok(Self(version)) } else { Err(serde::de::Error::custom("Mismatched Version")) } @@ -247,9 +247,22 @@ mod tests { fn versions() -> impl Strategy { prop_oneof![ - Just(Version::V0_3_4_3(Wrapper(v0_3_4_3::Version::new()))), - em_version().prop_map(Version::Other), - ] + <<<<<<< HEAD + Just(Version::V0_3_4_3(Wrapper(v0_3_4_3::Version::new()))), + ======= + em_version().prop_map(|v| if v < v0_3_4_1::Version::new().semver() { + Version::LT0_3_4_1(LTWrapper(v0_3_4_1::Version::new(), v)) + } else { + Version::LT0_3_4_1(LTWrapper( + v0_3_4_1::Version::new(), + emver::Version::new(0, 3, 0, 0), + )) + }), + Just(Version::V0_3_4_1(Wrapper(v0_3_4_1::Version::new()))), + Just(Version::V0_3_4_2(Wrapper(v0_3_4_2::Version::new()))), + >>>>>>> e83250f1 (integration/refactors) + em_version().prop_map(Version::Other), + ] } proptest! { diff --git a/frontend/patchdb-ui-seed.json b/frontend/patchdb-ui-seed.json index e32725588..04cdea674 100644 --- a/frontend/patchdb-ui-seed.json +++ b/frontend/patchdb-ui-seed.json @@ -1,6 +1,6 @@ { "name": null, - "ack-welcome": "0.3.4", + "ack-welcome": "0.4.0", "marketplace": { "selected-url": "https://registry.start9.com/", "known-hosts": { diff --git a/libs/helpers/src/os_api.rs b/libs/helpers/src/os_api.rs index 1ade88a34..47735332f 100644 --- a/libs/helpers/src/os_api.rs +++ b/libs/helpers/src/os_api.rs @@ -1,5 +1,6 @@ use std::sync::Arc; +use color_eyre::eyre::eyre; use color_eyre::Report; use models::InterfaceId; use models::PackageId; diff --git a/libs/js_engine/src/artifacts/loadModule.js b/libs/js_engine/src/artifacts/loadModule.js index adc288190..c422d5dea 100644 --- a/libs/js_engine/src/artifacts/loadModule.js +++ b/libs/js_engine/src/artifacts/loadModule.js @@ -299,7 +299,6 @@ const effects = { runCommand, runDaemon, runRsync, - chmod, signalGroup, sleep, start, diff --git a/libs/js_engine/src/lib.rs b/libs/js_engine/src/lib.rs index dd2031f2e..c06b4cf4b 100644 --- a/libs/js_engine/src/lib.rs +++ b/libs/js_engine/src/lib.rs @@ -293,7 +293,6 @@ impl JsExecutionEnvironment { fns::chmod::decl(), fns::bind_local::decl(), fns::bind_onion::decl(), - fns::chown::decl(), fns::fetch::decl(), fns::read_file::decl(), fns::metadata::decl(),