From 990fec18690f216356ce6c3189e5779dc082d7a9 Mon Sep 17 00:00:00 2001 From: Niko PLP Date: Fri, 2 May 2025 01:26:42 +0300 Subject: [PATCH] revert crates for front end --- .gitignore | 1 - Cargo.lock | 20 ++----------------- Cargo.toml | 2 -- DEV.md | 13 +------------ helpers/app-auth/Cargo.toml | 20 ------------------- helpers/app-auth/build.rs | 15 --------------- helpers/app-auth/package.json | 1 - helpers/app-auth/src/lib.rs | 27 -------------------------- ng-app/Cargo.toml | 16 ---------------- ng-app/build.rs | 15 --------------- ng-app/src/lib.rs | 27 -------------------------- ng-broker/Cargo.toml | 2 -- ng-broker/src/server_ws.rs | 36 ++++++++++++++--------------------- ng-repo/Cargo.toml | 2 +- 14 files changed, 18 insertions(+), 179 deletions(-) delete mode 100644 helpers/app-auth/Cargo.toml delete mode 100644 helpers/app-auth/build.rs delete mode 100644 helpers/app-auth/src/lib.rs delete mode 100644 ng-app/Cargo.toml delete mode 100644 ng-app/build.rs delete mode 100644 ng-app/src/lib.rs diff --git a/.gitignore b/.gitignore index 777abec..f1e389f 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,3 @@ node_modules */ng-example/* .vscode/settings.json .env.local -ng-broker/static diff --git a/Cargo.lock b/Cargo.lock index 38f0018..5ea468c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3286,20 +3286,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "ng-app-auth" -version = "0.1.1-alpha.2" -dependencies = [ - "rust-embed", -] - -[[package]] -name = "ng-app-web" -version = "0.1.1-alpha.2" -dependencies = [ - "rust-embed", -] - [[package]] name = "ng-async-tungstenite" version = "0.22.2" @@ -3325,8 +3311,6 @@ dependencies = [ "futures", "getrandom 0.2.10", "netdev", - "ng-app-auth", - "ng-app-web", "ng-async-tungstenite", "ng-client-ws", "ng-net", @@ -3593,8 +3577,8 @@ dependencies = [ [[package]] name = "ng_threshold_crypto" -version = "0.4.0" -source = "git+https://git.nextgraph.org/NextGraph/threshold_crypto.git?branch=master#f3fee569e04999b898a1b3edc412ebf961099550" +version = "0.4.1" +source = "git+https://git.nextgraph.org/NextGraph/threshold_crypto.git?branch=master#5475af23b4fe77f5ad1aba083c9058379065fffa" dependencies = [ "byteorder", "ff", diff --git a/Cargo.toml b/Cargo.toml index 265be2e..817e36f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,13 +13,11 @@ members = [ "ng-sdk-js", "ng-sdk-python", "ng-app/src-tauri", - "ng-app", "ng-oxigraph", "helpers/wasm-tools", "helpers/ngnet", "helpers/ngapp", "helpers/ngaccount", - "helpers/app-auth", ] default-members = [ "nextgraph", "ngcli", "ngd" ] diff --git a/DEV.md b/DEV.md index c73f378..3fddf3e 100644 --- a/DEV.md +++ b/DEV.md @@ -167,15 +167,7 @@ cargo test --package ng-client-ws --lib -- remote_ws::test::test_ws --show-outpu ### Build release binaries First you will need to have the production build of the frontend. -If you do not want to setup a whole development environment for the frontend, you can use the precompiled release of the frontend available in `dist-file.tar.gz` that you can download from the release page. - -``` -cd ng-app -tar -xzf dist-file.tar.gz -cd .. -``` - -Otherwise, build from source the single-file release of ng-app +You need to freshly built it from source, following those instructions: ``` cargo install cargo-run-script @@ -187,9 +179,6 @@ pnpm -C ./ng-app install pnpm -C ./ng-app webfilebuild pnpm -C ./helpers/app-auth install pnpm -C ./helpers/app-auth build -mkdir ng-broker/static -cp -r ./ng-app/dist-file ./ng-broker/static/app -cp -r ./helpers/app-auth/dist ./ng-broker/static/app-auth ``` then build the ngd daemon diff --git a/helpers/app-auth/Cargo.toml b/helpers/app-auth/Cargo.toml deleted file mode 100644 index 1af8a7c..0000000 --- a/helpers/app-auth/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "ng-app-auth" -description = "NextGraph Auth App" -publish = true -version.workspace = true -edition.workspace = true -license.workspace = true -authors.workspace = true -repository.workspace = true -homepage.workspace = true -keywords.workspace = true -documentation.workspace = true -rust-version.workspace = true - -#[lib] -#name = "ngappauthlib" -#crate-type = ["rlib"] - -[dependencies] -rust-embed= { version = "6.7.0", features=["include-exclude"] } \ No newline at end of file diff --git a/helpers/app-auth/build.rs b/helpers/app-auth/build.rs deleted file mode 100644 index 4564487..0000000 --- a/helpers/app-auth/build.rs +++ /dev/null @@ -1,15 +0,0 @@ -use std::process::Command; -use std::env; -use std::path::Path; - -fn main() { - println!("cargo:rerun-if-changed=src"); - - let out_dir = env::var("OUT_DIR").unwrap(); - //println!("{out_dir}"); -//pnpm -C ./helpers/app-auth install -//pnpm -C ./helpers/app-auth build - - Command::new("pnpm").args(&["install"]).status().unwrap(); - Command::new("pnpm").args(&["buildcargo"]).status().unwrap(); -} diff --git a/helpers/app-auth/package.json b/helpers/app-auth/package.json index e888da8..02ed650 100644 --- a/helpers/app-auth/package.json +++ b/helpers/app-auth/package.json @@ -5,7 +5,6 @@ "type": "module", "scripts": { "dev": "vite", - "buildcargo": "vite build --base=./ && node prepare-app-file.cjs && shx rm -rf ./dist/assets", "build": "cd ../wasm-tools && cargo run-script app && cd ../app-auth && vite build --base=./ && node prepare-app-file.cjs && shx rm -rf ./dist/assets", "builddev": "cd ../wasm-tools && cargo run-script app && cd ../app-auth && cross-env NG_DEV=1 vite build --base=./ && shx rm -rf ./dist/assets && shx mkdir -p ../../ng-app/public_dev && cp ./dist/index.html ../../ng-app/public_dev/appauth.html", "preview": "vite preview" diff --git a/helpers/app-auth/src/lib.rs b/helpers/app-auth/src/lib.rs deleted file mode 100644 index 62a2abf..0000000 --- a/helpers/app-auth/src/lib.rs +++ /dev/null @@ -1,27 +0,0 @@ - -use rust_embed::{EmbeddedFile, RustEmbed}; -use std::path::Path; - - -#[derive(RustEmbed)] -#[folder = "./dist/"] -#[include = "*.sha256"] -#[include = "*.gzip"] - -pub struct AppAuth; - -pub fn get_app_auth_sha256() -> EmbeddedFile { - AppAuth::get("index.sha256").unwrap() -} - -// pub fn get_app_auth_sha256_bytes() -> &'static [u8] { -// include_bytes!("../dist/index.sha256") -// } - -pub fn get_app_auth_gzip() -> EmbeddedFile { - AppAuth::get("index.gzip").unwrap() -} - -// pub fn get_app_auth_gzip_bytes() -> &'static [u8] { -// include_bytes!("../dist/index.gzip") -// } \ No newline at end of file diff --git a/ng-app/Cargo.toml b/ng-app/Cargo.toml deleted file mode 100644 index af852e6..0000000 --- a/ng-app/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "ng-app-web" -description = "NextGraph Official Web App" -publish = true -version.workspace = true -edition.workspace = true -license.workspace = true -authors.workspace = true -repository.workspace = true -homepage.workspace = true -keywords.workspace = true -documentation.workspace = true -rust-version.workspace = true - -[dependencies] -rust-embed= { version = "6.7.0", features=["include-exclude"] } \ No newline at end of file diff --git a/ng-app/build.rs b/ng-app/build.rs deleted file mode 100644 index 9fe7b22..0000000 --- a/ng-app/build.rs +++ /dev/null @@ -1,15 +0,0 @@ -use std::process::Command; -use std::env; -use std::path::Path; - -fn main() { - println!("cargo:rerun-if-changed=src"); - - let out_dir = env::var("OUT_DIR").unwrap(); - //println!("{out_dir}"); -//pnpm -C ./helpers/app-auth install -//pnpm -C ./helpers/app-auth build - - Command::new("pnpm").args(&["install"]).status().unwrap(); - Command::new("pnpm").args(&["webfilebuild"]).status().unwrap(); -} diff --git a/ng-app/src/lib.rs b/ng-app/src/lib.rs deleted file mode 100644 index da6716c..0000000 --- a/ng-app/src/lib.rs +++ /dev/null @@ -1,27 +0,0 @@ - -use rust_embed::{EmbeddedFile, RustEmbed}; -use std::path::Path; - - -#[derive(RustEmbed)] -#[folder = "./dist-file/"] -#[include = "*.sha256"] -#[include = "*.gzip"] - -pub struct AppWeb; - -pub fn get_app_web_sha256() -> EmbeddedFile { - AppWeb::get("index.sha256").unwrap() -} - -// pub fn get_app_auth_sha256_bytes() -> &'static [u8] { -// include_bytes!("../dist/index.sha256") -// } - -pub fn get_app_web_gzip() -> EmbeddedFile { - AppWeb::get("index.gzip").unwrap() -} - -// pub fn get_app_auth_gzip_bytes() -> &'static [u8] { -// include_bytes!("../dist/index.gzip") -// } \ No newline at end of file diff --git a/ng-broker/Cargo.toml b/ng-broker/Cargo.toml index 583ca26..246fc9d 100644 --- a/ng-broker/Cargo.toml +++ b/ng-broker/Cargo.toml @@ -32,8 +32,6 @@ ng-net = { path = "../ng-net", version = "0.1.1-alpha.2" } ng-client-ws = { path = "../ng-client-ws", version = "0.1.1-alpha.2" } ng-verifier = { path = "../ng-verifier", version = "0.1.1-alpha.2" } ng-storage-rocksdb = { path = "../ng-storage-rocksdb", version = "0.1.1-alpha.2" } -ng-app-auth = { path = "../helpers/app-auth", version = "0.1.1-alpha.2" } -ng-app-web = { path = "../ng-app", version = "0.1.1-alpha.2" } [target.'cfg(target_arch = "wasm32")'.dependencies.getrandom] version = "0.2.7" diff --git a/ng-broker/src/server_ws.rs b/ng-broker/src/server_ws.rs index 1abcade..4fbd177 100644 --- a/ng-broker/src/server_ws.rs +++ b/ng-broker/src/server_ws.rs @@ -46,10 +46,6 @@ use ng_net::NG_BOOTSTRAP_LOCAL_PATH; use ng_client_ws::remote_ws::ConnectionWebSocket; -use ng_app_auth::{get_app_auth_gzip, get_app_auth_sha256}; - -use ng_app_web::{get_app_web_gzip, get_app_web_sha256}; - use crate::interfaces::*; use crate::rocksdb_server_storage::RocksDbServerStorage; use crate::server_broker::ServerBroker; @@ -196,29 +192,25 @@ fn prepare_urls_from_private_addrs(addrs: &Vec, port: u16) -> Vec {return Err(make_error(StatusCode::BAD_REQUEST))} }; - let sha_file = get_app_auth_sha256(); + let sha_file = AppAuth::get("index.sha256").unwrap(); let sha = format!( "\"{}\"", std::str::from_utf8(sha_file.data.as_ref()).unwrap() @@ -317,7 +309,7 @@ fn upgrade_ws_or_serve_app( .unwrap(); return Err(res); } - let file = get_app_auth_gzip(); + let file = AppAuth::get("index.gzip").unwrap(); let res = Response::builder().status(StatusCode::OK) .header("Content-Security-Policy", format!("frame-ancestors 'self' https://nextgraph.net {webapp_origin};")) .header("X-Frame-Options", format!("ALLOW-FROM {webapp_origin}")) diff --git a/ng-repo/Cargo.toml b/ng-repo/Cargo.toml index 06e9555..e0b4244 100644 --- a/ng-repo/Cargo.toml +++ b/ng-repo/Cargo.toml @@ -37,7 +37,7 @@ ed25519-dalek = "1.0.1" sbbf-rs-safe = "0.3.2" lazy_static = "1.4.0" curve25519-dalek = "3.2.0" -ng_threshold_crypto = { version = "0.4.0", git = "https://git.nextgraph.org/NextGraph/threshold_crypto.git", branch = "master" } +ng_threshold_crypto = { version = "0.4.1", git = "https://git.nextgraph.org/NextGraph/threshold_crypto.git", branch = "master" } crypto_box = { version = "0.8.2", features = ["seal"] } zeroize = { version = "1.7.0", features = ["zeroize_derive"] } base64-url = "2.0.0"