mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
Gateways, domains, and new service interface (#3001)
* add support for inbound proxies * backend changes * fix file type * proxy -> tunnel, implement backend apis * wip start-tunneld * add domains and gateways, remove routers, fix docs links * dont show hidden actions * show and test dns * edit instead of chnage acme and change gateway * refactor: domains page * refactor: gateways page * domains and acme refactor * certificate authorities * refactor public/private gateways * fix fe types * domains mostly finished * refactor: add file control to form service * add ip util to sdk * domains api + migration * start service interface page, WIP * different options for clearnet domains * refactor: styles for interfaces page * minor * better placeholder for no addresses * start sorting addresses * best address logic * comments * fix unnecessary export * MVP of service interface page * domains preferred * fix: address comments * only translations left * wip: start-tunnel & fix build * forms for adding domain, rework things based on new ideas * fix: dns testing * public domain, max width, descriptions for dns * nix StartOS domains, implement public and private domains at interface scope * restart tor instead of reset * better icon for restart tor * dns * fix sort functions for public and private domains * with todos * update types * clean up tech debt, bump dependencies * revert to ts-rs v9 * fix all types * fix dns form * add missing translations * it builds * fix: comments (#3009) * fix: comments * undo default --------- Co-authored-by: Matt Hill <mattnine@protonmail.com> * fix: refactor legacy components (#3010) * fix: comments * fix: refactor legacy components * remove default again --------- Co-authored-by: Matt Hill <mattnine@protonmail.com> * more translations * wip * fix deadlock * coukd work * simple renaming * placeholder for empty service interfaces table * honor hidden form values * remove logs * reason instead of description * fix dns * misc fixes * implement toggling gateways for service interface * fix showing dns records * move status column in service list * remove unnecessary truthy check * refactor: refactor forms components and remove legacy Taiga UI package (#3012) * handle wh file uploads * wip: debugging tor * socks5 proxy working * refactor: fix multiple comments (#3013) * refactor: fix multiple comments * styling changes, add documentation to sidebar * translations for dns page * refactor: subtle colors * rearrange service page --------- Co-authored-by: Matt Hill <mattnine@protonmail.com> * fix file_stream and remove non-terminating test * clean up logs * support for sccache * fix gha sccache * more marketplace translations * install wizard clarity * stub hostnameInfo in migration * fix address info after setup, fix styling on SI page, new 040 release notes * remove tor logs from os * misc fixes * reset tor still not functioning... * update ts * minor styling and wording * chore: some fixes (#3015) * fix gateway renames * different handling for public domains * styling fixes * whole navbar should not be clickable on service show page * timeout getState request * remove links from changelog * misc fixes from pairing * use custom name for gateway in more places * fix dns parsing * closes #3003 * closes #2999 * chore: some fixes (#3017) * small copy change * revert hardcoded error for testing * dont require port forward if gateway is public * use old wan ip when not available * fix .const hanging on undefined * fix test * fix doc test * fix renames * update deps * allow specifying dependency metadata directly * temporarily make dependencies not cliackable in marketplace listings * fix socks bind * fix test --------- Co-authored-by: Aiden McClelland <me@drbonez.dev> Co-authored-by: waterplea <alexander@inkin.ru>
This commit is contained in:
@@ -6,7 +6,7 @@ use clap::Parser;
|
||||
use futures::future::{ready, BoxFuture};
|
||||
use futures::{FutureExt, TryStreamExt};
|
||||
use imbl_value::InternedString;
|
||||
use models::{ImageId, PackageId, VersionString};
|
||||
use models::{DataUrl, ImageId, PackageId, VersionString};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::process::Command;
|
||||
use tokio::sync::OnceCell;
|
||||
@@ -15,7 +15,7 @@ use tracing::{debug, warn};
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::context::CliContext;
|
||||
use crate::dependencies::DependencyMetadata;
|
||||
use crate::dependencies::{DependencyMetadata, MetadataSrc};
|
||||
use crate::prelude::*;
|
||||
use crate::rpc_continuations::Guid;
|
||||
use crate::s9pk::git_hash::GitHash;
|
||||
@@ -147,8 +147,6 @@ pub struct PackParams {
|
||||
pub icon: Option<PathBuf>,
|
||||
#[arg(long)]
|
||||
pub license: Option<PathBuf>,
|
||||
#[arg(long)]
|
||||
pub instructions: Option<PathBuf>,
|
||||
#[arg(long, conflicts_with = "no-assets")]
|
||||
pub assets: Option<PathBuf>,
|
||||
#[arg(long, conflicts_with = "assets")]
|
||||
@@ -240,12 +238,6 @@ impl PackParams {
|
||||
.await?
|
||||
}
|
||||
}
|
||||
fn instructions(&self) -> PathBuf {
|
||||
self.instructions
|
||||
.as_ref()
|
||||
.cloned()
|
||||
.unwrap_or_else(|| self.path().join("instructions.md"))
|
||||
}
|
||||
fn assets(&self) -> PathBuf {
|
||||
self.assets
|
||||
.as_ref()
|
||||
@@ -705,53 +697,77 @@ pub async fn pack(ctx: CliContext, params: PackParams) -> Result<(), Error> {
|
||||
|
||||
let mut to_insert = Vec::new();
|
||||
for (id, dependency) in &mut s9pk.as_manifest_mut().dependencies.0 {
|
||||
if let Some(s9pk) = dependency.s9pk.take() {
|
||||
let s9pk = match s9pk {
|
||||
PathOrUrl::Path(path) => {
|
||||
S9pk::deserialize(&MultiCursorFile::from(open_file(path).await?), None)
|
||||
.await?
|
||||
.into_dyn()
|
||||
}
|
||||
PathOrUrl::Url(url) => {
|
||||
if url.scheme() == "http" || url.scheme() == "https" {
|
||||
S9pk::deserialize(
|
||||
&Arc::new(HttpSource::new(ctx.client.clone(), url).await?),
|
||||
None,
|
||||
)
|
||||
.await?
|
||||
.into_dyn()
|
||||
} else {
|
||||
return Err(Error::new(
|
||||
eyre!("unknown scheme: {}", url.scheme()),
|
||||
ErrorKind::InvalidRequest,
|
||||
));
|
||||
if let Some((title, icon)) = match dependency.metadata.take() {
|
||||
Some(MetadataSrc::Metadata(metadata)) => {
|
||||
let icon = match metadata.icon {
|
||||
PathOrUrl::Path(path) => DataUrl::from_path(path).await?,
|
||||
PathOrUrl::Url(url) => {
|
||||
if url.scheme() == "http" || url.scheme() == "https" {
|
||||
DataUrl::from_response(ctx.client.get(url).send().await?).await?
|
||||
} else if url.scheme() == "data" {
|
||||
url.as_str().parse()?
|
||||
} else {
|
||||
return Err(Error::new(
|
||||
eyre!("unknown scheme: {}", url.scheme()),
|
||||
ErrorKind::InvalidRequest,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
Some((metadata.title, icon))
|
||||
}
|
||||
Some(MetadataSrc::S9pk(Some(s9pk))) => {
|
||||
let s9pk = match s9pk {
|
||||
PathOrUrl::Path(path) => {
|
||||
S9pk::deserialize(&MultiCursorFile::from(open_file(path).await?), None)
|
||||
.await?
|
||||
.into_dyn()
|
||||
}
|
||||
PathOrUrl::Url(url) => {
|
||||
if url.scheme() == "http" || url.scheme() == "https" {
|
||||
S9pk::deserialize(
|
||||
&Arc::new(HttpSource::new(ctx.client.clone(), url).await?),
|
||||
None,
|
||||
)
|
||||
.await?
|
||||
.into_dyn()
|
||||
} else {
|
||||
return Err(Error::new(
|
||||
eyre!("unknown scheme: {}", url.scheme()),
|
||||
ErrorKind::InvalidRequest,
|
||||
));
|
||||
}
|
||||
}
|
||||
};
|
||||
Some((
|
||||
s9pk.as_manifest().title.clone(),
|
||||
s9pk.icon_data_url().await?,
|
||||
))
|
||||
}
|
||||
Some(MetadataSrc::S9pk(None)) | None => {
|
||||
warn!("no metadata specified for {id}, leaving metadata empty");
|
||||
None
|
||||
}
|
||||
} {
|
||||
let dep_path = Path::new("dependencies").join(id);
|
||||
to_insert.push((
|
||||
dep_path.join("metadata.json"),
|
||||
Entry::file(TmpSource::new(
|
||||
tmp_dir.clone(),
|
||||
PackSource::Buffered(
|
||||
IoFormat::Json
|
||||
.to_vec(&DependencyMetadata {
|
||||
title: s9pk.as_manifest().title.clone(),
|
||||
})?
|
||||
.into(),
|
||||
IoFormat::Json.to_vec(&DependencyMetadata { title })?.into(),
|
||||
),
|
||||
)),
|
||||
));
|
||||
let icon = s9pk.icon().await?;
|
||||
to_insert.push((
|
||||
dep_path.join(&*icon.0),
|
||||
dep_path
|
||||
.join("icon")
|
||||
.with_extension(icon.canonical_ext().unwrap_or("ico")),
|
||||
Entry::file(TmpSource::new(
|
||||
tmp_dir.clone(),
|
||||
PackSource::Buffered(icon.1.expect_file()?.to_vec(icon.1.hash()).await?.into()),
|
||||
PackSource::Buffered(icon.data.into_owned().into()),
|
||||
)),
|
||||
));
|
||||
} else {
|
||||
warn!("no s9pk specified for {id}, leaving metadata empty");
|
||||
}
|
||||
}
|
||||
for (path, source) in to_insert {
|
||||
@@ -797,24 +813,23 @@ pub async fn list_ingredients(_: CliContext, params: PackParams) -> Result<Vec<P
|
||||
Err(e) => {
|
||||
warn!("failed to load manifest: {e}");
|
||||
debug!("{e:?}");
|
||||
return Ok(vec![
|
||||
js_path,
|
||||
params.icon().await?,
|
||||
params.license().await?,
|
||||
params.instructions(),
|
||||
]);
|
||||
return Ok(vec![js_path, params.icon().await?, params.license().await?]);
|
||||
}
|
||||
};
|
||||
let mut ingredients = vec![
|
||||
js_path,
|
||||
params.icon().await?,
|
||||
params.license().await?,
|
||||
params.instructions(),
|
||||
];
|
||||
let mut ingredients = vec![js_path, params.icon().await?, params.license().await?];
|
||||
|
||||
for (_, dependency) in manifest.dependencies.0 {
|
||||
if let Some(PathOrUrl::Path(p)) = dependency.s9pk {
|
||||
ingredients.push(p);
|
||||
match dependency.metadata {
|
||||
Some(MetadataSrc::Metadata(crate::dependencies::Metadata {
|
||||
icon: PathOrUrl::Path(icon),
|
||||
..
|
||||
})) => {
|
||||
ingredients.push(icon);
|
||||
}
|
||||
Some(MetadataSrc::S9pk(Some(PathOrUrl::Path(s9pk)))) => {
|
||||
ingredients.push(s9pk);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user