diff --git a/appmgr/Cargo.lock b/appmgr/Cargo.lock index 75e492e27..4071c96bf 100644 --- a/appmgr/Cargo.lock +++ b/appmgr/Cargo.lock @@ -153,7 +153,7 @@ dependencies = [ "cfg-if 0.1.10", "clang-sys", "clap", - "env_logger", + "env_logger 0.7.1", "lazy_static", "lazycell", "log", @@ -875,7 +875,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ "atty", - "humantime", + "humantime 1.3.0", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "env_logger" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +dependencies = [ + "atty", + "humantime 2.1.0", "log", "regex", "termcolor", @@ -1243,6 +1256,12 @@ dependencies = [ "quick-error", ] +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "hyper" version = "0.14.11" @@ -1287,12 +1306,12 @@ source = "git+https://github.com/Start9Labs/hyper-ws-listener.git?branch=main#d5 dependencies = [ "anyhow", "base64 0.13.0", - "env_logger", + "env_logger 0.9.0", "futures", "hyper", "log", "sha-1", - "tokio 1.8.1", + "tokio 1.9.0", "tokio-tungstenite", ] @@ -2530,9 +2549,9 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.9.6" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c4cfa741c5832d0ef7fab46cabed29c2aae926db0b11bb2069edd8db5e64e16" +checksum = "1a0c8611594e2ab4ebbf06ec7cbbf0a99450b8570e96cbf5188b5d5f6ef18d81" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", @@ -3186,7 +3205,7 @@ dependencies = [ "futures-util", "log", "pin-project", - "tokio 1.8.1", + "tokio 1.9.0", "tungstenite", ] @@ -3289,7 +3308,7 @@ dependencies = [ "httparse", "input_buffer", "log", - "rand 0.8.3", + "rand 0.8.4", "sha-1", "thiserror", "url", diff --git a/appmgr/src/context/rpc.rs b/appmgr/src/context/rpc.rs index da88595e5..b72ba5c88 100644 --- a/appmgr/src/context/rpc.rs +++ b/appmgr/src/context/rpc.rs @@ -99,12 +99,24 @@ impl RpcContext { Ok(Self(seed)) } pub async fn package_registry_url(&self) -> Result { - Ok(crate::db::DatabaseModel::new() - .server_info() - .registry() - .get(&mut self.db.handle(), false) - .await? - .to_owned()) + Ok( + if let Some(market) = crate::db::DatabaseModel::new() + .server_info() + .package_marketplace() + .get(&mut self.db.handle(), false) + .await? + .to_owned() + { + market + } else { + crate::db::DatabaseModel::new() + .server_info() + .eos_marketplace() + .get(&mut self.db.handle(), false) + .await? + .to_owned() + }, + ) } } impl Context for RpcContext { diff --git a/appmgr/src/db/model.rs b/appmgr/src/db/model.rs index 901561697..c7b64e24e 100644 --- a/appmgr/src/db/model.rs +++ b/appmgr/src/db/model.rs @@ -39,9 +39,33 @@ impl Database { "http://privacy34kn4ez3y3nijweec6w4g54i3g54sdv7r5mr6soma3w4begyd.onion" .parse() .unwrap(), - updating: false, - registry: "https://beta-registry-0-3.start9labs.com".parse().unwrap(), + status: ServerStatus::Running, + eos_marketplace: "https://beta-registry-0-3.start9labs.com".parse().unwrap(), + package_marketplace: None, + wifi: WifiInfo { + ssids: Vec::new(), + connected: None, + selected: None, + }, unread_notification_count: 0, + specs: ServerSpecs { + cpu: Usage { + used: 0_f64, + total: 1_f64, + }, + disk: Usage { + used: 0_f64, + total: 1_f64, + }, + memory: Usage { + used: 0_f64, + total: 1_f64, + }, + }, + connection_addresses: ConnectionAddresses { + tor: Vec::new(), + clearnet: Vec::new(), + }, }, package_data: AllPackageData::default(), broken_packages: Vec::new(), @@ -62,9 +86,51 @@ pub struct ServerInfo { version: Version, lan_address: Url, tor_address: Url, - updating: bool, - registry: Url, + status: ServerStatus, + eos_marketplace: Url, + package_marketplace: Option, + wifi: WifiInfo, unread_notification_count: u64, + specs: ServerSpecs, + connection_addresses: ConnectionAddresses, +} + +#[derive(Debug, Deserialize, Serialize)] +#[serde(rename_all = "kebab-case")] +pub enum ServerStatus { + Running, + Updating, + BackingUp, +} + +#[derive(Debug, Deserialize, Serialize)] +#[serde(rename_all = "kebab-case")] +pub struct WifiInfo { + pub ssids: Vec, + pub selected: Option, + pub connected: Option, +} + +#[derive(Debug, Deserialize, Serialize)] +#[serde(rename_all = "kebab-case")] +pub struct ServerSpecs { + pub cpu: Usage, + pub disk: Usage, + pub memory: Usage, +} + +#[derive(Debug, Deserialize, Serialize)] +#[serde(rename_all = "kebab-case")] +pub struct Usage { + pub used: f64, + pub total: f64, +} + +#[derive(Debug, Deserialize, Serialize)] +#[serde(rename_all = "kebab-case")] +pub struct ConnectionAddresses { + pub tor: Vec, + pub clearnet: Vec, } #[derive(Debug, Default, Deserialize, Serialize)] @@ -150,6 +216,8 @@ impl PackageDataEntryModel { pub struct InstalledPackageDataEntry { #[model] pub status: Status, + #[model] + pub manifest: Manifest, pub system_pointers: Vec, #[model] pub current_dependents: IndexMap, @@ -158,13 +226,6 @@ pub struct InstalledPackageDataEntry { #[model] pub interface_addresses: InterfaceAddressMap, } -impl InstalledPackageDataEntryModel { - pub fn manifest(self) -> ManifestModel { - let mut ptr = JsonPointer::from(self); - ptr.pop_end(); - PackageDataEntryModel::from(ptr).manifest() - } -} #[derive(Clone, Debug, Default, Deserialize, Serialize, HasModel)] #[serde(rename_all = "kebab-case")] diff --git a/appmgr/src/dependencies.rs b/appmgr/src/dependencies.rs index 14651a349..4c8a7c99f 100644 --- a/appmgr/src/dependencies.rs +++ b/appmgr/src/dependencies.rs @@ -121,6 +121,7 @@ impl HasModel for Dependencies { pub struct DepInfo { pub version: VersionRange, pub optional: Option, + pub recommended: bool, pub description: Option, pub critical: bool, #[serde(default)] diff --git a/appmgr/src/install/mod.rs b/appmgr/src/install/mod.rs index a430dcb27..4218c86b9 100644 --- a/appmgr/src/install/mod.rs +++ b/appmgr/src/install/mod.rs @@ -406,6 +406,7 @@ pub async fn install_s9pk( dependency_errors: DependencyErrors::init(&mut tx, &manifest, ¤t_dependencies) .await?, }, + manifest: manifest.clone(), system_pointers: Vec::new(), current_dependents: { // search required dependencies diff --git a/appmgr/src/net/interface.rs b/appmgr/src/net/interface.rs index 63327b918..7b79180cb 100644 --- a/appmgr/src/net/interface.rs +++ b/appmgr/src/net/interface.rs @@ -135,6 +135,8 @@ impl> AsRef for InterfaceId { #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(rename_all = "kebab-case")] pub struct Interface { + pub name: String, + pub description: String, pub tor_config: Option, pub lan_config: Option>, pub ui: bool, diff --git a/appmgr/src/s9pk/manifest.rs b/appmgr/src/s9pk/manifest.rs index 2f0d04b5e..34856a371 100644 --- a/appmgr/src/s9pk/manifest.rs +++ b/appmgr/src/s9pk/manifest.rs @@ -113,6 +113,7 @@ pub struct Manifest { pub upstream_repo: Url, pub support_site: Option, pub marketing_site: Option, + pub donation_url: Option, #[serde(default)] pub alerts: Alerts, #[model] diff --git a/appmgr/src/status/health_check.rs b/appmgr/src/status/health_check.rs index 2903d7bc3..c9345fbd2 100644 --- a/appmgr/src/status/health_check.rs +++ b/appmgr/src/status/health_check.rs @@ -95,7 +95,8 @@ impl HealthCheck { result: match res { Ok(()) => HealthCheckResultVariant::Success, Err((59, _)) => HealthCheckResultVariant::Disabled, - Err((60, _)) => HealthCheckResultVariant::WarmingUp, + Err((60, _)) => HealthCheckResultVariant::Starting, + Err((61, message)) => HealthCheckResultVariant::Loading { message }, Err((_, error)) => HealthCheckResultVariant::Failure { error }, }, }) @@ -123,17 +124,19 @@ impl HealthCheckResult { #[serde(rename_all = "kebab-case")] #[serde(tag = "result")] pub enum HealthCheckResultVariant { - WarmingUp, - Disabled, Success, + Disabled, + Starting, + Loading { message: String }, Failure { error: String }, } impl std::fmt::Display for HealthCheckResultVariant { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - HealthCheckResultVariant::WarmingUp => write!(f, "Warming Up"), - HealthCheckResultVariant::Disabled => write!(f, "Disabled"), HealthCheckResultVariant::Success => write!(f, "Succeeded"), + HealthCheckResultVariant::Disabled => write!(f, "Disabled"), + HealthCheckResultVariant::Starting => write!(f, "Starting"), + HealthCheckResultVariant::Loading { message } => write!(f, "Loading ({})", message), HealthCheckResultVariant::Failure { error } => write!(f, "Failed ({})", error), } } diff --git a/compat/Cargo.lock b/compat/Cargo.lock index 447f5f69b..19236d594 100644 --- a/compat/Cargo.lock +++ b/compat/Cargo.lock @@ -739,6 +739,7 @@ dependencies = [ "futures", "git-version", "http", + "hyper-ws-listener", "indexmap", "itertools 0.10.1", "jsonpath_lib", @@ -771,6 +772,7 @@ dependencies = [ "tokio-compat-02", "tokio-stream", "tokio-tar", + "tokio-tungstenite", "tokio-util", "toml", "torut", @@ -814,6 +816,19 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "env_logger" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + [[package]] name = "fake-simd" version = "0.1.2" @@ -1161,6 +1176,12 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "hyper" version = "0.14.11" @@ -1198,6 +1219,22 @@ dependencies = [ "tokio-native-tls", ] +[[package]] +name = "hyper-ws-listener" +version = "0.1.0" +source = "git+https://github.com/Start9Labs/hyper-ws-listener.git?branch=main#d5db3698d61293375384a5d8aa980c834d45028a" +dependencies = [ + "anyhow", + "base64 0.13.0", + "env_logger", + "futures", + "hyper", + "log", + "sha-1", + "tokio 1.9.0", + "tokio-tungstenite", +] + [[package]] name = "hyperlocal" version = "0.8.0" @@ -1239,6 +1276,15 @@ dependencies = [ "serde", ] +[[package]] +name = "input_buffer" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f97967975f448f1a7ddb12b0bc41069d09ed6a1c161a92687e057325db35d413" +dependencies = [ + "bytes 1.0.1", +] + [[package]] name = "instant" version = "0.1.10" @@ -2377,6 +2423,19 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "sha-1" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a0c8611594e2ab4ebbf06ec7cbbf0a99450b8570e96cbf5188b5d5f6ef18d81" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + [[package]] name = "sha1" version = "0.6.0" @@ -2780,6 +2839,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "termcolor" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +dependencies = [ + "winapi-util", +] + [[package]] name = "textwrap" version = "0.11.0" @@ -2998,6 +3066,19 @@ dependencies = [ "xattr", ] +[[package]] +name = "tokio-tungstenite" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e96bb520beab540ab664bd5a9cfeaa1fcd846fa68c830b42e2c8963071251d2" +dependencies = [ + "futures-util", + "log", + "pin-project", + "tokio 1.9.0", + "tungstenite", +] + [[package]] name = "tokio-util" version = "0.6.7" @@ -3084,6 +3165,26 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +[[package]] +name = "tungstenite" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fe8dada8c1a3aeca77d6b51a4f1314e0f4b8e438b7b1b71e3ddaca8080e4093" +dependencies = [ + "base64 0.13.0", + "byteorder", + "bytes 1.0.1", + "http", + "httparse", + "input_buffer", + "log", + "rand 0.8.4", + "sha-1", + "thiserror", + "url", + "utf-8", +] + [[package]] name = "typed-builder" version = "0.9.0" @@ -3168,6 +3269,12 @@ dependencies = [ "serde", ] +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + [[package]] name = "vcpkg" version = "0.2.15" @@ -3331,6 +3438,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/ui/src/app/services/api/api.fixures.ts b/ui/src/app/services/api/api.fixures.ts index 95db82fe3..b13e017a7 100644 --- a/ui/src/app/services/api/api.fixures.ts +++ b/ui/src/app/services/api/api.fixures.ts @@ -46,14 +46,14 @@ export module Mock { system: true, entrypoint: '', args: [''], - mounts: { }, + mounts: {}, 'io-format': DockerIoFormat.Yaml, inject: false, 'shm-size': '', }, - 'health-checks': { }, + 'health-checks': {}, config: null, - volumes: { }, + volumes: {}, 'min-os-version': '0.2.12', interfaces: { ui: { @@ -61,10 +61,9 @@ export module Mock { description: 'Web application for viewing information about your node and the Bitcoin network.', ui: true, 'tor-config': { - 'hidden-service-version': 'v3', - 'port-mapping': { }, + 'port-mapping': {}, }, - 'lan-config': { }, + 'lan-config': {}, protocols: [], }, rpc: { @@ -72,10 +71,9 @@ export module Mock { description: 'Used by wallets to interact with your Bitcoin Core node.', ui: false, 'tor-config': { - 'hidden-service-version': 'v3', - 'port-mapping': { }, + 'port-mapping': {}, }, - 'lan-config': { }, + 'lan-config': {}, protocols: [], }, p2p: { @@ -83,10 +81,9 @@ export module Mock { description: 'Used by other Bitcoin nodes to communicate and interact with your node.', ui: false, 'tor-config': { - 'hidden-service-version': 'v3', - 'port-mapping': { }, + 'port-mapping': {}, }, - 'lan-config': { }, + 'lan-config': {}, protocols: [], }, }, @@ -97,7 +94,7 @@ export module Mock { system: true, entrypoint: '', args: [''], - mounts: { }, + mounts: {}, 'io-format': DockerIoFormat.Yaml, inject: false, 'shm-size': '', @@ -108,7 +105,7 @@ export module Mock { system: true, entrypoint: '', args: [''], - mounts: { }, + mounts: {}, 'io-format': DockerIoFormat.Yaml, inject: false, 'shm-size': '', @@ -127,7 +124,7 @@ export module Mock { system: true, entrypoint: '', args: [''], - mounts: { }, + mounts: {}, 'io-format': DockerIoFormat.Yaml, inject: false, 'shm-size': '', @@ -135,8 +132,8 @@ export module Mock { 'input-spec': null, }, }, - permissions: { }, - dependencies: { }, + permissions: {}, + dependencies: {}, } export const MockManifestLnd: Manifest = { @@ -167,14 +164,14 @@ export module Mock { system: true, entrypoint: '', args: [''], - mounts: { }, + mounts: {}, 'io-format': DockerIoFormat.Yaml, inject: false, 'shm-size': '', }, - 'health-checks': { }, + 'health-checks': {}, config: null, - volumes: { }, + volumes: {}, 'min-os-version': '0.2.12', interfaces: { rpc: { @@ -182,8 +179,7 @@ export module Mock { description: 'Good for connecting to your node at a distance.', ui: true, 'tor-config': { - 'hidden-service-version': 'v3', - 'port-mapping': { }, + 'port-mapping': {}, }, 'lan-config': { 44: { @@ -198,8 +194,7 @@ export module Mock { description: 'Certain wallet use grpc.', ui: false, 'tor-config': { - 'hidden-service-version': 'v3', - 'port-mapping': { }, + 'port-mapping': {}, }, 'lan-config': { 66: { @@ -217,7 +212,7 @@ export module Mock { system: true, entrypoint: '', args: [''], - mounts: { }, + mounts: {}, 'io-format': DockerIoFormat.Yaml, inject: false, 'shm-size': '', @@ -228,7 +223,7 @@ export module Mock { system: true, entrypoint: '', args: [''], - mounts: { }, + mounts: {}, 'io-format': DockerIoFormat.Yaml, inject: false, 'shm-size': '', @@ -247,7 +242,7 @@ export module Mock { system: true, entrypoint: '', args: [''], - mounts: { }, + mounts: {}, 'io-format': DockerIoFormat.Yaml, inject: false, 'shm-size': '', @@ -263,23 +258,69 @@ export module Mock { }, }, }, - permissions: { }, + permissions: {}, dependencies: { 'bitcoind': { version: '=0.21.0', description: 'LND needs bitcoin to live.', optional: null, recommended: true, - config: [], - interfaces: [], + critical: true, + config: { + check: { + type: 'docker', + image: 'alpine', + system: true, + entrypoint: 'true', + args: [], + mounts: {}, + 'io-format': DockerIoFormat.Cbor, + inject: false, + "shm-size": '10m' + }, + "auto-configure": { + type: 'docker', + image: 'alpine', + system: true, + entrypoint: 'cat', + args: [], + mounts: {}, + 'io-format': DockerIoFormat.Cbor, + inject: false, + "shm-size": '10m' + } + }, }, 'bitcoin-proxy': { version: '>=0.2.2', description: 'As long as Bitcoin is pruned, LND needs Bitcoin Proxy to fetch block over the P2P network.', optional: null, recommended: true, - config: [], - interfaces: [], + critical: true, + config: { + check: { + type: 'docker', + image: 'alpine', + system: true, + entrypoint: 'true', + args: [], + mounts: {}, + 'io-format': DockerIoFormat.Cbor, + inject: false, + "shm-size": '10m' + }, + "auto-configure": { + type: 'docker', + image: 'alpine', + system: true, + entrypoint: 'cat', + args: [], + mounts: {}, + 'io-format': DockerIoFormat.Cbor, + inject: false, + "shm-size": '10m' + } + }, }, }, } @@ -312,14 +353,14 @@ export module Mock { system: true, entrypoint: '', args: [''], - mounts: { }, + mounts: {}, 'io-format': DockerIoFormat.Yaml, inject: false, 'shm-size': '', }, - 'health-checks': { }, + 'health-checks': {}, config: null, - volumes: { }, + volumes: {}, 'min-os-version': '0.2.12', interfaces: { rpc: { @@ -327,8 +368,7 @@ export module Mock { description: 'Good for connecting to your node at a distance.', ui: true, 'tor-config': { - 'hidden-service-version': 'v3', - 'port-mapping': { }, + 'port-mapping': {}, }, 'lan-config': { 44: { @@ -346,7 +386,7 @@ export module Mock { system: true, entrypoint: '', args: [''], - mounts: { }, + mounts: {}, 'io-format': DockerIoFormat.Yaml, inject: false, 'shm-size': '', @@ -357,23 +397,46 @@ export module Mock { system: true, entrypoint: '', args: [''], - mounts: { }, + mounts: {}, 'io-format': DockerIoFormat.Yaml, inject: false, 'shm-size': '', }, }, migrations: null, - actions: { }, - permissions: { }, + actions: {}, + permissions: {}, dependencies: { 'bitcoind': { version: '>=0.20.0', description: 'Bitcoin Proxy requires a Bitcoin node.', optional: null, recommended: true, - config: [], - interfaces: [], + critical: false, + config: { + check: { + type: 'docker', + image: 'alpine', + system: true, + entrypoint: 'true', + args: [], + mounts: {}, + 'io-format': DockerIoFormat.Cbor, + inject: false, + "shm-size": '10m' + }, + "auto-configure": { + type: 'docker', + image: 'alpine', + system: true, + entrypoint: 'cat', + args: [], + mounts: {}, + 'io-format': DockerIoFormat.Cbor, + inject: false, + "shm-size": '10m' + } + }, }, }, } @@ -394,7 +457,7 @@ export module Mock { }, categories: ['bitcoin', 'cryptocurrency'], versions: ['0.19.0', '0.20.0', '0.21.0'], - 'dependency-metadata': { }, + 'dependency-metadata': {}, }, '0.20.0': { icon: 'assets/img/service-icons/bitcoind.png', @@ -406,7 +469,7 @@ export module Mock { }, categories: ['bitcoin', 'cryptocurrency'], versions: ['0.19.0', '0.20.0', '0.21.0'], - 'dependency-metadata': { }, + 'dependency-metadata': {}, }, '0.21.0': { icon: 'assets/img/service-icons/bitcoind.png', @@ -419,7 +482,7 @@ export module Mock { }, categories: ['bitcoin', 'cryptocurrency'], versions: ['0.19.0', '0.20.0', '0.21.0'], - 'dependency-metadata': { }, + 'dependency-metadata': {}, }, 'latest': { icon: 'assets/img/service-icons/bitcoind.png', @@ -431,7 +494,7 @@ export module Mock { }, categories: ['bitcoin', 'cryptocurrency'], versions: ['0.19.0', '0.20.0', '0.21.0'], - 'dependency-metadata': { }, + 'dependency-metadata': {}, }, }, 'lnd': { @@ -532,17 +595,15 @@ export module Mock { main: { status: PackageMainStatus.Running, started: new Date().toISOString(), - health: { }, + health: {}, }, - 'dependency-errors': { }, + 'dependency-errors': {}, }, - 'interface-info': { - ip: '10.0.0.1', - addresses: { - rpc: { - 'tor-address': 'bitcoinproxy-rpc-address.onion', - 'lan-address': 'bitcoinproxy-rpc-address.local', - }, + manifest: MockManifestBitcoinProxy, + 'interface-addresses': { + rpc: { + 'tor-address': 'bitcoinproxy-rpc-address.onion', + 'lan-address': 'bitcoinproxy-rpc-address.local', }, }, 'system-pointers': [], @@ -956,55 +1017,55 @@ export module Mock { ], 'range': '[0, 2]', 'spec': { - 'tag': { - 'id': 'preference', - 'name': 'Preferences', - 'variant-names': { - 'summer': 'Summer', - 'winter': 'Winter', - 'other': 'Other', + 'tag': { + 'id': 'preference', + 'name': 'Preferences', + 'variant-names': { + 'summer': 'Summer', + 'winter': 'Winter', + 'other': 'Other', + }, + }, + // this default is used to make a union selection when a new list element is first created + 'default': 'summer', + 'variants': { + 'summer': { + 'favorite-tree': { + 'name': 'Favorite Tree', + 'type': 'string', + 'nullable': false, + 'description': 'What is your favorite tree?', + 'default': 'Maple', + 'masked': false, + 'copyable': false, + }, + 'favorite-flower': { + 'name': 'Favorite Flower', + 'type': 'enum', + 'description': 'Select your favorite flower', + 'value-names': { + 'none': 'Hate Flowers', + 'red': 'Red', + 'blue': 'Blue', + 'purple': 'Purple', + }, + 'values': [ + 'none', + 'red', + 'blue', + 'purple', + ], + 'default': 'none', + }, + }, + 'winter': { + 'like-snow': { + 'name': 'Like Snow?', + 'type': 'boolean', + 'description': 'Do you like snow or not?', + 'default': true, }, }, - // this default is used to make a union selection when a new list element is first created - 'default': 'summer', - 'variants': { - 'summer': { - 'favorite-tree': { - 'name': 'Favorite Tree', - 'type': 'string', - 'nullable': false, - 'description': 'What is your favorite tree?', - 'default': 'Maple', - 'masked': false, - 'copyable': false, - }, - 'favorite-flower': { - 'name': 'Favorite Flower', - 'type': 'enum', - 'description': 'Select your favorite flower', - 'value-names': { - 'none': 'Hate Flowers', - 'red': 'Red', - 'blue': 'Blue', - 'purple': 'Purple', - }, - 'values': [ - 'none', - 'red', - 'blue', - 'purple', - ], - 'default': 'none', - }, - }, - 'winter': { - 'like-snow': { - 'name': 'Like Snow?', - 'type': 'boolean', - 'description': 'Do you like snow or not?', - 'default': true, - }, - }, }, 'unique-by': 'preference', }, @@ -1188,12 +1249,12 @@ export module Mock { 'default': 'internal', 'change-warning': 'Careful changing this', 'tag': { - 'id': 'type', - 'name': 'Type', - 'variant-names': { - 'internal': 'Internal', - 'external': 'External', - }, + 'id': 'type', + 'name': 'Type', + 'variant-names': { + 'internal': 'Internal', + 'external': 'External', + }, }, 'variants': { 'internal': { @@ -1260,7 +1321,7 @@ export module Mock { 'description': 'api keys that are authorized to access your Bitcoin node.', 'range': '[0,*)', 'default': [], - 'spec': { }, + 'spec': {}, }, }, // actual config @@ -1395,21 +1456,19 @@ export module Mock { }, }, }, - 'interface-info': { - ip: '10.0.0.1', - addresses: { - rpc: { - 'tor-address': 'lnd-rpc-address.onion', - 'lan-address': 'lnd-rpc-address.local', - }, - grpc: { - 'tor-address': 'lnd-grpc-address.onion', - 'lan-address': 'lnd-grpc-address.local', - }, + manifest: MockManifestLnd, + 'interface-addresses': { + rpc: { + 'tor-address': 'lnd-rpc-address.onion', + 'lan-address': 'lnd-rpc-address.local', + }, + grpc: { + 'tor-address': 'lnd-grpc-address.onion', + 'lan-address': 'lnd-grpc-address.local', }, }, 'system-pointers': [], - 'current-dependents': { }, + 'current-dependents': {}, 'current-dependencies': { 'bitcoind': { pointers: [], diff --git a/ui/src/app/services/patch-db/data-model.ts b/ui/src/app/services/patch-db/data-model.ts index 4acea4018..53d9d53cb 100644 --- a/ui/src/app/services/patch-db/data-model.ts +++ b/ui/src/app/services/patch-db/data-model.ts @@ -22,9 +22,9 @@ export interface ServerInfo { wifi: WiFiInfo 'unread-notification-count': number specs: { - CPU: string - Disk: string - Memory: string + cpu: Usage + disk: Usage + memory: Usage } 'connection-addresses': { tor: string[] @@ -44,6 +44,11 @@ export interface WiFiInfo { connected: string | null } +export interface Usage { + used: number + total: number +} + export interface PackageDataEntry { state: PackageState 'static-files': { @@ -68,10 +73,13 @@ export interface InstallProgress { export interface InstalledPackageDataEntry { status: Status - 'interface-info': InterfaceInfo + manifest: Manifest, 'system-pointers': any[] 'current-dependents': { [id: string]: CurrentDependencyInfo } 'current-dependencies': { [id: string]: CurrentDependencyInfo } + 'interface-addresses': { + [id: string]: { 'tor-address': string, 'lan-address': string } + } } export interface CurrentDependencyInfo { @@ -152,6 +160,10 @@ export interface VolumeData { readonly: boolean } +export interface VolumeAssets { + type: VolumeType.Assets +} + export interface VolumePointer { type: VolumeType.Pointer 'package-id': string @@ -165,11 +177,6 @@ export interface VolumeCertificate { 'interface-id': string } -export interface VolumeHiddenService { - type: VolumeType.HiddenService - 'interface-id': string -} - export interface VolumeBackup { type: VolumeType.Backup readonly: boolean @@ -177,23 +184,22 @@ export interface VolumeBackup { export enum VolumeType { Data = 'data', + Assets = 'assets', Pointer = 'pointer', Certificate = 'certificate', - HiddenService = 'hidden-service', Backup = 'backup', } export interface InterfaceDef { name: string description: string - ui: boolean 'tor-config': TorConfig | null 'lan-config': LanConfig | null + ui: boolean protocols: string[] } export interface TorConfig { - 'hidden-service-version': string 'port-mapping': { [port: number]: number } } @@ -348,35 +354,10 @@ export interface DependencyEntry { optional: string | null recommended: boolean description: string | null - config: ConfigRuleEntryWithSuggestions[] // @TODO when do we use this? - interfaces: any[] // @TODO placeholder -} - -export interface ConfigRuleEntryWithSuggestions { - rule: string - description: string - suggestions: Suggestion[] -} - -export interface Suggestion { - condition: string | null - set?: { - var: string - to?: string - 'to-value'?: any - 'to-entropy'?: { charset: string, len: number } - } - delete?: string - push?: { - to: string - value: any - } -} - -export interface InterfaceInfo { - ip: string - addresses: { - [id: string]: { 'tor-address': string, 'lan-address': string } + critical: boolean, + config: { + check: ActionImpl, + 'auto-configure': ActionImpl } }