mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-02 05:23:14 +00:00
update cargo deps (#2959)
* update cargo deps * readd device info header
This commit is contained in:
@@ -223,18 +223,7 @@ fn assure_backing_up<'a>(
|
||||
.as_server_info_mut()
|
||||
.as_status_info_mut()
|
||||
.as_backup_progress_mut();
|
||||
if backing_up
|
||||
.clone()
|
||||
.de()?
|
||||
.iter()
|
||||
.flat_map(|x| x.values())
|
||||
.fold(false, |acc, x| {
|
||||
if !x.complete {
|
||||
return true;
|
||||
}
|
||||
acc
|
||||
})
|
||||
{
|
||||
if backing_up.transpose_ref().is_some() {
|
||||
return Err(Error::new(
|
||||
eyre!("Server is already backing up!"),
|
||||
ErrorKind::InvalidRequest,
|
||||
@@ -287,6 +276,22 @@ async fn perform_backup(
|
||||
timestamp: Utc::now(),
|
||||
},
|
||||
);
|
||||
|
||||
ctx.db
|
||||
.mutate(|db| {
|
||||
if let Some(progress) = db
|
||||
.as_public_mut()
|
||||
.as_server_info_mut()
|
||||
.as_status_info_mut()
|
||||
.as_backup_progress_mut()
|
||||
.transpose_mut()
|
||||
{
|
||||
progress.insert(&id, &BackupProgress { complete: true })?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.await
|
||||
.result?;
|
||||
}
|
||||
backup_report.insert(
|
||||
id.clone(),
|
||||
|
||||
@@ -172,7 +172,8 @@ impl SetupContext {
|
||||
if let Some(progress) = progress {
|
||||
ws.send(ws::Message::Text(
|
||||
serde_json::to_string(&progress)
|
||||
.with_kind(ErrorKind::Serialization)?,
|
||||
.with_kind(ErrorKind::Serialization)?
|
||||
.into(),
|
||||
))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
|
||||
@@ -203,7 +203,9 @@ pub async fn subscribe(
|
||||
rev = sub.recv() => {
|
||||
if let Some(rev) = rev {
|
||||
ws.send(ws::Message::Text(
|
||||
serde_json::to_string(&rev).with_kind(ErrorKind::Serialization)?,
|
||||
serde_json::to_string(&rev)
|
||||
.with_kind(ErrorKind::Serialization)?
|
||||
.into(),
|
||||
))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
|
||||
@@ -6,10 +6,9 @@ use color_eyre::eyre::{self, eyre};
|
||||
use futures::TryStreamExt;
|
||||
use nom::bytes::complete::{tag, take_till1};
|
||||
use nom::character::complete::multispace1;
|
||||
use nom::character::is_space;
|
||||
use nom::combinator::{opt, rest};
|
||||
use nom::sequence::{pair, preceded, terminated};
|
||||
use nom::IResult;
|
||||
use nom::{AsChar, IResult, Parser};
|
||||
use regex::Regex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::process::Command;
|
||||
@@ -450,17 +449,17 @@ fn parse_pvscan_output(pvscan_output: &str) -> BTreeMap<PathBuf, Option<String>>
|
||||
fn parse_line(line: &str) -> IResult<&str, (&str, Option<&str>)> {
|
||||
let pv_parse = preceded(
|
||||
tag(" PV "),
|
||||
terminated(take_till1(|c| is_space(c as u8)), multispace1),
|
||||
terminated(take_till1(|c: char| c.is_space()), multispace1),
|
||||
);
|
||||
let vg_parse = preceded(
|
||||
opt(tag("is in exported ")),
|
||||
preceded(
|
||||
tag("VG "),
|
||||
terminated(take_till1(|c| is_space(c as u8)), multispace1),
|
||||
terminated(take_till1(|c: char| c.is_space()), multispace1),
|
||||
),
|
||||
);
|
||||
let mut parser = terminated(pair(pv_parse, opt(vg_parse)), rest);
|
||||
parser(line)
|
||||
parser.parse(line)
|
||||
}
|
||||
let lines = pvscan_output.lines();
|
||||
let n = lines.clone().count();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use imbl_value::InternedString;
|
||||
use lazy_format::lazy_format;
|
||||
use rand::{thread_rng, Rng};
|
||||
use rand::{rng, Rng};
|
||||
use tokio::process::Command;
|
||||
use tracing::instrument;
|
||||
|
||||
@@ -34,7 +34,7 @@ impl Hostname {
|
||||
}
|
||||
|
||||
pub fn generate_hostname() -> Hostname {
|
||||
let mut rng = thread_rng();
|
||||
let mut rng = rng();
|
||||
let adjective = &ADJECTIVES[rng.gen_range(0..ADJECTIVES.len())];
|
||||
let noun = &NOUNS[rng.gen_range(0..NOUNS.len())];
|
||||
Hostname(InternedString::from_display(&lazy_format!(
|
||||
|
||||
@@ -620,7 +620,8 @@ pub async fn init_progress(ctx: InitContext) -> Result<InitProgressRes, Error> {
|
||||
while let Some(progress) = stream.next().await {
|
||||
ws.send(ws::Message::Text(
|
||||
serde_json::to_string(&progress)
|
||||
.with_kind(ErrorKind::Serialization)?,
|
||||
.with_kind(ErrorKind::Serialization)?
|
||||
.into(),
|
||||
))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
|
||||
@@ -23,7 +23,7 @@ use tracing::instrument;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::db::model::package::{ManifestPreference, PackageState, PackageStateMatchModelRef};
|
||||
use crate::db::model::package::{ManifestPreference, PackageStateMatchModelRef};
|
||||
use crate::prelude::*;
|
||||
use crate::progress::{FullProgress, FullProgressTracker, PhasedProgressBar};
|
||||
use crate::registry::context::{RegistryContext, RegistryUrlParams};
|
||||
@@ -215,7 +215,8 @@ pub async fn sideload(
|
||||
if let Some(progress) = progress {
|
||||
ws.send(ws::Message::Text(
|
||||
serde_json::to_string(&progress)
|
||||
.with_kind(ErrorKind::Serialization)?,
|
||||
.with_kind(ErrorKind::Serialization)?
|
||||
.into(),
|
||||
))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
|
||||
@@ -87,7 +87,6 @@ use crate::context::{
|
||||
CliContext, DiagnosticContext, InitContext, InstallContext, RpcContext, SetupContext,
|
||||
};
|
||||
use crate::disk::fsck::RequiresReboot;
|
||||
use crate::net::net;
|
||||
use crate::registry::context::{RegistryContext, RegistryUrlParams};
|
||||
use crate::system::kiosk;
|
||||
use crate::util::serde::{HandlerExtSerde, WithIoFormat};
|
||||
|
||||
@@ -75,7 +75,9 @@ async fn ws_handler(
|
||||
if let Some(first_entry) = first_entry {
|
||||
stream
|
||||
.send(ws::Message::Text(
|
||||
serde_json::to_string(&first_entry).with_kind(ErrorKind::Serialization)?,
|
||||
serde_json::to_string(&first_entry)
|
||||
.with_kind(ErrorKind::Serialization)?
|
||||
.into(),
|
||||
))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
@@ -88,7 +90,9 @@ async fn ws_handler(
|
||||
let (_, log_entry) = entry.log_entry()?;
|
||||
stream
|
||||
.send(ws::Message::Text(
|
||||
serde_json::to_string(&log_entry).with_kind(ErrorKind::Serialization)?,
|
||||
serde_json::to_string(&log_entry)
|
||||
.with_kind(ErrorKind::Serialization)?
|
||||
.into(),
|
||||
))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
|
||||
@@ -429,7 +429,8 @@ pub async fn connect(ctx: &RpcContext, container: &LxcContainer) -> Result<Guid,
|
||||
.await;
|
||||
ws.send(Message::Text(
|
||||
serde_json::to_string(&RpcResponse { id, result })
|
||||
.with_kind(ErrorKind::Serialization)?,
|
||||
.with_kind(ErrorKind::Serialization)?
|
||||
.into(),
|
||||
))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
@@ -503,7 +504,7 @@ pub async fn connect_cli(ctx: &CliContext, guid: Guid) -> Result<(), Error> {
|
||||
if let ReadlineEvent::Line(line) = line {
|
||||
input.add_history_entry(line.clone());
|
||||
if serde_json::from_str::<RpcRequest>(&line).is_ok() {
|
||||
ws.send(Message::Text(line))
|
||||
ws.send(Message::Text(line.into()))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
} else {
|
||||
@@ -531,7 +532,7 @@ pub async fn connect_cli(ctx: &CliContext, guid: Guid) -> Result<(), Error> {
|
||||
method: GenericRpcMethod::new(method.into()),
|
||||
params: Value::Object(params),
|
||||
}) {
|
||||
Ok(a) => a,
|
||||
Ok(a) => a.into(),
|
||||
Err(e) => {
|
||||
tracing::error!("Error Serializing Request: {e}");
|
||||
tracing::debug!("{e:?}");
|
||||
|
||||
@@ -5,7 +5,6 @@ use std::sync::{Arc, Weak};
|
||||
use std::time::Duration;
|
||||
|
||||
use color_eyre::eyre::eyre;
|
||||
use futures::TryFutureExt;
|
||||
use helpers::NonDetachingJoinHandle;
|
||||
use models::PackageId;
|
||||
use tokio::net::{TcpListener, UdpSocket};
|
||||
|
||||
@@ -83,9 +83,9 @@ pub fn rpc_router<C: Context + Clone + AsRef<RpcContinuations>>(
|
||||
server: HttpServer<C>,
|
||||
) -> Router {
|
||||
Router::new()
|
||||
.route("/rpc/*path", any(server))
|
||||
.route("/rpc/{*path}", any(server))
|
||||
.route(
|
||||
"/ws/rpc/:guid",
|
||||
"/ws/rpc/{guid}",
|
||||
get({
|
||||
let ctx = ctx.clone();
|
||||
move |x::Path(guid): x::Path<Guid>,
|
||||
@@ -98,7 +98,7 @@ pub fn rpc_router<C: Context + Clone + AsRef<RpcContinuations>>(
|
||||
}),
|
||||
)
|
||||
.route(
|
||||
"/rest/rpc/:guid",
|
||||
"/rest/rpc/{guid}",
|
||||
any({
|
||||
let ctx = ctx.clone();
|
||||
move |x::Path(guid): x::Path<Guid>, request: x::Request| async move {
|
||||
@@ -185,7 +185,7 @@ pub fn main_ui_router(ctx: RpcContext) -> Router {
|
||||
.middleware(Auth::new())
|
||||
.middleware(SyncDb::new())
|
||||
})
|
||||
.route("/proxy/:url", {
|
||||
.route("/proxy/{url}", {
|
||||
let ctx = ctx.clone();
|
||||
any(move |x::Path(url): x::Path<String>, request: Request| {
|
||||
let ctx = ctx.clone();
|
||||
@@ -258,7 +258,7 @@ async fn proxy_request(ctx: RpcContext, request: Request, url: String) -> Result
|
||||
|
||||
fn s9pk_router(ctx: RpcContext) -> Router {
|
||||
Router::new()
|
||||
.route("/installed/:s9pk", {
|
||||
.route("/installed/{s9pk}", {
|
||||
let ctx = ctx.clone();
|
||||
any(
|
||||
|x::Path(s9pk): x::Path<String>, request: Request| async move {
|
||||
@@ -282,7 +282,7 @@ fn s9pk_router(ctx: RpcContext) -> Router {
|
||||
},
|
||||
)
|
||||
})
|
||||
.route("/installed/:s9pk/*path", {
|
||||
.route("/installed/{s9pk}/{*path}", {
|
||||
let ctx = ctx.clone();
|
||||
any(
|
||||
|x::Path((s9pk, path)): x::Path<(String, PathBuf)>,
|
||||
@@ -319,7 +319,7 @@ fn s9pk_router(ctx: RpcContext) -> Router {
|
||||
)
|
||||
})
|
||||
.route(
|
||||
"/proxy/:url/*path",
|
||||
"/proxy/{url}/{*path}",
|
||||
any(
|
||||
|x::Path((url, path)): x::Path<(Url, PathBuf)>,
|
||||
x::RawQuery(query): x::RawQuery,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use std::collections::BTreeMap;
|
||||
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV6};
|
||||
use std::path::Path;
|
||||
|
||||
@@ -6,18 +5,13 @@ use async_stream::try_stream;
|
||||
use color_eyre::eyre::eyre;
|
||||
use futures::stream::BoxStream;
|
||||
use futures::{StreamExt, TryStreamExt};
|
||||
use helpers::NonDetachingJoinHandle;
|
||||
use imbl_value::InternedString;
|
||||
use ipnet::{IpNet, Ipv4Net, Ipv6Net};
|
||||
use nix::net::if_::if_nametoindex;
|
||||
use tokio::net::{TcpListener, TcpStream};
|
||||
use tokio::process::Command;
|
||||
|
||||
use crate::db::model::public::NetworkInterfaceInfo;
|
||||
use crate::net::network_interface::NetworkInterfaceListener;
|
||||
use crate::net::web_server::Accept;
|
||||
use crate::prelude::*;
|
||||
use crate::util::sync::Watch;
|
||||
use crate::util::Invoke;
|
||||
|
||||
pub fn ipv6_is_link_local(addr: Ipv6Addr) -> bool {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::net::{IpAddr, SocketAddr};
|
||||
use std::sync::{Arc, Weak};
|
||||
use std::time::Duration;
|
||||
|
||||
use async_acme::acme::{Identifier, ACME_TLS_ALPN_NAME};
|
||||
use axum::body::Body;
|
||||
|
||||
@@ -18,7 +18,6 @@ use ts_rs::TS;
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::db::model::public::WifiInfo;
|
||||
use crate::db::model::Database;
|
||||
use crate::net::utils::find_wifi_iface;
|
||||
use crate::prelude::*;
|
||||
use crate::util::serde::{display_serializable, HandlerExtSerde, WithIoFormat};
|
||||
use crate::util::Invoke;
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
use std::path::Path;
|
||||
|
||||
use color_eyre::eyre::eyre;
|
||||
use gpt::disk::LogicalBlockSize;
|
||||
use gpt::GptConfig;
|
||||
|
||||
use crate::disk::util::DiskInfo;
|
||||
use crate::disk::OsPartitionInfo;
|
||||
use crate::os_install::partition_for;
|
||||
use crate::Error;
|
||||
use crate::prelude::*;
|
||||
|
||||
pub async fn partition(disk: &DiskInfo, overwrite: bool) -> Result<OsPartitionInfo, Error> {
|
||||
let efi = {
|
||||
@@ -28,7 +27,6 @@ pub async fn partition(disk: &DiskInfo, overwrite: bool) -> Result<OsPartitionIn
|
||||
(
|
||||
GptConfig::new()
|
||||
.writable(true)
|
||||
.initialized(false)
|
||||
.logical_block_size(LogicalBlockSize::Lb512)
|
||||
.create_from_device(device, None)?,
|
||||
None,
|
||||
@@ -36,7 +34,6 @@ pub async fn partition(disk: &DiskInfo, overwrite: bool) -> Result<OsPartitionIn
|
||||
} else {
|
||||
let gpt = GptConfig::new()
|
||||
.writable(true)
|
||||
.initialized(true)
|
||||
.logical_block_size(LogicalBlockSize::Lb512)
|
||||
.open_from_device(device)?;
|
||||
let mut guid_part = None;
|
||||
@@ -115,7 +112,12 @@ pub async fn partition(disk: &DiskInfo, overwrite: bool) -> Result<OsPartitionIn
|
||||
)?;
|
||||
} else if let Some(guid_part) = guid_part {
|
||||
let mut parts = gpt.partitions().clone();
|
||||
parts.insert(gpt.find_next_partition_id(), guid_part);
|
||||
parts.insert(
|
||||
gpt.find_next_partition_id().ok_or_else(|| {
|
||||
Error::new(eyre!("Partition table is full"), ErrorKind::DiskManagement)
|
||||
})?,
|
||||
guid_part,
|
||||
);
|
||||
gpt.update_partitions(parts)?;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ use crate::context::config::{ContextConfig, CONFIG_PATH};
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::prelude::*;
|
||||
use crate::registry::auth::{SignatureHeader, AUTH_SIG_HEADER};
|
||||
use crate::registry::device_info::{DeviceInfo, DEVICE_INFO_HEADER};
|
||||
use crate::registry::signer::sign::AnySigningKey;
|
||||
use crate::registry::RegistryDatabase;
|
||||
use crate::rpc_continuations::RpcContinuations;
|
||||
@@ -254,7 +255,10 @@ impl CallRemote<RegistryContext, RegistryUrlParams> for RpcContext {
|
||||
.header(CONTENT_TYPE, "application/json")
|
||||
.header(ACCEPT, "application/json")
|
||||
.header(CONTENT_LENGTH, body.len())
|
||||
// .header(DEVICE_INFO_HEADER, DeviceInfo::from(self).to_header_value())
|
||||
.header(
|
||||
DEVICE_INFO_HEADER,
|
||||
DeviceInfo::load(self).await?.to_header_value(),
|
||||
)
|
||||
.body(body)
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
@@ -90,7 +90,7 @@ pub fn registry_router(ctx: RegistryContext) -> Router {
|
||||
use axum::extract as x;
|
||||
use axum::routing::{any, get};
|
||||
Router::new()
|
||||
.route("/rpc/*path", {
|
||||
.route("/rpc/{*path}", {
|
||||
let ctx = ctx.clone();
|
||||
any(
|
||||
Server::new(move || ready(Ok(ctx.clone())), registry_api())
|
||||
@@ -100,7 +100,7 @@ pub fn registry_router(ctx: RegistryContext) -> Router {
|
||||
)
|
||||
})
|
||||
.route(
|
||||
"/ws/rpc/*path",
|
||||
"/ws/rpc/{*path}",
|
||||
get({
|
||||
let ctx = ctx.clone();
|
||||
move |x::Path(path): x::Path<String>,
|
||||
@@ -119,7 +119,7 @@ pub fn registry_router(ctx: RegistryContext) -> Router {
|
||||
}),
|
||||
)
|
||||
.route(
|
||||
"/rest/rpc/*path",
|
||||
"/rest/rpc/{*path}",
|
||||
any({
|
||||
let ctx = ctx.clone();
|
||||
move |request: x::Request| async move {
|
||||
|
||||
@@ -196,9 +196,9 @@ impl TryFrom<ManifestV1> for Manifest {
|
||||
version = version.with_flavor("knots");
|
||||
} else if &*value.id == "lnd" || &*value.id == "ride-the-lightning" || &*value.id == "datum"
|
||||
{
|
||||
version = version.map_upstream(|mut v| v.with_prerelease(["beta".into()]));
|
||||
version = version.map_upstream(|v| v.with_prerelease(["beta".into()]));
|
||||
} else if &*value.id == "lightning-terminal" || &*value.id == "robosats" {
|
||||
version = version.map_upstream(|mut v| v.with_prerelease(["alpha".into()]));
|
||||
version = version.map_upstream(|v| v.with_prerelease(["alpha".into()]));
|
||||
}
|
||||
Ok(Self {
|
||||
id: value.id,
|
||||
|
||||
@@ -7,7 +7,6 @@ use exver::VersionRange;
|
||||
use imbl::OrdMap;
|
||||
use imbl_value::InternedString;
|
||||
use models::{FromStrParser, HealthCheckId, PackageId, ReplayId, VersionString, VolumeId};
|
||||
use tokio::process::Command;
|
||||
|
||||
use crate::db::model::package::{
|
||||
CurrentDependencies, CurrentDependencyInfo, CurrentDependencyKind, ManifestPreference,
|
||||
@@ -19,7 +18,6 @@ use crate::disk::mount::filesystem::{FileSystem, MountType};
|
||||
use crate::disk::mount::util::{is_mountpoint, unmount};
|
||||
use crate::service::effects::prelude::*;
|
||||
use crate::status::health_check::NamedHealthCheckResult;
|
||||
use crate::util::Invoke;
|
||||
use crate::volume::data_dir;
|
||||
use crate::DATA_DIR;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ use models::PackageId;
|
||||
use crate::service::effects::callbacks::CallbackHandler;
|
||||
use crate::service::effects::prelude::*;
|
||||
use crate::service::rpc::CallbackId;
|
||||
use crate::HOST_IP;
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::process::Stdio;
|
||||
use std::sync::{Arc, Weak};
|
||||
use std::time::Duration;
|
||||
|
||||
use axum::extract::ws::WebSocket;
|
||||
use axum::extract::ws::{Utf8Bytes, WebSocket};
|
||||
use chrono::{DateTime, Utc};
|
||||
use clap::Parser;
|
||||
use futures::future::BoxFuture;
|
||||
@@ -916,7 +916,7 @@ pub async fn attach(
|
||||
|
||||
let mut stdin = Some(child.stdin.take().or_not_found("child stdin")?);
|
||||
|
||||
let mut current_in = "stdin".to_owned();
|
||||
let mut current_in: Utf8Bytes = "stdin".into();
|
||||
let mut current_out = "stdout";
|
||||
ws.send(Message::Text(current_out.into()))
|
||||
.await
|
||||
@@ -942,7 +942,7 @@ pub async fn attach(
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
current_out = "stdout";
|
||||
}
|
||||
ws.send(Message::Binary(out))
|
||||
ws.send(Message::Binary(out.into()))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
} else {
|
||||
@@ -959,7 +959,7 @@ pub async fn attach(
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
current_out = "stderr";
|
||||
}
|
||||
ws.send(Message::Binary(err))
|
||||
ws.send(Message::Binary(err.into()))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
} else {
|
||||
@@ -1018,9 +1018,11 @@ pub async fn attach(
|
||||
ws.send(Message::Text("exit".into()))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
ws.send(Message::Binary(i32::to_be_bytes(exit.into_raw()).to_vec()))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
ws.send(Message::Binary(
|
||||
i32::to_be_bytes(exit.into_raw()).to_vec().into(),
|
||||
))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -1181,7 +1183,7 @@ pub async fn cli_attach(
|
||||
let mut stdin = Some(recv);
|
||||
|
||||
let mut current_in = "stdin";
|
||||
let mut current_out = "stdout".to_owned();
|
||||
let mut current_out: tokio_tungstenite::tungstenite::Utf8Bytes = "stdout".into();
|
||||
ws.send(Message::Text(current_in.into()))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
@@ -1216,7 +1218,7 @@ pub async fn cli_attach(
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
current_in = "stdin";
|
||||
}
|
||||
ws.send(Message::Binary(input))
|
||||
ws.send(Message::Binary(input.into()))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
} else {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::status::MainStatus;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum StartStop {
|
||||
|
||||
@@ -522,6 +522,7 @@ pub async fn metrics_follow(
|
||||
local_cache
|
||||
.peek(|m| serde_json::to_string(&m))
|
||||
.with_kind(ErrorKind::Serialization)?
|
||||
.into(),
|
||||
)).await.with_kind(ErrorKind::Network)?;
|
||||
}
|
||||
msg = ws.try_next() => {
|
||||
|
||||
@@ -118,7 +118,8 @@ pub async fn update_system(
|
||||
.de()?;
|
||||
ws.send(axum::extract::ws::Message::Text(
|
||||
serde_json::to_string(&progress)
|
||||
.with_kind(ErrorKind::Serialization)?,
|
||||
.with_kind(ErrorKind::Serialization)?
|
||||
.into(),
|
||||
))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use core::fmt;
|
||||
use std::borrow::Cow;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use axum::extract::ws::{self, CloseFrame};
|
||||
use axum::extract::ws::{self, CloseFrame, Utf8Bytes};
|
||||
use futures::{Future, Stream, StreamExt};
|
||||
|
||||
use crate::prelude::*;
|
||||
@@ -10,21 +9,21 @@ use crate::prelude::*;
|
||||
pub trait WebSocketExt {
|
||||
fn normal_close(
|
||||
self,
|
||||
msg: impl Into<Cow<'static, str>> + Send,
|
||||
msg: impl Into<Utf8Bytes> + Send,
|
||||
) -> impl Future<Output = Result<(), Error>> + Send;
|
||||
fn close_result(
|
||||
self,
|
||||
result: Result<impl Into<Cow<'static, str>> + Send, impl fmt::Display + Send>,
|
||||
result: Result<impl Into<Utf8Bytes> + Send, impl fmt::Display + Send>,
|
||||
) -> impl Future<Output = Result<(), Error>> + Send;
|
||||
}
|
||||
|
||||
impl WebSocketExt for ws::WebSocket {
|
||||
async fn normal_close(self, msg: impl Into<Cow<'static, str>> + Send) -> Result<(), Error> {
|
||||
async fn normal_close(self, msg: impl Into<Utf8Bytes> + Send) -> Result<(), Error> {
|
||||
self.close_result(Ok::<_, Error>(msg)).await
|
||||
}
|
||||
async fn close_result(
|
||||
mut self,
|
||||
result: Result<impl Into<Cow<'static, str>> + Send, impl fmt::Display + Send>,
|
||||
result: Result<impl Into<Utf8Bytes> + Send, impl fmt::Display + Send>,
|
||||
) -> Result<(), Error> {
|
||||
match result {
|
||||
Ok(msg) => self
|
||||
|
||||
@@ -45,8 +45,9 @@ mod v0_4_0_alpha_2;
|
||||
mod v0_4_0_alpha_3;
|
||||
mod v0_4_0_alpha_4;
|
||||
mod v0_4_0_alpha_5;
|
||||
mod v0_4_0_alpha_6;
|
||||
|
||||
pub type Current = v0_4_0_alpha_5::Version; // VERSION_BUMP
|
||||
pub type Current = v0_4_0_alpha_6::Version; // VERSION_BUMP
|
||||
|
||||
impl Current {
|
||||
#[instrument(skip(self, db))]
|
||||
@@ -155,7 +156,8 @@ enum Version {
|
||||
V0_4_0_alpha_2(Wrapper<v0_4_0_alpha_2::Version>),
|
||||
V0_4_0_alpha_3(Wrapper<v0_4_0_alpha_3::Version>),
|
||||
V0_4_0_alpha_4(Wrapper<v0_4_0_alpha_4::Version>),
|
||||
V0_4_0_alpha_5(Wrapper<v0_4_0_alpha_5::Version>), // VERSION_BUMP
|
||||
V0_4_0_alpha_5(Wrapper<v0_4_0_alpha_5::Version>),
|
||||
V0_4_0_alpha_6(Wrapper<v0_4_0_alpha_6::Version>), // VERSION_BUMP
|
||||
Other(exver::Version),
|
||||
}
|
||||
|
||||
@@ -203,7 +205,8 @@ impl Version {
|
||||
Self::V0_4_0_alpha_2(v) => DynVersion(Box::new(v.0)),
|
||||
Self::V0_4_0_alpha_3(v) => DynVersion(Box::new(v.0)),
|
||||
Self::V0_4_0_alpha_4(v) => DynVersion(Box::new(v.0)),
|
||||
Self::V0_4_0_alpha_5(v) => DynVersion(Box::new(v.0)), // VERSION_BUMP
|
||||
Self::V0_4_0_alpha_5(v) => DynVersion(Box::new(v.0)),
|
||||
Self::V0_4_0_alpha_6(v) => DynVersion(Box::new(v.0)), // VERSION_BUMP
|
||||
Self::Other(v) => {
|
||||
return Err(Error::new(
|
||||
eyre!("unknown version {v}"),
|
||||
@@ -243,7 +246,8 @@ impl Version {
|
||||
Version::V0_4_0_alpha_2(Wrapper(x)) => x.semver(),
|
||||
Version::V0_4_0_alpha_3(Wrapper(x)) => x.semver(),
|
||||
Version::V0_4_0_alpha_4(Wrapper(x)) => x.semver(),
|
||||
Version::V0_4_0_alpha_5(Wrapper(x)) => x.semver(), // VERSION_BUMP
|
||||
Version::V0_4_0_alpha_5(Wrapper(x)) => x.semver(),
|
||||
Version::V0_4_0_alpha_6(Wrapper(x)) => x.semver(), // VERSION_BUMP
|
||||
Version::Other(x) => x.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
46
core/startos/src/version/v0_4_0_alpha_6.rs
Normal file
46
core/startos/src/version/v0_4_0_alpha_6.rs
Normal file
@@ -0,0 +1,46 @@
|
||||
use exver::{PreReleaseSegment, VersionRange};
|
||||
|
||||
use super::v0_3_5::V0_3_0_COMPAT;
|
||||
use super::{v0_4_0_alpha_5, VersionT};
|
||||
use crate::prelude::*;
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref V0_4_0_alpha_6: exver::Version = exver::Version::new(
|
||||
[0, 4, 0],
|
||||
[PreReleaseSegment::String("alpha".into()), 6.into()]
|
||||
);
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
pub struct Version;
|
||||
|
||||
impl VersionT for Version {
|
||||
type Previous = v0_4_0_alpha_5::Version;
|
||||
type PreUpRes = ();
|
||||
|
||||
async fn pre_up(self) -> Result<Self::PreUpRes, Error> {
|
||||
Ok(())
|
||||
}
|
||||
fn semver(self) -> exver::Version {
|
||||
V0_4_0_alpha_6.clone()
|
||||
}
|
||||
fn compat(self) -> &'static VersionRange {
|
||||
&V0_3_0_COMPAT
|
||||
}
|
||||
#[instrument]
|
||||
fn up(self, db: &mut Value, _: Self::PreUpRes) -> Result<(), Error> {
|
||||
let ui = db["public"]["ui"]
|
||||
.as_object_mut()
|
||||
.or_not_found("public.ui")?;
|
||||
if ui.get("ackInstructions").is_none() {
|
||||
if let Some(old) = ui.remove("ack-instructions") {
|
||||
ui.insert("ackInstructions".into(), old);
|
||||
}
|
||||
}
|
||||
ui.remove("ackWelcome");
|
||||
Ok(())
|
||||
}
|
||||
fn down(self, _db: &mut Value) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user