mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
Merge branch 'next/minor' of github.com:Start9Labs/start-os into next/major
This commit is contained in:
1226
core/Cargo.lock
generated
1226
core/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -32,7 +32,7 @@ sqlx = { version = "0.7.2", features = [
|
||||
"postgres",
|
||||
] }
|
||||
ssh-key = "0.6.2"
|
||||
ts-rs = { git = "https://github.com/dr-bonez/ts-rs.git", branch = "feature/top-level-type-override" } # "8"
|
||||
ts-rs = { git = "https://github.com/dr-bonez/ts-rs.git", branch = "feature/top-level-as" } # "8"
|
||||
thiserror = "1.0"
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
torut = { git = "https://github.com/Start9Labs/torut.git", branch = "update/dependencies" }
|
||||
|
||||
@@ -14,7 +14,7 @@ keywords = [
|
||||
name = "start-os"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/Start9Labs/start-os"
|
||||
version = "0.3.5-rev.1"
|
||||
version = "0.3.5-rev.2"
|
||||
license = "MIT"
|
||||
|
||||
[lib]
|
||||
@@ -176,7 +176,7 @@ tracing-futures = "0.2.5"
|
||||
tracing-journald = "0.3.0"
|
||||
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
|
||||
trust-dns-server = "0.23.1"
|
||||
ts-rs = { git = "https://github.com/dr-bonez/ts-rs.git", branch = "feature/top-level-type-override" } # "8.1.0"
|
||||
ts-rs = { git = "https://github.com/dr-bonez/ts-rs.git", branch = "feature/top-level-as" } # "8.1.0"
|
||||
typed-builder = "0.18.0"
|
||||
url = { version = "2.4.1", features = ["serde"] }
|
||||
urlencoding = "2.1.3"
|
||||
|
||||
3
core/startos/bindings/EncryptedWire.ts
Normal file
3
core/startos/bindings/EncryptedWire.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type EncryptedWire = { encrypted: any };
|
||||
4
core/startos/bindings/PasswordType.ts
Normal file
4
core/startos/bindings/PasswordType.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { EncryptedWire } from "./EncryptedWire";
|
||||
|
||||
export type PasswordType = EncryptedWire | string;
|
||||
3
core/startos/bindings/Session.ts
Normal file
3
core/startos/bindings/Session.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type Session = { loggedIn: string; lastActive: string; metadata: any };
|
||||
4
core/startos/bindings/SessionList.ts
Normal file
4
core/startos/bindings/SessionList.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { Sessions } from "./Sessions";
|
||||
|
||||
export type SessionList = { current: string; sessions: Sessions };
|
||||
5
core/startos/bindings/Sessions.ts
Normal file
5
core/startos/bindings/Sessions.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type Sessions = {
|
||||
[key: string]: { loggedIn: string; lastActive: string; metadata: any };
|
||||
};
|
||||
102
core/startos/bindings/index.ts
Normal file
102
core/startos/bindings/index.ts
Normal file
@@ -0,0 +1,102 @@
|
||||
export { ActionId } from "./ActionId";
|
||||
export { ActionMetadata } from "./ActionMetadata";
|
||||
export { AddressInfo } from "./AddressInfo";
|
||||
export { AddSslOptions } from "./AddSslOptions";
|
||||
export { Alerts } from "./Alerts";
|
||||
export { Algorithm } from "./Algorithm";
|
||||
export { AllowedStatuses } from "./AllowedStatuses";
|
||||
export { AllPackageData } from "./AllPackageData";
|
||||
export { AlpnInfo } from "./AlpnInfo";
|
||||
export { BackupProgress } from "./BackupProgress";
|
||||
export { BindInfo } from "./BindInfo";
|
||||
export { BindOptions } from "./BindOptions";
|
||||
export { BindParams } from "./BindParams";
|
||||
export { Callback } from "./Callback";
|
||||
export { ChrootParams } from "./ChrootParams";
|
||||
export { CreateOverlayedImageParams } from "./CreateOverlayedImageParams";
|
||||
export { CurrentDependencies } from "./CurrentDependencies";
|
||||
export { CurrentDependencyInfo } from "./CurrentDependencyInfo";
|
||||
export { DataUrl } from "./DataUrl";
|
||||
export { Dependencies } from "./Dependencies";
|
||||
export { DependencyConfigErrors } from "./DependencyConfigErrors";
|
||||
export { DependencyKind } from "./DependencyKind";
|
||||
export { DependencyRequirement } from "./DependencyRequirement";
|
||||
export { DepInfo } from "./DepInfo";
|
||||
export { Description } from "./Description";
|
||||
export { DestroyOverlayedImageParams } from "./DestroyOverlayedImageParams";
|
||||
export { Duration } from "./Duration";
|
||||
export { EncryptedWire } from "./EncryptedWire";
|
||||
export { ExecuteAction } from "./ExecuteAction";
|
||||
export { ExportActionParams } from "./ExportActionParams";
|
||||
export { ExportedHostInfo } from "./ExportedHostInfo";
|
||||
export { ExportedHostnameInfo } from "./ExportedHostnameInfo";
|
||||
export { ExportedIpHostname } from "./ExportedIpHostname";
|
||||
export { ExportedOnionHostname } from "./ExportedOnionHostname";
|
||||
export { ExportServiceInterfaceParams } from "./ExportServiceInterfaceParams";
|
||||
export { ExposeForDependentsParams } from "./ExposeForDependentsParams";
|
||||
export { FullProgress } from "./FullProgress";
|
||||
export { GetHostInfoParamsKind } from "./GetHostInfoParamsKind";
|
||||
export { GetHostInfoParams } from "./GetHostInfoParams";
|
||||
export { GetPrimaryUrlParams } from "./GetPrimaryUrlParams";
|
||||
export { GetServiceInterfaceParams } from "./GetServiceInterfaceParams";
|
||||
export { GetServicePortForwardParams } from "./GetServicePortForwardParams";
|
||||
export { GetSslCertificateParams } from "./GetSslCertificateParams";
|
||||
export { GetSslKeyParams } from "./GetSslKeyParams";
|
||||
export { GetStoreParams } from "./GetStoreParams";
|
||||
export { GetSystemSmtpParams } from "./GetSystemSmtpParams";
|
||||
export { Governor } from "./Governor";
|
||||
export { HardwareRequirements } from "./HardwareRequirements";
|
||||
export { HealthCheckId } from "./HealthCheckId";
|
||||
export { HealthCheckResult } from "./HealthCheckResult";
|
||||
export { HostAddress } from "./HostAddress";
|
||||
export { HostId } from "./HostId";
|
||||
export { HostInfo } from "./HostInfo";
|
||||
export { HostKind } from "./HostKind";
|
||||
export { Host } from "./Host";
|
||||
export { ImageId } from "./ImageId";
|
||||
export { InstalledState } from "./InstalledState";
|
||||
export { InstallingInfo } from "./InstallingInfo";
|
||||
export { InstallingState } from "./InstallingState";
|
||||
export { IpInfo } from "./IpInfo";
|
||||
export { ListServiceInterfacesParams } from "./ListServiceInterfacesParams";
|
||||
export { MainStatus } from "./MainStatus";
|
||||
export { Manifest } from "./Manifest";
|
||||
export { MaybeUtf8String } from "./MaybeUtf8String";
|
||||
export { MountParams } from "./MountParams";
|
||||
export { MountTarget } from "./MountTarget";
|
||||
export { NamedProgress } from "./NamedProgress";
|
||||
export { PackageDataEntry } from "./PackageDataEntry";
|
||||
export { PackageId } from "./PackageId";
|
||||
export { PackageState } from "./PackageState";
|
||||
export { ParamsMaybePackageId } from "./ParamsMaybePackageId";
|
||||
export { ParamsPackageId } from "./ParamsPackageId";
|
||||
export { PasswordType } from "./PasswordType";
|
||||
export { Progress } from "./Progress";
|
||||
export { Public } from "./Public";
|
||||
export { RemoveActionParams } from "./RemoveActionParams";
|
||||
export { RemoveAddressParams } from "./RemoveAddressParams";
|
||||
export { ReverseProxyBind } from "./ReverseProxyBind";
|
||||
export { ReverseProxyDestination } from "./ReverseProxyDestination";
|
||||
export { ReverseProxyHttp } from "./ReverseProxyHttp";
|
||||
export { ReverseProxyParams } from "./ReverseProxyParams";
|
||||
export { Security } from "./Security";
|
||||
export { ServerInfo } from "./ServerInfo";
|
||||
export { ServerSpecs } from "./ServerSpecs";
|
||||
export { ServerStatus } from "./ServerStatus";
|
||||
export { ServiceInterfaceId } from "./ServiceInterfaceId";
|
||||
export { ServiceInterface } from "./ServiceInterface";
|
||||
export { ServiceInterfaceType } from "./ServiceInterfaceType";
|
||||
export { ServiceInterfaceWithHostInfo } from "./ServiceInterfaceWithHostInfo";
|
||||
export { SessionList } from "./SessionList";
|
||||
export { Sessions } from "./Sessions";
|
||||
export { Session } from "./Session";
|
||||
export { SetConfigured } from "./SetConfigured";
|
||||
export { SetDependenciesParams } from "./SetDependenciesParams";
|
||||
export { SetHealth } from "./SetHealth";
|
||||
export { SetMainStatus } from "./SetMainStatus";
|
||||
export { SetStoreParams } from "./SetStoreParams";
|
||||
export { Status } from "./Status";
|
||||
export { UpdateProgress } from "./UpdateProgress";
|
||||
export { UpdatingState } from "./UpdatingState";
|
||||
export { VolumeId } from "./VolumeId";
|
||||
export { WifiInfo } from "./WifiInfo";
|
||||
@@ -4,6 +4,7 @@ use models::PackageId;
|
||||
use rpc_toolkit::command;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::context::RpcContext;
|
||||
@@ -47,17 +48,16 @@ pub fn display_action_result(params: WithIoFormat<ActionParams>, result: ActionR
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct ActionParams {
|
||||
#[arg(id = "id")]
|
||||
#[serde(rename = "id")]
|
||||
pub package_id: PackageId,
|
||||
#[arg(id = "action-id")]
|
||||
#[serde(rename = "action-id")]
|
||||
pub action_id: ActionId,
|
||||
#[command(flatten)]
|
||||
#[ts(type = "{ [key: string]: any } | null")]
|
||||
pub input: StdinDeserializable<Option<Config>>,
|
||||
}
|
||||
// impl C
|
||||
|
||||
@@ -9,6 +9,7 @@ use rpc_toolkit::yajrc::RpcError;
|
||||
use rpc_toolkit::{command, from_fn_async, AnyContext, CallRemote, HandlerExt, ParentHandler};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::db::model::DatabaseModel;
|
||||
@@ -20,7 +21,8 @@ use crate::util::crypto::EncryptedWire;
|
||||
use crate::util::serde::{display_serializable, HandlerExtSerde, WithIoFormat};
|
||||
use crate::{ensure_code, Error, ResultExt};
|
||||
|
||||
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
|
||||
#[derive(Debug, Clone, Default, Deserialize, Serialize, TS)]
|
||||
#[ts(as = "BTreeMap::<String, Session>")]
|
||||
pub struct Sessions(pub BTreeMap<InternedString, Session>);
|
||||
impl Sessions {
|
||||
pub fn new() -> Self {
|
||||
@@ -38,8 +40,9 @@ impl Map for Sessions {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
#[derive(Clone, Serialize, Deserialize, TS)]
|
||||
#[serde(untagged)]
|
||||
#[ts(export)]
|
||||
pub enum PasswordType {
|
||||
EncryptedWire(EncryptedWire),
|
||||
String(String),
|
||||
@@ -177,7 +180,7 @@ pub fn check_password_against_db(db: &DatabaseModel, password: &str) -> Result<(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct LoginParams {
|
||||
@@ -185,6 +188,7 @@ pub struct LoginParams {
|
||||
#[serde(default)]
|
||||
user_agent: Option<String>,
|
||||
#[serde(default)]
|
||||
#[ts(type = "any")]
|
||||
metadata: Value,
|
||||
}
|
||||
|
||||
@@ -218,10 +222,11 @@ pub async fn login_impl(
|
||||
.await
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct LogoutParams {
|
||||
#[ts(type = "string")]
|
||||
session: InternedString,
|
||||
}
|
||||
|
||||
@@ -234,18 +239,25 @@ pub async fn logout(
|
||||
))
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct Session {
|
||||
#[ts(type = "string")]
|
||||
pub logged_in: DateTime<Utc>,
|
||||
#[ts(type = "string")]
|
||||
pub last_active: DateTime<Utc>,
|
||||
#[ts(skip)]
|
||||
pub user_agent: Option<String>,
|
||||
#[ts(type = "any")]
|
||||
pub metadata: Value,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Deserialize, Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct SessionList {
|
||||
#[ts(type = "string")]
|
||||
current: InternedString,
|
||||
sessions: Sessions,
|
||||
}
|
||||
@@ -303,11 +315,12 @@ fn display_sessions(params: WithIoFormat<ListParams>, arg: SessionList) {
|
||||
table.print_tty(false).unwrap();
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct ListParams {
|
||||
#[arg(skip)]
|
||||
#[ts(skip)]
|
||||
session: InternedString,
|
||||
}
|
||||
|
||||
@@ -338,7 +351,7 @@ impl AsLogoutSessionId for KillSessionId {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct KillParams {
|
||||
@@ -351,7 +364,7 @@ pub async fn kill(ctx: RpcContext, KillParams { ids }: KillParams) -> Result<(),
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct ResetPasswordParams {
|
||||
|
||||
@@ -11,6 +11,7 @@ use models::PackageId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::io::AsyncWriteExt;
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use super::target::BackupTargetId;
|
||||
use super::PackageBackupReport;
|
||||
@@ -29,7 +30,7 @@ use crate::util::io::dir_copy;
|
||||
use crate::util::serde::IoFormat;
|
||||
use crate::version::VersionT;
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct BackupParams {
|
||||
|
||||
@@ -9,6 +9,7 @@ use patch_db::json_ptr::ROOT;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use torut::onion::OnionAddressV3;
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use super::target::BackupTargetId;
|
||||
use crate::backup::os::OsBackup;
|
||||
@@ -24,7 +25,7 @@ use crate::s9pk::S9pk;
|
||||
use crate::service::service_map::DownloadInstallFuture;
|
||||
use crate::util::serde::IoFormat;
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct RestorePackageParams {
|
||||
|
||||
@@ -6,6 +6,7 @@ use color_eyre::eyre::eyre;
|
||||
use imbl_value::InternedString;
|
||||
use rpc_toolkit::{command, from_fn_async, HandlerExt, ParentHandler};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ts_rs::TS;
|
||||
|
||||
use super::{BackupTarget, BackupTargetId};
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
@@ -67,7 +68,7 @@ pub fn cifs() -> ParentHandler {
|
||||
)
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct AddParams {
|
||||
@@ -121,7 +122,7 @@ pub async fn add(
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct UpdateParams {
|
||||
@@ -185,7 +186,7 @@ pub async fn update(
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct RemoveParams {
|
||||
|
||||
@@ -13,6 +13,7 @@ use serde::{Deserialize, Serialize};
|
||||
use sha2::Sha256;
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use self::cifs::CifsBackupTarget;
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
@@ -46,7 +47,8 @@ pub enum BackupTarget {
|
||||
Cifs(CifsBackupTarget),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, TS)]
|
||||
#[ts(type = "string")]
|
||||
pub enum BackupTargetId {
|
||||
Disk { logicalname: PathBuf },
|
||||
Cifs { id: u32 },
|
||||
@@ -107,7 +109,7 @@ impl Serialize for BackupTargetId {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize, TS)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum BackupTargetFS {
|
||||
@@ -242,7 +244,7 @@ fn display_backup_info(params: WithIoFormat<InfoParams>, info: BackupInfo) {
|
||||
table.print_tty(false).unwrap();
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct InfoParams {
|
||||
@@ -276,7 +278,7 @@ lazy_static::lazy_static! {
|
||||
Mutex::new(BTreeMap::new());
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct MountParams {
|
||||
@@ -311,7 +313,7 @@ pub async fn mount(
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct UmountParams {
|
||||
|
||||
@@ -12,6 +12,7 @@ use regex::Regex;
|
||||
use rpc_toolkit::{from_fn_async, Empty, HandlerExt, ParentHandler};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::prelude::*;
|
||||
@@ -125,7 +126,7 @@ pub enum MatchError {
|
||||
ListUniquenessViolation,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct ConfigParams {
|
||||
@@ -156,12 +157,13 @@ pub async fn get(ctx: RpcContext, _: Empty, id: PackageId) -> Result<ConfigRes,
|
||||
.await
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SetParams {
|
||||
#[arg(long = "timeout")]
|
||||
pub timeout: Option<crate::util::serde::Duration>,
|
||||
#[command(flatten)]
|
||||
#[ts(type = "{ [key: string]: any } | null")]
|
||||
pub config: StdinDeserializable<Option<Config>>,
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,13 @@ use models::PackageId;
|
||||
use rpc_toolkit::command;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::RpcContext;
|
||||
use crate::prelude::*;
|
||||
use crate::Error;
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct ControlParams {
|
||||
|
||||
@@ -19,6 +19,7 @@ use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use tokio::sync::oneshot;
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::middleware::auth::{HasValidSession, HashSessionToken};
|
||||
@@ -215,12 +216,13 @@ async fn cli_dump(
|
||||
Ok(dump)
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct DumpParams {
|
||||
#[arg(long = "include-private", short = 'p')]
|
||||
#[serde(default)]
|
||||
#[ts(skip)]
|
||||
include_private: bool,
|
||||
}
|
||||
|
||||
@@ -271,7 +273,7 @@ async fn cli_apply(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct ApplyParams {
|
||||
@@ -309,11 +311,13 @@ pub fn put() -> ParentHandler {
|
||||
.with_remote_cli::<CliContext>(),
|
||||
)
|
||||
}
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct UiParams {
|
||||
#[ts(type = "string")]
|
||||
pointer: JsonPointer,
|
||||
#[ts(type = "any")]
|
||||
value: Value,
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ pub struct DepInfo {
|
||||
pub optional: bool,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct ConfigureParams {
|
||||
|
||||
@@ -5,6 +5,7 @@ use clap::Parser;
|
||||
use rpc_toolkit::yajrc::RpcError;
|
||||
use rpc_toolkit::{command, from_fn, from_fn_async, AnyContext, HandlerExt, ParentHandler};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::{CliContext, DiagnosticContext};
|
||||
use crate::init::SYSTEM_REBUILD_PATH;
|
||||
@@ -40,10 +41,11 @@ pub fn error(ctx: DiagnosticContext) -> Result<Arc<RpcError>, Error> {
|
||||
Ok(ctx.error.clone())
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct LogsParams {
|
||||
#[ts(type = "number | null")]
|
||||
limit: Option<usize>,
|
||||
cursor: Option<String>,
|
||||
before: bool,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use std::io::Cursor;
|
||||
use std::path::Path;
|
||||
|
||||
use tokio::process::Command;
|
||||
@@ -23,8 +24,8 @@ pub async fn btrfs_check_repair(logicalname: impl AsRef<Path>) -> Result<Require
|
||||
Command::new("btrfs")
|
||||
.arg("check")
|
||||
.arg("--repair")
|
||||
.arg("--force")
|
||||
.arg(logicalname.as_ref())
|
||||
.input(Some(&mut Cursor::new(b"y\n")))
|
||||
.invoke(crate::ErrorKind::DiskManagement)
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -5,12 +5,14 @@ use digest::generic_array::GenericArray;
|
||||
use digest::{Digest, OutputSizeUser};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sha2::Sha256;
|
||||
use ts_rs::TS;
|
||||
|
||||
use super::FileSystem;
|
||||
use crate::prelude::*;
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(concrete(LogicalName = std::path::PathBuf))]
|
||||
pub struct BlockDev<LogicalName: AsRef<Path>> {
|
||||
logicalname: LogicalName,
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use serde::{Deserialize, Serialize};
|
||||
use sha2::Sha256;
|
||||
use tokio::process::Command;
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use super::{FileSystem, MountType, ReadOnly};
|
||||
use crate::disk::mount::guard::{GenericMountGuard, TmpMountGuard};
|
||||
@@ -62,7 +63,7 @@ pub async fn mount_cifs(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Cifs {
|
||||
pub hostname: String,
|
||||
|
||||
@@ -23,7 +23,7 @@ pub fn inspect() -> ParentHandler {
|
||||
.subcommand("docker-images", from_fn_async(docker_images).no_display())
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct HashParams {
|
||||
@@ -38,7 +38,7 @@ pub async fn hash(_: CliContext, HashParams { path }: HashParams) -> Result<Stri
|
||||
.to_owned())
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct ManifestParams {
|
||||
@@ -56,7 +56,7 @@ pub async fn manifest(
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct InspectParams {
|
||||
@@ -88,7 +88,7 @@ pub async fn icon(
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct InstructionParams {
|
||||
|
||||
@@ -15,6 +15,7 @@ use serde::{Deserialize, Serialize};
|
||||
use serde_json::{json, Value};
|
||||
use tokio::sync::oneshot;
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::core::rpc_continuations::{RequestGuid, RpcContinuation};
|
||||
@@ -63,7 +64,7 @@ pub async fn list(ctx: RpcContext) -> Result<Value, Error> {
|
||||
.collect())
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, Copy, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum MinMax {
|
||||
Min,
|
||||
@@ -102,12 +103,13 @@ impl std::fmt::Display for MinMax {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct InstallParams {
|
||||
id: PackageId,
|
||||
#[arg(short = 'm', long = "marketplace-url")]
|
||||
#[ts(type = "string | null")]
|
||||
marketplace_url: Option<Url>,
|
||||
#[arg(short = 'v', long = "version-spec")]
|
||||
version_spec: Option<String>,
|
||||
@@ -391,7 +393,7 @@ pub async fn cli_install(ctx: CliContext, params: CliInstallParams) -> Result<()
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct UninstallParams {
|
||||
|
||||
@@ -75,11 +75,12 @@ use rpc_toolkit::{
|
||||
command, from_fn, from_fn_async, from_fn_blocking, AnyContext, HandlerExt, ParentHandler,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::CliContext;
|
||||
use crate::util::serde::HandlerExtSerde;
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct EchoParams {
|
||||
|
||||
@@ -20,6 +20,7 @@ use tokio::io::{AsyncBufReadExt, BufReader};
|
||||
use tokio::process::Command;
|
||||
use tokio::sync::Mutex;
|
||||
use tokio::time::Instant;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::core::rpc_continuations::{RequestGuid, RpcContinuation};
|
||||
@@ -351,8 +352,9 @@ pub async fn list(ctx: RpcContext) -> Result<Vec<InternedString>, Error> {
|
||||
Ok(ctx.dev.lxc.lock().await.keys().cloned().collect())
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
pub struct RemoveParams {
|
||||
#[ts(type = "string")]
|
||||
pub guid: InternedString,
|
||||
}
|
||||
|
||||
@@ -363,8 +365,9 @@ pub async fn remove(ctx: RpcContext, RemoveParams { guid }: RemoveParams) -> Res
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
pub struct ConnectParams {
|
||||
#[ts(type = "string")]
|
||||
pub guid: InternedString,
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ use futures::TryStreamExt;
|
||||
use rpc_toolkit::{from_fn_async, HandlerExt, ParentHandler};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::sync::RwLock;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::db::model::public::IpInfo;
|
||||
@@ -60,7 +61,7 @@ pub fn dhcp() -> ParentHandler {
|
||||
.with_remote_cli::<CliContext>(),
|
||||
)
|
||||
}
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct UpdateParams {
|
||||
|
||||
@@ -22,6 +22,7 @@ use tokio::time::Instant;
|
||||
use torut::control::{AsyncEvent, AuthenticatedConn, ConnError};
|
||||
use torut::onion::{OnionAddressV3, TorSecretKeyV3};
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::logs::{
|
||||
@@ -104,7 +105,7 @@ pub fn tor() -> ParentHandler {
|
||||
.with_remote_cli::<CliContext>(),
|
||||
)
|
||||
}
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct ResetParams {
|
||||
@@ -142,11 +143,12 @@ pub async fn list_services(ctx: RpcContext, _: Empty) -> Result<Vec<OnionAddress
|
||||
ctx.net_controller.tor.list_services().await
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct LogsParams {
|
||||
#[arg(short = 'l', long = "limit")]
|
||||
#[ts(type = "number | null")]
|
||||
limit: Option<usize>,
|
||||
#[arg(short = 'c', long = "cursor")]
|
||||
cursor: Option<String>,
|
||||
|
||||
@@ -13,6 +13,7 @@ use serde::{Deserialize, Serialize};
|
||||
use tokio::process::Command;
|
||||
use tokio::sync::RwLock;
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::prelude::*;
|
||||
@@ -87,7 +88,7 @@ pub fn country() -> ParentHandler {
|
||||
)
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct AddParams {
|
||||
@@ -138,7 +139,7 @@ pub async fn add(ctx: RpcContext, AddParams { ssid, password }: AddParams) -> Re
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct SsidParams {
|
||||
@@ -402,11 +403,12 @@ pub async fn get_available(ctx: RpcContext, _: Empty) -> Result<Vec<WifiListOut>
|
||||
Ok(wifi_list)
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct SetCountryParams {
|
||||
#[arg(value_parser = CountryCodeParser)]
|
||||
#[ts(type = "string")]
|
||||
country: CountryCode,
|
||||
}
|
||||
pub async fn set_country(
|
||||
|
||||
@@ -11,6 +11,7 @@ use models::PackageId;
|
||||
use rpc_toolkit::{command, from_fn_async, HandlerExt, ParentHandler};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::backup::BackupReport;
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
@@ -48,11 +49,13 @@ pub fn notification() -> ParentHandler {
|
||||
)
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct ListParams {
|
||||
#[ts(type = "number | null")]
|
||||
before: Option<u32>,
|
||||
#[ts(type = "number | null")]
|
||||
limit: Option<usize>,
|
||||
}
|
||||
// #[command(display(display_serializable))]
|
||||
@@ -110,10 +113,11 @@ pub async fn list(
|
||||
.await
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct DeleteParams {
|
||||
#[ts(type = "number")]
|
||||
id: u32,
|
||||
}
|
||||
|
||||
@@ -125,10 +129,11 @@ pub async fn delete(ctx: RpcContext, DeleteParams { id }: DeleteParams) -> Resul
|
||||
})
|
||||
.await
|
||||
}
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct DeleteBeforeParams {
|
||||
#[ts(type = "number")]
|
||||
before: u32,
|
||||
}
|
||||
|
||||
@@ -148,7 +153,7 @@ pub async fn delete_before(
|
||||
.await
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct CreateParams {
|
||||
@@ -172,7 +177,7 @@ pub async fn create(
|
||||
.await
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum NotificationLevel {
|
||||
Success,
|
||||
|
||||
@@ -6,6 +6,7 @@ use models::Error;
|
||||
use rpc_toolkit::{command, from_fn_async, AnyContext, HandlerExt, ParentHandler};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::process::Command;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::config::ServerConfig;
|
||||
use crate::context::{CliContext, InstallContext};
|
||||
@@ -112,7 +113,7 @@ async fn partition(disk: &mut DiskInfo, overwrite: bool) -> Result<OsPartitionIn
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct ExecuteParams {
|
||||
|
||||
@@ -9,6 +9,7 @@ use indicatif::{ProgressBar, ProgressStyle};
|
||||
use reqwest::{header, Body, Client, Url};
|
||||
use rpc_toolkit::command;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::CliContext;
|
||||
use crate::s9pk::S9pk;
|
||||
|
||||
@@ -5,6 +5,7 @@ use reqwest::{StatusCode, Url};
|
||||
use rpc_toolkit::{command, from_fn_async, HandlerExt, ParentHandler};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::version::VersionT;
|
||||
@@ -36,10 +37,11 @@ pub fn with_query_params(ctx: RpcContext, mut url: Url) -> Url {
|
||||
url
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct GetParams {
|
||||
#[ts(type = "string")]
|
||||
url: Url,
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ use rpc_toolkit::{from_fn_async, Empty, HandlerExt, ParentHandler};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::fs::File;
|
||||
use tokio::process::Command;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::CliContext;
|
||||
use crate::prelude::*;
|
||||
@@ -67,7 +68,7 @@ fn inspect() -> ParentHandler<S9pkPath> {
|
||||
)
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
struct AddImageParams {
|
||||
id: ImageId,
|
||||
image: String,
|
||||
@@ -183,7 +184,7 @@ async fn add_image(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
struct EditManifestParams {
|
||||
expression: String,
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ use std::path::PathBuf;
|
||||
|
||||
use clap::Parser;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ts_rs::TS;
|
||||
|
||||
pub mod builder;
|
||||
pub mod docker;
|
||||
@@ -12,7 +13,7 @@ pub mod reader;
|
||||
|
||||
pub const SIG_CONTEXT: &[u8] = b"s9pk";
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct VerifyParams {
|
||||
|
||||
@@ -11,7 +11,9 @@ use rpc_toolkit::{from_fn_async, CallRemoteHandler, Empty, Handler, HandlerArgs}
|
||||
use serde::{Deserialize, Serialize};
|
||||
use start_stop::StartStop;
|
||||
use tokio::sync::Notify;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::action::ActionResult;
|
||||
use crate::config::action::ConfigRes;
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::core::rpc_continuations::RequestGuid;
|
||||
@@ -28,8 +30,8 @@ use crate::service::transition::TransitionKind;
|
||||
use crate::status::health_check::HealthCheckResult;
|
||||
use crate::status::MainStatus;
|
||||
use crate::util::actor::{Actor, BackgroundJobs, SimpleActor};
|
||||
use crate::util::serde::Pem;
|
||||
use crate::volume::data_dir;
|
||||
use crate::{action::ActionResult, util::serde::Pem};
|
||||
|
||||
pub mod cli;
|
||||
mod config;
|
||||
@@ -498,7 +500,7 @@ impl Actor for ServiceActor {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
pub struct ConnectParams {
|
||||
pub id: PackageId,
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ use imbl_value::Value;
|
||||
use models::ProcedureName;
|
||||
use rpc_toolkit::yajrc::RpcMethod;
|
||||
use rpc_toolkit::Empty;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
@@ -43,9 +44,10 @@ impl serde::Serialize for Exit {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Clone, serde::Deserialize, serde::Serialize, TS)]
|
||||
pub struct ExecuteParams {
|
||||
procedure: String,
|
||||
#[ts(type = "any")]
|
||||
input: Value,
|
||||
timeout: Option<u128>,
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ use tokio::io::AsyncWriteExt;
|
||||
use tokio::try_join;
|
||||
use torut::onion::OnionAddressV3;
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::account::AccountInfo;
|
||||
use crate::backup::restore::recover_full_embassy;
|
||||
@@ -99,10 +100,10 @@ async fn setup_init(
|
||||
))
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Deserialize, Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AttachParams {
|
||||
#[serde(rename = "embassy-password")]
|
||||
#[serde(rename = "startOsPassword")]
|
||||
password: Option<EncryptedWire>,
|
||||
guid: Arc<String>,
|
||||
}
|
||||
@@ -210,7 +211,7 @@ pub fn cifs() -> ParentHandler {
|
||||
ParentHandler::new().subcommand("verify", from_fn_async(verify_cifs).no_cli())
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Deserialize, Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct VerifyCifsParams {
|
||||
hostname: String,
|
||||
@@ -245,7 +246,7 @@ pub async fn verify_cifs(
|
||||
start_os.ok_or_else(|| Error::new(eyre!("No Backup Found"), crate::ErrorKind::NotFound))
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize, TS)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum RecoverySource {
|
||||
@@ -253,7 +254,7 @@ pub enum RecoverySource {
|
||||
Backup { target: BackupTargetFS },
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Deserialize, Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ExecuteParams {
|
||||
start_os_logicalname: PathBuf,
|
||||
|
||||
@@ -8,6 +8,7 @@ use imbl_value::InternedString;
|
||||
use rpc_toolkit::{command, from_fn_async, AnyContext, Empty, HandlerExt, ParentHandler};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::prelude::*;
|
||||
@@ -34,7 +35,8 @@ impl Map for SshKeys {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, TS)]
|
||||
#[ts(type = "string")]
|
||||
pub struct SshPubKey(
|
||||
#[serde(serialize_with = "crate::util::serde::serialize_display")]
|
||||
#[serde(deserialize_with = "crate::util::serde::deserialize_from_str")]
|
||||
@@ -102,7 +104,7 @@ pub fn ssh() -> ParentHandler {
|
||||
)
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct AddParams {
|
||||
@@ -135,10 +137,11 @@ pub async fn add(ctx: RpcContext, AddParams { key }: AddParams) -> Result<SshKey
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct DeleteParams {
|
||||
#[ts(type = "string")]
|
||||
fingerprint: InternedString,
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ use tokio::process::Command;
|
||||
use tokio::sync::broadcast::Receiver;
|
||||
use tokio::sync::RwLock;
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::disk::util::{get_available, get_used};
|
||||
@@ -73,7 +74,7 @@ pub async fn enable_zram() -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct ZramParams {
|
||||
@@ -135,7 +136,7 @@ fn display_governor_info(params: WithIoFormat<GovernorParams>, result: GovernorI
|
||||
table.print_tty(false).unwrap();
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct GovernorParams {
|
||||
@@ -229,11 +230,12 @@ pub async fn time(ctx: RpcContext, _: Empty) -> Result<TimeInfo, Error> {
|
||||
uptime: ctx.start_time.elapsed().as_secs(),
|
||||
})
|
||||
}
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct LogsParams {
|
||||
#[arg(short = 'l', long = "limit")]
|
||||
#[ts(type = "number | null")]
|
||||
limit: Option<usize>,
|
||||
#[arg(short = 'c', long = "cursor")]
|
||||
cursor: Option<String>,
|
||||
@@ -313,11 +315,12 @@ pub async fn logs_follow(
|
||||
) -> Result<LogFollowResponse, Error> {
|
||||
follow_logs(ctx, LogSource::System, limit).await
|
||||
}
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct KernelLogsParams {
|
||||
#[arg(short = 'l', long = "limit")]
|
||||
#[ts(type = "number | null")]
|
||||
limit: Option<usize>,
|
||||
#[arg(short = 'c', long = "cursor")]
|
||||
cursor: Option<String>,
|
||||
|
||||
@@ -12,6 +12,7 @@ use serde::{Deserialize, Serialize};
|
||||
use tokio::process::Command;
|
||||
use tokio_stream::StreamExt;
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::RpcContext;
|
||||
use crate::db::model::public::UpdateProgress;
|
||||
@@ -34,10 +35,11 @@ lazy_static! {
|
||||
static ref UPDATED: AtomicBool = AtomicBool::new(false);
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Parser)]
|
||||
#[derive(Deserialize, Serialize, Parser, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
pub struct UpdateSystemParams {
|
||||
#[ts(type = "string")]
|
||||
marketplace_url: Url,
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,9 @@ use josekit::jwk::Jwk;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sha2::Sha256;
|
||||
use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
pub fn pbkdf2(password: impl AsRef<[u8]>, salt: impl AsRef<[u8]>) -> CipherKey<Aes256Ctr> {
|
||||
let mut aeskey = CipherKey::<Aes256Ctr>::default();
|
||||
@@ -53,9 +56,11 @@ pub fn decrypt_slice(input: impl AsRef<[u8]>, password: impl AsRef<[u8]>) -> Vec
|
||||
res
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, TS)]
|
||||
#[ts(export)]
|
||||
pub struct EncryptedWire {
|
||||
encrypted: serde_json::Value,
|
||||
#[ts(type = "any")]
|
||||
encrypted: Value,
|
||||
}
|
||||
impl EncryptedWire {
|
||||
#[instrument(skip_all)]
|
||||
|
||||
@@ -580,7 +580,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Deserialize, Serialize, TS)]
|
||||
pub struct StdinDeserializable<T>(pub T);
|
||||
impl<T> FromArgMatches for StdinDeserializable<T>
|
||||
where
|
||||
|
||||
@@ -10,6 +10,7 @@ use crate::Error;
|
||||
|
||||
mod v0_3_5;
|
||||
mod v0_3_5_1;
|
||||
mod v0_3_5_2;
|
||||
mod v0_3_6;
|
||||
|
||||
pub type Current = v0_3_6::Version;
|
||||
@@ -20,6 +21,7 @@ enum Version {
|
||||
LT0_3_5(LTWrapper<v0_3_5::Version>),
|
||||
V0_3_5(Wrapper<v0_3_5::Version>),
|
||||
V0_3_5_1(Wrapper<v0_3_5_1::Version>),
|
||||
V0_3_5_2(Wrapper<v0_3_5_2::Version>),
|
||||
V0_3_6(Wrapper<v0_3_6::Version>),
|
||||
Other(emver::Version),
|
||||
}
|
||||
@@ -39,6 +41,7 @@ impl Version {
|
||||
Version::LT0_3_5(LTWrapper(_, x)) => x.clone(),
|
||||
Version::V0_3_5(Wrapper(x)) => x.semver(),
|
||||
Version::V0_3_5_1(Wrapper(x)) => x.semver(),
|
||||
Version::V0_3_5_2(Wrapper(x)) => x.semver(),
|
||||
Version::V0_3_6(Wrapper(x)) => x.semver(),
|
||||
Version::Other(x) => x.clone(),
|
||||
}
|
||||
@@ -208,6 +211,7 @@ pub async fn init(db: &PatchDb) -> Result<(), Error> {
|
||||
}
|
||||
Version::V0_3_5(v) => v.0.migrate_to(&Current::new(), &db).await?,
|
||||
Version::V0_3_5_1(v) => v.0.migrate_to(&Current::new(), &db).await?,
|
||||
Version::V0_3_5_2(v) => v.0.migrate_to(&Current::new(), &db).await?,
|
||||
Version::V0_3_6(v) => v.0.migrate_to(&Current::new(), &db).await?,
|
||||
Version::Other(_) => {
|
||||
return Err(Error::new(
|
||||
@@ -242,6 +246,7 @@ mod tests {
|
||||
prop_oneof![
|
||||
Just(Version::V0_3_5(Wrapper(v0_3_5::Version::new()))),
|
||||
Just(Version::V0_3_5_1(Wrapper(v0_3_5_1::Version::new()))),
|
||||
Just(Version::V0_3_5_2(Wrapper(v0_3_5_2::Version::new()))),
|
||||
em_version().prop_map(Version::Other),
|
||||
]
|
||||
}
|
||||
|
||||
29
core/startos/src/version/v0_3_5_2.rs
Normal file
29
core/startos/src/version/v0_3_5_2.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
use emver::VersionRange;
|
||||
|
||||
use super::v0_3_5::V0_3_0_COMPAT;
|
||||
use super::{v0_3_5_1, VersionT};
|
||||
use crate::prelude::*;
|
||||
|
||||
const V0_3_5_2: emver::Version = emver::Version::new(0, 3, 5, 2);
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Version;
|
||||
|
||||
impl VersionT for Version {
|
||||
type Previous = v0_3_5_1::Version;
|
||||
fn new() -> Self {
|
||||
Version
|
||||
}
|
||||
fn semver(&self) -> emver::Version {
|
||||
V0_3_5_2
|
||||
}
|
||||
fn compat(&self) -> &'static VersionRange {
|
||||
&V0_3_0_COMPAT
|
||||
}
|
||||
async fn up(&self, _db: &PatchDb) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
async fn down(&self, _db: &PatchDb) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user