mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
* fix live-build resolv.conf * improved debuggability * wip: start-tunnel * fixes for trixie and tor * non-free-firmware on trixie * wip * web server WIP * wip: tls refactor * FE patchdb, mocks, and most endpoints * fix editing records and patch mocks * refactor complete * finish api * build and formatter update * minor change toi viewing addresses and fix build * fixes * more providers * endpoint for getting config * fix tests * api fixes * wip: separate port forward controller into parts * simplify iptables rules * bump sdk * misc fixes * predict next subnet and ip, use wan ips, and form validation * refactor: break big components apart and address todos (#3043) * refactor: break big components apart and address todos * starttunnel readme, fix pf mocks, fix adding tor domain in startos --------- Co-authored-by: Matt Hill <mattnine@protonmail.com> * better tui * tui tweaks * fix: address comments * better regex for subnet * fixes * better validation * handle rpc errors * build fixes * fix: address comments (#3044) * fix: address comments * fix unread notification mocks * fix row click for notification --------- Co-authored-by: Matt Hill <mattnine@protonmail.com> * fix raspi build * fix build * fix build * fix build * fix build * try to fix build * fix tests * fix tests * fix rsync tests * delete useless effectful test --------- Co-authored-by: Matt Hill <mattnine@protonmail.com> Co-authored-by: Alex Inkin <alexander@inkin.ru>
88 lines
2.2 KiB
Rust
88 lines
2.2 KiB
Rust
use std::collections::BTreeMap;
|
|
use std::path::Path;
|
|
|
|
use imbl_value::InternedString;
|
|
use models::PackageId;
|
|
use serde::{Deserialize, Serialize};
|
|
use ts_rs::TS;
|
|
|
|
use crate::Error;
|
|
use crate::prelude::*;
|
|
use crate::util::PathOrUrl;
|
|
|
|
#[derive(Clone, Debug, Default, Deserialize, Serialize, HasModel, TS)]
|
|
#[model = "Model<Self>"]
|
|
#[ts(export)]
|
|
pub struct Dependencies(pub BTreeMap<PackageId, DepInfo>);
|
|
impl Map for Dependencies {
|
|
type Key = PackageId;
|
|
type Value = DepInfo;
|
|
fn key_str(key: &Self::Key) -> Result<impl AsRef<str>, Error> {
|
|
Ok(key)
|
|
}
|
|
fn key_string(key: &Self::Key) -> Result<imbl_value::InternedString, Error> {
|
|
Ok(key.clone().into())
|
|
}
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize, HasModel)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[model = "Model<Self>"]
|
|
pub struct DepInfo {
|
|
pub description: Option<String>,
|
|
pub optional: bool,
|
|
#[serde(flatten)]
|
|
pub metadata: Option<MetadataSrc>,
|
|
}
|
|
impl TS for DepInfo {
|
|
type WithoutGenerics = Self;
|
|
fn decl() -> String {
|
|
format!("type {} = {}", Self::name(), Self::inline())
|
|
}
|
|
fn decl_concrete() -> String {
|
|
Self::decl()
|
|
}
|
|
fn name() -> String {
|
|
"DepInfo".into()
|
|
}
|
|
fn inline() -> String {
|
|
"{ description: string | null, optional: boolean } & MetadataSrc".into()
|
|
}
|
|
fn inline_flattened() -> String {
|
|
Self::inline()
|
|
}
|
|
fn visit_dependencies(v: &mut impl ts_rs::TypeVisitor)
|
|
where
|
|
Self: 'static,
|
|
{
|
|
v.visit::<MetadataSrc>()
|
|
}
|
|
fn output_path() -> Option<&'static std::path::Path> {
|
|
Some(Path::new("DepInfo.ts"))
|
|
}
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export)]
|
|
pub enum MetadataSrc {
|
|
Metadata(Metadata),
|
|
S9pk(Option<PathOrUrl>), // backwards compatibility
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export)]
|
|
pub struct Metadata {
|
|
pub title: InternedString,
|
|
pub icon: PathOrUrl,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize, HasModel, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[model = "Model<Self>"]
|
|
pub struct DependencyMetadata {
|
|
#[ts(type = "string")]
|
|
pub title: InternedString,
|
|
}
|