revert crates for front end

master
Niko PLP 3 days ago
parent 814aa22fd4
commit 990fec1869
  1. 1
      .gitignore
  2. 20
      Cargo.lock
  3. 2
      Cargo.toml
  4. 13
      DEV.md
  5. 20
      helpers/app-auth/Cargo.toml
  6. 15
      helpers/app-auth/build.rs
  7. 1
      helpers/app-auth/package.json
  8. 27
      helpers/app-auth/src/lib.rs
  9. 16
      ng-app/Cargo.toml
  10. 15
      ng-app/build.rs
  11. 27
      ng-app/src/lib.rs
  12. 2
      ng-broker/Cargo.toml
  13. 36
      ng-broker/src/server_ws.rs
  14. 2
      ng-repo/Cargo.toml

1
.gitignore vendored

@ -15,4 +15,3 @@ node_modules
*/ng-example/*
.vscode/settings.json
.env.local
ng-broker/static

20
Cargo.lock generated

@ -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",

@ -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" ]

@ -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

@ -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"] }

@ -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();
}

@ -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"

@ -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")
// }

@ -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"] }

@ -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();
}

@ -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")
// }

@ -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"

@ -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<BindAddress>, port: u16) -> Vec<S
res
}
// #[cfg(not(docsrs))]
// #[derive(RustEmbed)]
// #[folder = "../ng-app/dist-file/"]
// #[include = "*.sha256"]
// #[include = "*.gzip"]
// struct App;
#[derive(RustEmbed)]
#[folder = "../ng-app/dist-file/"]
#[include = "*.sha256"]
#[include = "*.gzip"]
struct App;
// #[cfg(not(docsrs))]
// #[derive(RustEmbed)]
// #[folder = "../helpers/app-auth/dist/"]
// #[include = "*.sha256"]
// #[include = "*.gzip"]
#[derive(RustEmbed)]
#[folder = "../helpers/app-auth/dist/"]
#[include = "*.sha256"]
#[include = "*.gzip"]
// struct AppAuth;
struct AppAuth;
// #[cfg(not(docsrs))]
// #[derive(RustEmbed)]
// #[folder = "./static/app/"]
// #[include = "*.sha256"]
// #[include = "*.gzip"]
// struct App;
// #[cfg(not(docsrs))]
// #[derive(RustEmbed)]
// #[folder = "./static/app-auth/"]
// #[include = "*.sha256"]
@ -255,7 +247,7 @@ fn upgrade_ws_or_serve_app(
if serve_app && (remote.is_private() || remote.is_loopback()) {
if uri == "/" {
log_debug!("Serving the app");
let sha_file = get_app_web_sha256();
let sha_file = App::get("index.sha256").unwrap();
let sha = format!(
"\"{}\"",
std::str::from_utf8(sha_file.data.as_ref()).unwrap()
@ -270,7 +262,7 @@ fn upgrade_ws_or_serve_app(
.unwrap();
return Err(res);
}
let file = get_app_web_gzip();
let file = App::get("index.gzip").unwrap();
let res = Response::builder()
.status(StatusCode::OK)
.header("Content-Type", "text/html")
@ -300,7 +292,7 @@ fn upgrade_ws_or_serve_app(
},
None => {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}"))

@ -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"

Loading…
Cancel
Save