mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
update types
This commit is contained in:
46
core/Cargo.lock
generated
46
core/Cargo.lock
generated
@@ -2,12 +2,6 @@
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "Inflector"
|
||||
version = "0.11.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
|
||||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
version = "0.24.2"
|
||||
@@ -3826,8 +3820,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "imbl-value"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80b000e99a562d9598ae56029f675dbf1104e8aed5a9b074824a752de0a61f39"
|
||||
source = "git+https://github.com/Start9Labs/imbl-value.git#82b91f973d67139ce5b3f662407f436bc64d2fe9"
|
||||
dependencies = [
|
||||
"imbl",
|
||||
"serde",
|
||||
@@ -3837,12 +3830,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "imbl-value"
|
||||
version = "0.4.0"
|
||||
source = "git+https://github.com/Start9Labs/imbl-value.git#82b91f973d67139ce5b3f662407f436bc64d2fe9"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b5a3dc7150969e3a921eeb9790fd9976ce9164148bd26b0c9d7048fb8615ad5"
|
||||
dependencies = [
|
||||
"imbl",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"ts-rs",
|
||||
"yasi",
|
||||
]
|
||||
|
||||
@@ -4163,7 +4158,7 @@ dependencies = [
|
||||
name = "json-patch"
|
||||
version = "0.2.7-alpha.0"
|
||||
dependencies = [
|
||||
"imbl-value 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"imbl-value 0.4.1",
|
||||
"json-ptr",
|
||||
"serde",
|
||||
]
|
||||
@@ -4173,7 +4168,7 @@ name = "json-ptr"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"imbl",
|
||||
"imbl-value 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"imbl-value 0.4.1",
|
||||
"serde",
|
||||
"thiserror 2.0.14",
|
||||
]
|
||||
@@ -4183,7 +4178,7 @@ name = "jsonpath_lib"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/Start9Labs/jsonpath.git#1cacbd64afa2e1941a21fef06bad14317ba92f30"
|
||||
dependencies = [
|
||||
"imbl-value 0.4.0 (git+https://github.com/Start9Labs/imbl-value.git)",
|
||||
"imbl-value 0.4.0",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -5238,7 +5233,7 @@ dependencies = [
|
||||
"fd-lock-rs",
|
||||
"futures",
|
||||
"imbl",
|
||||
"imbl-value 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"imbl-value 0.4.1",
|
||||
"json-patch",
|
||||
"json-ptr",
|
||||
"lazy_static",
|
||||
@@ -6269,7 +6264,7 @@ dependencies = [
|
||||
"futures",
|
||||
"http",
|
||||
"http-body-util",
|
||||
"imbl-value 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"imbl-value 0.4.1",
|
||||
"itertools 0.14.0",
|
||||
"lazy_format",
|
||||
"lazy_static",
|
||||
@@ -7345,7 +7340,7 @@ dependencies = [
|
||||
"hyper-util",
|
||||
"id-pool",
|
||||
"imbl",
|
||||
"imbl-value 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"imbl-value 0.4.1",
|
||||
"include_dir",
|
||||
"indexmap 2.10.0",
|
||||
"indicatif",
|
||||
@@ -9276,19 +9271,20 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
||||
|
||||
[[package]]
|
||||
name = "ts-rs"
|
||||
version = "8.1.0"
|
||||
source = "git+https://github.com/dr-bonez/ts-rs.git?branch=feature%2Ftop-level-as#7ae88ade90b5e724159048a663a0bdb04bed27f7"
|
||||
version = "11.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ef1b7a6d914a34127ed8e1fa927eb7088903787bcded4fa3eef8f85ee1568be"
|
||||
dependencies = [
|
||||
"thiserror 1.0.69",
|
||||
"thiserror 2.0.14",
|
||||
"ts-rs-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ts-rs-macros"
|
||||
version = "8.1.0"
|
||||
source = "git+https://github.com/dr-bonez/ts-rs.git?branch=feature%2Ftop-level-as#7ae88ade90b5e724159048a663a0bdb04bed27f7"
|
||||
version = "11.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e9d4ed7b4c18cc150a6a0a1e9ea1ecfa688791220781af6e119f9599a8502a0a"
|
||||
dependencies = [
|
||||
"Inflector",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.104",
|
||||
@@ -10312,14 +10308,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "yasi"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f355ab62ebe30b758c1f4ab096a306722c4b7dbfb9d8c07d18c70d71a945588"
|
||||
checksum = "d7d16d66ba6622e1388f01e378e2543912bf83984c3b90f3b2ccdea919a664a5"
|
||||
dependencies = [
|
||||
"ahash 0.8.12",
|
||||
"hashbrown 0.13.2",
|
||||
"lazy_static",
|
||||
"serde",
|
||||
"tinyvec",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -31,9 +31,9 @@ rustls = "0.23"
|
||||
serde = { version = "1.0", features = ["derive", "rc"] }
|
||||
serde_json = "1.0"
|
||||
ssh-key = "0.6.2"
|
||||
ts-rs = { git = "https://github.com/dr-bonez/ts-rs.git", branch = "feature/top-level-as" } # "8"
|
||||
ts-rs = "11"
|
||||
thiserror = "2.0"
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tracing = "0.1.39"
|
||||
yasi = "0.1.5"
|
||||
yasi = { version = "0.1.6", features = ["serde", "ts-rs"] }
|
||||
zbus = "5"
|
||||
|
||||
@@ -135,7 +135,7 @@ id-pool = { version = "0.2.2", default-features = false, features = [
|
||||
"u16",
|
||||
] }
|
||||
imbl = { version = "6", features = ["serde", "small-chunks"] }
|
||||
imbl-value = "0.4.0"
|
||||
imbl-value = { version = "0.4.1", features = ["ts-rs"] }
|
||||
include_dir = { version = "0.7.3", features = ["metadata"] }
|
||||
indexmap = { version = "2.0.2", features = ["serde"] }
|
||||
indicatif = { version = "0.17.7", features = ["tokio"] }
|
||||
@@ -236,7 +236,7 @@ tracing-error = "0.2.0"
|
||||
tracing-futures = "0.2.5"
|
||||
tracing-journald = "0.3.0"
|
||||
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
|
||||
ts-rs = { git = "https://github.com/dr-bonez/ts-rs.git", branch = "feature/top-level-as" } # "8.1.0"
|
||||
ts-rs = "11.0.1"
|
||||
typed-builder = "0.21.0"
|
||||
unix-named-pipe = "0.2.0"
|
||||
url = { version = "2.4.1", features = ["serde"] }
|
||||
|
||||
@@ -20,7 +20,7 @@ use crate::db::model::package::AllPackageData;
|
||||
use crate::net::acme::AcmeProvider;
|
||||
use crate::net::forward::START9_BRIDGE_IFACE;
|
||||
use crate::net::host::binding::{AddSslOptions, BindInfo, BindOptions, NetInfo};
|
||||
use crate::net::host::{Domains, Host};
|
||||
use crate::net::host::Host;
|
||||
use crate::net::utils::ipv6_is_local;
|
||||
use crate::net::vhost::AlpnInfo;
|
||||
use crate::prelude::*;
|
||||
@@ -82,7 +82,8 @@ impl Public {
|
||||
.into_iter()
|
||||
.collect(),
|
||||
onions: account.tor_keys.iter().map(|k| k.onion_address()).collect(),
|
||||
domains: Domains::default(),
|
||||
public_domains: BTreeMap::new(),
|
||||
private_domains: BTreeSet::new(),
|
||||
hostname_info: BTreeMap::new(),
|
||||
},
|
||||
wifi: WifiInfo {
|
||||
|
||||
@@ -88,8 +88,7 @@ impl SignatureAuthContext for RpcContext {
|
||||
.as_server_info()
|
||||
.as_network()
|
||||
.as_host()
|
||||
.as_domains()
|
||||
.as_public()
|
||||
.as_public_domains()
|
||||
.keys()
|
||||
.map(|k| k.into_iter())
|
||||
.transpose(),
|
||||
@@ -99,8 +98,7 @@ impl SignatureAuthContext for RpcContext {
|
||||
.as_server_info()
|
||||
.as_network()
|
||||
.as_host()
|
||||
.as_domains()
|
||||
.as_private()
|
||||
.as_private_domains()
|
||||
.de()
|
||||
.map(|k| k.into_iter())
|
||||
.transpose(),
|
||||
|
||||
@@ -63,10 +63,10 @@ fn check_duplicates(db: &DatabaseModel) -> Result<(), Error> {
|
||||
for onion in host.as_onions().de()? {
|
||||
check_onion(onion)?;
|
||||
}
|
||||
for domain in host.as_domains().as_public().keys()? {
|
||||
for domain in host.as_public_domains().keys()? {
|
||||
check_domain(domain)?;
|
||||
}
|
||||
for domain in host.as_domains().as_private().de()? {
|
||||
for domain in host.as_private_domains().de()? {
|
||||
check_domain(domain)?;
|
||||
}
|
||||
}
|
||||
@@ -230,8 +230,7 @@ pub async fn add_public_domain<Kind: HostApiKind>(
|
||||
}
|
||||
|
||||
Kind::host_for(&inheritance, db)?
|
||||
.as_domains_mut()
|
||||
.as_public_mut()
|
||||
.as_public_domains_mut()
|
||||
.insert(domain, &PublicDomainConfig { acme, gateway })?;
|
||||
check_duplicates(db)
|
||||
})
|
||||
@@ -255,8 +254,7 @@ pub async fn remove_public_domain<Kind: HostApiKind>(
|
||||
ctx.db
|
||||
.mutate(|db| {
|
||||
Kind::host_for(&inheritance, db)?
|
||||
.as_domains_mut()
|
||||
.as_public_mut()
|
||||
.as_public_domains_mut()
|
||||
.remove(&domain)
|
||||
})
|
||||
.await
|
||||
@@ -279,8 +277,7 @@ pub async fn add_private_domain<Kind: HostApiKind>(
|
||||
ctx.db
|
||||
.mutate(|db| {
|
||||
Kind::host_for(&inheritance, db)?
|
||||
.as_domains_mut()
|
||||
.as_private_mut()
|
||||
.as_private_domains_mut()
|
||||
.mutate(|d| Ok(d.insert(domain)))?;
|
||||
check_duplicates(db)
|
||||
})
|
||||
@@ -299,8 +296,7 @@ pub async fn remove_private_domain<Kind: HostApiKind>(
|
||||
ctx.db
|
||||
.mutate(|db| {
|
||||
Kind::host_for(&inheritance, db)?
|
||||
.as_domains_mut()
|
||||
.as_private_mut()
|
||||
.as_private_domains_mut()
|
||||
.mutate(|d| Ok(d.remove(&domain)))
|
||||
})
|
||||
.await
|
||||
|
||||
@@ -30,22 +30,12 @@ pub struct Host {
|
||||
pub bindings: BTreeMap<u16, BindInfo>,
|
||||
#[ts(type = "string[]")]
|
||||
pub onions: BTreeSet<OnionAddress>,
|
||||
pub domains: Domains,
|
||||
pub public_domains: BTreeMap<InternedString, PublicDomainConfig>,
|
||||
pub private_domains: BTreeSet<InternedString>,
|
||||
/// COMPUTED: NetService::update
|
||||
pub hostname_info: BTreeMap<u16, Vec<HostnameInfo>>, // internal port -> Hostnames
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Serialize, HasModel, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[model = "Model<Self>"]
|
||||
#[ts(export)]
|
||||
pub struct Domains {
|
||||
#[ts(as = "BTreeMap::<String, PublicDomainConfig>")]
|
||||
pub public: BTreeMap<InternedString, PublicDomainConfig>,
|
||||
#[ts(as = "BTreeSet::<String>")]
|
||||
pub private: BTreeSet<InternedString>,
|
||||
}
|
||||
|
||||
impl AsRef<Host> for Host {
|
||||
fn as_ref(&self) -> &Host {
|
||||
self
|
||||
@@ -61,8 +51,7 @@ impl Host {
|
||||
.cloned()
|
||||
.map(|address| HostAddress::Onion { address })
|
||||
.chain(
|
||||
self.domains
|
||||
.public
|
||||
self.public_domains
|
||||
.iter()
|
||||
.map(|(address, config)| HostAddress::Domain {
|
||||
address: address.clone(),
|
||||
@@ -70,8 +59,7 @@ impl Host {
|
||||
}),
|
||||
)
|
||||
.chain(
|
||||
self.domains
|
||||
.private
|
||||
self.private_domains
|
||||
.iter()
|
||||
.map(|address| HostAddress::Domain {
|
||||
address: address.clone(),
|
||||
|
||||
@@ -59,8 +59,8 @@ pub async fn get_ssl_certificate(
|
||||
.de()?
|
||||
.iter()
|
||||
.map(InternedString::from_display)
|
||||
.chain(m.as_domains().as_public().keys()?)
|
||||
.chain(m.as_domains().as_private().de()?)
|
||||
.chain(m.as_public_domains().keys()?)
|
||||
.chain(m.as_private_domains().de()?)
|
||||
.chain(
|
||||
m.as_hostname_info()
|
||||
.de()?
|
||||
@@ -185,8 +185,8 @@ pub async fn get_ssl_key(
|
||||
.de()?
|
||||
.iter()
|
||||
.map(InternedString::from_display)
|
||||
.chain(m.as_domains().as_public().keys()?)
|
||||
.chain(m.as_domains().as_private().de()?)
|
||||
.chain(m.as_public_domains().keys()?)
|
||||
.chain(m.as_private_domains().de()?)
|
||||
.chain(
|
||||
m.as_hostname_info()
|
||||
.de()?
|
||||
|
||||
@@ -87,7 +87,8 @@ impl VersionT for Version {
|
||||
}
|
||||
|
||||
}
|
||||
host["domains"] = json!({ "public": &public, "private": &private });
|
||||
host["publicDomains"] = to_value(&public)?;
|
||||
host["privateDomains"] = to_value(&private)?;
|
||||
}
|
||||
}
|
||||
let network = &mut db["public"]["serverInfo"]["network"];
|
||||
|
||||
2
patch-db
2
patch-db
Submodule patch-db updated: 223b1af4f5...d2f38ef5f7
Reference in New Issue
Block a user