mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-14 23:28:36 -07:00
server: fix downloaded repo version path
This commit is contained in:
22
Cargo.lock
generated
22
Cargo.lock
generated
@@ -641,9 +641,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.2.17"
|
version = "1.2.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a"
|
checksum = "525046617d8376e3db1deffb079e91cef90a89fc3ca5c185bbf8c9ecdd15cd5c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jobserver",
|
"jobserver",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -907,9 +907,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ctrlc"
|
name = "ctrlc"
|
||||||
version = "3.4.5"
|
version = "3.4.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "90eeab0aa92f3f9b4e87f258c72b139c207d251f9cbc1080a0086b86a8870dd3"
|
checksum = "697b5419f348fd5ae2478e8018cb016c00a5881c7f46c717de98ffd135a5651c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"nix",
|
"nix",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.59.0",
|
||||||
@@ -1068,9 +1068,9 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "errno"
|
name = "errno"
|
||||||
version = "0.3.10"
|
version = "0.3.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.59.0",
|
||||||
@@ -1122,7 +1122,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece"
|
checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
"miniz_oxide 0.8.5",
|
"miniz_oxide 0.8.7",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1663,9 +1663,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miniz_oxide"
|
name = "miniz_oxide"
|
||||||
version = "0.8.5"
|
version = "0.8.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5"
|
checksum = "ff70ce3e48ae43fa075863cef62e8b43b71a4f2382229920e0df362592919430"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"adler2",
|
"adler2",
|
||||||
]
|
]
|
||||||
@@ -3522,9 +3522,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zip"
|
name = "zip"
|
||||||
version = "2.5.0"
|
version = "2.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "27c03817464f64e23f6f37574b4fdc8cf65925b5bfd2b0f2aedf959791941f88"
|
checksum = "febbe83a485467affa75a75d28dc7494acd2f819e549536c47d46b3089b56164"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes",
|
"aes",
|
||||||
"arbitrary",
|
"arbitrary",
|
||||||
|
|||||||
@@ -8,5 +8,5 @@ repository.workspace = true
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
brk_logger = { workspace = true }
|
brk_logger = { workspace = true }
|
||||||
ctrlc = { version = "3.4.5", features = ["termination"] }
|
ctrlc = { version = "3.4.6", features = ["termination"] }
|
||||||
log = { workspace = true }
|
log = { workspace = true }
|
||||||
|
|||||||
@@ -25,6 +25,6 @@ oxc = { version = "0.62.0", features = ["codegen", "minifier"] }
|
|||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
tokio = { version = "1.44.1", features = ["full"] }
|
tokio = { version = "1.44.1", features = ["full"] }
|
||||||
tower-http = { version = "0.6.2", features = ["compression-full", "trace"] }
|
tower-http = { version = "0.6.2", features = ["compression-full", "trace"] }
|
||||||
zip = "2.5.0"
|
zip = "2.6.0"
|
||||||
tracing = "0.1.41"
|
tracing = "0.1.41"
|
||||||
tracing-subscriber = "0.3.19"
|
tracing-subscriber = "0.3.19"
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ pub struct AppState {
|
|||||||
const DEV_PATH: &str = "../..";
|
const DEV_PATH: &str = "../..";
|
||||||
const DOWNLOADS: &str = "downloads";
|
const DOWNLOADS: &str = "downloads";
|
||||||
const WEBSITES: &str = "websites";
|
const WEBSITES: &str = "websites";
|
||||||
|
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
pub struct Server(AppState);
|
pub struct Server(AppState);
|
||||||
|
|
||||||
@@ -66,16 +67,14 @@ impl Server {
|
|||||||
} else {
|
} else {
|
||||||
let downloads_path = dot_brk_path().join(DOWNLOADS);
|
let downloads_path = dot_brk_path().join(DOWNLOADS);
|
||||||
|
|
||||||
let version = format!("v{}", env!("CARGO_PKG_VERSION"));
|
let downloaded_websites_path = downloads_path.join(VERSION).join(WEBSITES);
|
||||||
|
|
||||||
let downloaded_websites_path = downloads_path.join(&version).join(WEBSITES);
|
|
||||||
|
|
||||||
if !fs::exists(&downloaded_websites_path)? {
|
if !fs::exists(&downloaded_websites_path)? {
|
||||||
info!("Downloading websites from Github...");
|
info!("Downloading websites from Github...");
|
||||||
|
|
||||||
let url = format!(
|
let url = format!(
|
||||||
"https://github.com/bitcoinresearchkit/brk/archive/refs/tags/{}.zip",
|
"https://github.com/bitcoinresearchkit/brk/archive/refs/tags/{}.zip",
|
||||||
version
|
VERSION
|
||||||
);
|
);
|
||||||
|
|
||||||
let response = minreq::get(url).send()?;
|
let response = minreq::get(url).send()?;
|
||||||
@@ -150,7 +149,7 @@ impl Server {
|
|||||||
let router = Router::new()
|
let router = Router::new()
|
||||||
.add_api_routes()
|
.add_api_routes()
|
||||||
.add_website_routes(state.website)
|
.add_website_routes(state.website)
|
||||||
.route("/version", get(Json(env!("CARGO_PKG_VERSION"))))
|
.route("/version", get(Json(VERSION)))
|
||||||
.with_state(state)
|
.with_state(state)
|
||||||
.layer(compression_layer)
|
.layer(compression_layer)
|
||||||
.layer(response_uri_layer)
|
.layer(response_uri_layer)
|
||||||
|
|||||||
Reference in New Issue
Block a user