bless
This commit is contained in:
parent
1ab99e475b
commit
46c9ac3dd7
214
node/Cargo.lock
generated
214
node/Cargo.lock
generated
@ -163,6 +163,12 @@ version = "0.7.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ascii"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async-trait"
|
name = "async-trait"
|
||||||
version = "0.1.89"
|
version = "0.1.89"
|
||||||
@ -331,7 +337,7 @@ dependencies = [
|
|||||||
"sled",
|
"sled",
|
||||||
"textwrap",
|
"textwrap",
|
||||||
"thiserror 2.0.16",
|
"thiserror 2.0.16",
|
||||||
"tinyhttp",
|
"tiny_http",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-tungstenite",
|
"tokio-tungstenite",
|
||||||
"uuid",
|
"uuid",
|
||||||
@ -397,17 +403,6 @@ dependencies = [
|
|||||||
"shlex",
|
"shlex",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cfb"
|
|
||||||
version = "0.7.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f"
|
|
||||||
dependencies = [
|
|
||||||
"byteorder",
|
|
||||||
"fnv",
|
|
||||||
"uuid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "0.1.10"
|
version = "0.1.10"
|
||||||
@ -458,6 +453,12 @@ dependencies = [
|
|||||||
"windows-link",
|
"windows-link",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chunked_transfer"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6e4de3bc4ea267985becf712dc6d9eed8b04c953b3fcfb339ebc87acd9804901"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cipher"
|
name = "cipher"
|
||||||
version = "0.4.4"
|
version = "0.4.4"
|
||||||
@ -610,15 +611,6 @@ dependencies = [
|
|||||||
"cfg-if 1.0.3",
|
"cfg-if 1.0.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crossbeam-channel"
|
|
||||||
version = "0.5.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2"
|
|
||||||
dependencies = [
|
|
||||||
"crossbeam-utils",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-epoch"
|
name = "crossbeam-epoch"
|
||||||
version = "0.9.18"
|
version = "0.9.18"
|
||||||
@ -839,12 +831,6 @@ dependencies = [
|
|||||||
"litrs",
|
"litrs",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dyn-clone"
|
|
||||||
version = "1.0.20"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ecdsa"
|
name = "ecdsa"
|
||||||
version = "0.16.9"
|
version = "0.16.9"
|
||||||
@ -937,16 +923,6 @@ dependencies = [
|
|||||||
"toml",
|
"toml",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "flate2"
|
|
||||||
version = "1.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d"
|
|
||||||
dependencies = [
|
|
||||||
"crc32fast",
|
|
||||||
"miniz_oxide",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fluent"
|
name = "fluent"
|
||||||
version = "0.16.1"
|
version = "0.16.1"
|
||||||
@ -1003,21 +979,6 @@ version = "0.1.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "foreign-types"
|
|
||||||
version = "0.3.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
|
|
||||||
dependencies = [
|
|
||||||
"foreign-types-shared",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "foreign-types-shared"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "form_urlencoded"
|
name = "form_urlencoded"
|
||||||
version = "1.2.2"
|
version = "1.2.2"
|
||||||
@ -1306,6 +1267,12 @@ version = "1.10.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
|
checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "httpdate"
|
||||||
|
version = "1.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "i18n-config"
|
name = "i18n-config"
|
||||||
version = "0.4.8"
|
version = "0.4.8"
|
||||||
@ -1515,15 +1482,6 @@ version = "2.0.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd"
|
checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "infer"
|
|
||||||
version = "0.15.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cb33622da908807a06f9513c19b3c1ad50fab3e4137d82a78107d502075aa199"
|
|
||||||
dependencies = [
|
|
||||||
"cfb",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "inout"
|
name = "inout"
|
||||||
version = "0.1.4"
|
version = "0.1.4"
|
||||||
@ -1758,22 +1716,6 @@ dependencies = [
|
|||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "mime"
|
|
||||||
version = "0.3.17"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "mime_guess"
|
|
||||||
version = "2.0.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"
|
|
||||||
dependencies = [
|
|
||||||
"mime",
|
|
||||||
"unicase",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "minimal-lexical"
|
name = "minimal-lexical"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
@ -1874,16 +1816,6 @@ dependencies = [
|
|||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num_cpus"
|
|
||||||
version = "1.17.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b"
|
|
||||||
dependencies = [
|
|
||||||
"hermit-abi",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "object"
|
name = "object"
|
||||||
version = "0.36.7"
|
version = "0.36.7"
|
||||||
@ -1917,44 +1849,6 @@ version = "0.3.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
|
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "openssl"
|
|
||||||
version = "0.10.73"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 2.9.3",
|
|
||||||
"cfg-if 1.0.3",
|
|
||||||
"foreign-types",
|
|
||||||
"libc",
|
|
||||||
"once_cell",
|
|
||||||
"openssl-macros",
|
|
||||||
"openssl-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "openssl-macros"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "openssl-sys"
|
|
||||||
version = "0.9.109"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"libc",
|
|
||||||
"pkg-config",
|
|
||||||
"vcpkg",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parking_lot"
|
name = "parking_lot"
|
||||||
version = "0.11.2"
|
version = "0.11.2"
|
||||||
@ -2081,12 +1975,6 @@ dependencies = [
|
|||||||
"spki",
|
"spki",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pkg-config"
|
|
||||||
version = "0.3.32"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "poly1305"
|
name = "poly1305"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
@ -2439,19 +2327,6 @@ version = "1.0.22"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rusty_pool"
|
|
||||||
version = "0.7.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4ed36cdb20de66d89a17ea04b8883fc7a386f2cf877aaedca5005583ce4876ff"
|
|
||||||
dependencies = [
|
|
||||||
"crossbeam-channel",
|
|
||||||
"futures",
|
|
||||||
"futures-channel",
|
|
||||||
"futures-executor",
|
|
||||||
"num_cpus",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
version = "1.0.20"
|
version = "1.0.20"
|
||||||
@ -2869,42 +2744,15 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinyhttp"
|
name = "tiny_http"
|
||||||
version = "0.5.0"
|
version = "0.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "40da872cd88188b99336266db850a3a87037dc463b376db7a422236427e3a0b6"
|
checksum = "389915df6413a2e74fb181895f933386023c71110878cd0825588928e64cdc82"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"tinyhttp-codegen",
|
"ascii",
|
||||||
"tinyhttp-internal",
|
"chunked_transfer",
|
||||||
]
|
"httpdate",
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tinyhttp-codegen"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "020ea8639b093aa2a1f70cdcb07af1935ec1fcdcc36b3f7e1208751dbbf2470d"
|
|
||||||
dependencies = [
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
"tinyhttp-internal",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tinyhttp-internal"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "58a51a6d7166b0083f7f9537a54cb749ce16ef73811bfd77452e4d4eab1c4389"
|
|
||||||
dependencies = [
|
|
||||||
"dyn-clone",
|
|
||||||
"flate2",
|
|
||||||
"infer",
|
|
||||||
"log",
|
"log",
|
||||||
"mime_guess",
|
|
||||||
"num_cpus",
|
|
||||||
"openssl",
|
|
||||||
"rusty_pool",
|
|
||||||
"thiserror 1.0.69",
|
|
||||||
"tokio",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -3018,12 +2866,6 @@ dependencies = [
|
|||||||
"tinystr",
|
"tinystr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicase"
|
|
||||||
version = "2.8.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.18"
|
version = "1.0.18"
|
||||||
@ -3129,12 +2971,6 @@ dependencies = [
|
|||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "vcpkg"
|
|
||||||
version = "0.2.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version_check"
|
name = "version_check"
|
||||||
version = "0.9.5"
|
version = "0.9.5"
|
||||||
|
|||||||
@ -32,4 +32,4 @@ ring = "0.17.14"
|
|||||||
shared = { path = "../shared", features = ["node"] }
|
shared = { path = "../shared", features = ["node"] }
|
||||||
wallet = { path = "../wallet" }
|
wallet = { path = "../wallet" }
|
||||||
cli-renderer = { path = "../cli-renderer" }
|
cli-renderer = { path = "../cli-renderer" }
|
||||||
tinyhttp = { version = "0.5.0", features = ["async"] }
|
tiny_http = "0.12.0"
|
||||||
|
|||||||
@ -1,22 +1,54 @@
|
|||||||
use std::net::TcpStream;
|
use tiny_http::{ Method, Response, Header };
|
||||||
|
use thiserror::Error;
|
||||||
|
use crate::{ log, PROJECT_PATH };
|
||||||
|
use vlogger::*;
|
||||||
|
|
||||||
use tinyhttp;
|
#[derive(Error, Debug)]
|
||||||
use tokio::net::{TcpListener, TcpSocket};
|
pub enum HttpServerError {
|
||||||
|
|
||||||
#[derive(Error, Clone)]
|
|
||||||
enum HttpServerError {
|
|
||||||
#[error("Socket Error: {0}")]
|
#[error("Socket Error: {0}")]
|
||||||
SockerError(#[from] std::io::Error)
|
SockerError(#[from] std::io::Error)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn start_server() {
|
const ENDPOINTS: [&str; 3] = ["/index.html", "/app.js", "/404.html"];
|
||||||
let tcp_listner = TcpListener::bind("127.0.0.1:6080").await.unwrap();
|
|
||||||
|
|
||||||
let config = tinyhttp::prelude::Config::new();
|
fn derive_content_type(endpoint: &String) -> &str {
|
||||||
|
match endpoint.rsplit(".").last() {
|
||||||
let home_route = tinyhttp::prelude::Routes::new();
|
Some(ext) => {
|
||||||
|
match ext {
|
||||||
let server = tinyhttp::prelude::HttpListener::new(tcp_listner, config);
|
"html" => "text/html",
|
||||||
|
"js" => "text/javascript",
|
||||||
server.start();
|
_ => "text/plain"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
"text/plain"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn file_response(path: String, endpoint: String) -> Result<Response<std::fs::File>, std::io::Error> {
|
||||||
|
let file = std::fs::OpenOptions::new().read(true).open(path)?;
|
||||||
|
let content_type = derive_content_type(&endpoint);
|
||||||
|
Ok(
|
||||||
|
Response::from_file(file)
|
||||||
|
.with_status_code(200)
|
||||||
|
.with_header(Header::from_bytes(&b"Content-Type"[..], content_type.as_bytes()).unwrap())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn start_server() -> Result<(), HttpServerError>{
|
||||||
|
let address = "127.0.0.1:6080";
|
||||||
|
let server = tiny_http::Server::http(address).unwrap();
|
||||||
|
|
||||||
|
let root = format!("{}/{}", PROJECT_PATH, "static");
|
||||||
|
|
||||||
|
loop {
|
||||||
|
let req = server.recv()?;
|
||||||
|
log(msg!(DEBUG, "{:?}", req));
|
||||||
|
match req.method() {
|
||||||
|
Method::Get => {
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,7 +169,7 @@ pub struct CliArgs {
|
|||||||
pub seed: bool,
|
pub seed: bool,
|
||||||
|
|
||||||
/// Run with temporary db
|
/// Run with temporary db
|
||||||
#[arg(short = 't', long = "seed", action = clap::ArgAction::SetTrue)]
|
#[arg(short = 't', long = "temporary", action = clap::ArgAction::SetTrue)]
|
||||||
pub temporary: bool,
|
pub temporary: bool,
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
1
node/src/constants.rs
Normal file
1
node/src/constants.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
pub const PROJECT_PATH: &str = env!("CARGO_MANIFEST_DIR");
|
||||||
@ -11,10 +11,9 @@ use crate::{
|
|||||||
|
|
||||||
use shared::print_error_chain;
|
use shared::print_error_chain;
|
||||||
|
|
||||||
|
use crate::PROJECT_PATH;
|
||||||
static BINCODE_CONFIG: Configuration = bincode::config::standard();
|
static BINCODE_CONFIG: Configuration = bincode::config::standard();
|
||||||
|
|
||||||
const DB_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/database");
|
|
||||||
|
|
||||||
const DB_TREE: &str = "blocks";
|
const DB_TREE: &str = "blocks";
|
||||||
|
|
||||||
const BLOCK_PREFIX: [u8; 7] = *b"blocks:";
|
const BLOCK_PREFIX: [u8; 7] = *b"blocks:";
|
||||||
@ -47,7 +46,7 @@ impl ChainDb {
|
|||||||
let path = if path.is_some() {
|
let path = if path.is_some() {
|
||||||
&path.unwrap()
|
&path.unwrap()
|
||||||
} else {
|
} else {
|
||||||
DB_PATH
|
&format!("{}/{}", PROJECT_PATH, "database")
|
||||||
};
|
};
|
||||||
let config = sled::Config::new()
|
let config = sled::Config::new()
|
||||||
.cache_capacity(512 * 1024)
|
.cache_capacity(512 * 1024)
|
||||||
|
|||||||
@ -9,6 +9,9 @@ pub mod node {
|
|||||||
pub use blockchain::*;
|
pub use blockchain::*;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub mod constants;
|
||||||
|
pub use constants::*;
|
||||||
|
|
||||||
pub mod cli;
|
pub mod cli;
|
||||||
|
|
||||||
pub mod api {
|
pub mod api {
|
||||||
|
|||||||
@ -473,6 +473,10 @@ impl Node {
|
|||||||
.await;
|
.await;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
tokio::spawn(async move {
|
||||||
|
let _ = crate::api::server::start_server();
|
||||||
|
});
|
||||||
|
|
||||||
let mut system_rx = subscribe_system_event();
|
let mut system_rx = subscribe_system_event();
|
||||||
publish_system_event(SystemEvent::NodeStarted);
|
publish_system_event(SystemEvent::NodeStarted);
|
||||||
|
|
||||||
|
|||||||
12
node/static/404.html
Normal file
12
node/static/404.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title></title>
|
||||||
|
<link href="css/style.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>404 - Not Found</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
21
node/static/app.js
Normal file
21
node/static/app.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
const API_URL='http://localhost:6080/api/';
|
||||||
|
|
||||||
|
const connection = {
|
||||||
|
ws: [],
|
||||||
|
node_list: [],
|
||||||
|
}
|
||||||
|
|
||||||
|
function establishConnection() {
|
||||||
|
const ws = new WebSocket('ws://localhost:6000');
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateTableStats() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getTableContent() {
|
||||||
|
let response = await fetch(API_URL + "get_table");
|
||||||
|
let content = await response.json()
|
||||||
|
|
||||||
|
console.log(content);
|
||||||
|
}
|
||||||
@ -11,13 +11,8 @@
|
|||||||
<h1>Node Stats</h1>
|
<h1>Node Stats</h1>
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<table style="box-sizing: border-box; max-height: 100%; width: 100%; table-layout: fixed; border-collapse: collapse;" id='stat-table' >
|
<table style="box-sizing: border-box; max-height: 100%; width: 100%; table-layout: fixed; border-collapse: collapse;" id='stat-table' >
|
||||||
<thead>
|
<thead id="stat-table-head">
|
||||||
<tr style="border-bottom: 1px solid black;">
|
<tr style="border-bottom: 1px solid black;">
|
||||||
<th>stat 1</th>
|
|
||||||
<th>stat 2</th>
|
|
||||||
<th>stat 3</th>
|
|
||||||
<th>stat 4</th>
|
|
||||||
<th>stat 5</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody style="box-sizing: border-box; max-height: 100%; overflow-y: scroll;" id='stat-table-body'>
|
<tbody style="box-sizing: border-box; max-height: 100%; overflow-y: scroll;" id='stat-table-body'>
|
||||||
@ -27,6 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<script src="/app.js" ></script>
|
<script src="/app.js" ></script>
|
||||||
<script>
|
<script>
|
||||||
|
await getTableContent();
|
||||||
const table = document.getElementById('stat-table-body');
|
const table = document.getElementById('stat-table-body');
|
||||||
for (var i = 0; i < 30; i++)
|
for (var i = 0; i < 30; i++)
|
||||||
{
|
{
|
||||||
0
node/static/style.css
Normal file
0
node/static/style.css
Normal file
@ -1,12 +0,0 @@
|
|||||||
const connection = {
|
|
||||||
ws: [],
|
|
||||||
node_list: [],
|
|
||||||
}
|
|
||||||
|
|
||||||
function establishConnection() {
|
|
||||||
const ws = new WebSocket('ws://localhost:6000');
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateTableStats() {
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user