Compare commits
No commits in common. "84941e2cb4f8fed9e173d418bd0bb0ce02d5ee99" and "d3434e8408989fbed3b5b102448852dfbf1bbc98" have entirely different histories.
84941e2cb4
...
d3434e8408
3 changed files with 6 additions and 8 deletions
2
src/cache/disk.rs
vendored
2
src/cache/disk.rs
vendored
|
@ -42,7 +42,7 @@ impl DiskCache {
|
||||||
/// notifications when a file has been written.
|
/// notifications when a file has been written.
|
||||||
pub async fn new(disk_max_size: Bytes, disk_path: PathBuf) -> Arc<Self> {
|
pub async fn new(disk_max_size: Bytes, disk_path: PathBuf) -> Arc<Self> {
|
||||||
let db_pool = {
|
let db_pool = {
|
||||||
let db_url = format!("sqlite:{}/metadata.db", disk_path.to_string_lossy());
|
let db_url = format!("sqlite:{}/metadata.sqlite", disk_path.to_string_lossy());
|
||||||
let mut options = SqliteConnectOptions::from_str(&db_url)
|
let mut options = SqliteConnectOptions::from_str(&db_url)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.create_if_missing(true);
|
.create_if_missing(true);
|
||||||
|
|
|
@ -17,7 +17,7 @@ use crate::state::{
|
||||||
RwLockServerState, PREVIOUSLY_COMPROMISED, PREVIOUSLY_PAUSED, TLS_CERTS,
|
RwLockServerState, PREVIOUSLY_COMPROMISED, PREVIOUSLY_PAUSED, TLS_CERTS,
|
||||||
TLS_PREVIOUSLY_CREATED, TLS_SIGNING_KEY,
|
TLS_PREVIOUSLY_CREATED, TLS_SIGNING_KEY,
|
||||||
};
|
};
|
||||||
use crate::units::{Bytes, BytesPerSecond, Port};
|
use crate::units::{BytesPerSecond, Mebibytes, Port};
|
||||||
use crate::CLIENT_API_VERSION;
|
use crate::CLIENT_API_VERSION;
|
||||||
|
|
||||||
pub const CONTROL_CENTER_PING_URL: &str = "https://api.mangadex.network/ping";
|
pub const CONTROL_CENTER_PING_URL: &str = "https://api.mangadex.network/ping";
|
||||||
|
@ -26,7 +26,7 @@ pub const CONTROL_CENTER_PING_URL: &str = "https://api.mangadex.network/ping";
|
||||||
pub struct Request<'a> {
|
pub struct Request<'a> {
|
||||||
secret: &'a ClientSecret,
|
secret: &'a ClientSecret,
|
||||||
port: Port,
|
port: Port,
|
||||||
disk_space: Bytes,
|
disk_space: Mebibytes,
|
||||||
network_speed: BytesPerSecond,
|
network_speed: BytesPerSecond,
|
||||||
build_version: usize,
|
build_version: usize,
|
||||||
tls_created_at: Option<String>,
|
tls_created_at: Option<String>,
|
||||||
|
@ -41,7 +41,7 @@ impl<'a> Request<'a> {
|
||||||
.external_address
|
.external_address
|
||||||
.and_then(|v| Port::new(v.port()))
|
.and_then(|v| Port::new(v.port()))
|
||||||
.unwrap_or(config.port),
|
.unwrap_or(config.port),
|
||||||
disk_space: config.disk_quota.into(),
|
disk_space: config.disk_quota,
|
||||||
network_speed: config.network_speed.into(),
|
network_speed: config.network_speed.into(),
|
||||||
build_version: CLIENT_API_VERSION,
|
build_version: CLIENT_API_VERSION,
|
||||||
tls_created_at: TLS_PREVIOUSLY_CREATED
|
tls_created_at: TLS_PREVIOUSLY_CREATED
|
||||||
|
@ -60,7 +60,7 @@ impl<'a> From<(&'a ClientSecret, &Config)> for Request<'a> {
|
||||||
.external_address
|
.external_address
|
||||||
.and_then(|v| Port::new(v.port()))
|
.and_then(|v| Port::new(v.port()))
|
||||||
.unwrap_or(config.port),
|
.unwrap_or(config.port),
|
||||||
disk_space: config.disk_quota.into(),
|
disk_space: config.disk_quota,
|
||||||
network_speed: config.network_speed.into(),
|
network_speed: config.network_speed.into(),
|
||||||
build_version: CLIENT_API_VERSION,
|
build_version: CLIENT_API_VERSION,
|
||||||
tls_created_at: None,
|
tls_created_at: None,
|
||||||
|
@ -179,7 +179,6 @@ pub async fn update_server_state(
|
||||||
let req = Request::from_config_and_state(secret, cli);
|
let req = Request::from_config_and_state(secret, cli);
|
||||||
debug!("Sending ping request: {:?}", req);
|
debug!("Sending ping request: {:?}", req);
|
||||||
let client = reqwest::Client::new();
|
let client = reqwest::Client::new();
|
||||||
dbg!(serde_json::to_string(&req).unwrap());
|
|
||||||
let resp = client.post(CONTROL_CENTER_PING_URL).json(&req).send().await;
|
let resp = client.post(CONTROL_CENTER_PING_URL).json(&req).send().await;
|
||||||
match resp {
|
match resp {
|
||||||
Ok(resp) => match resp.json::<Response>().await {
|
Ok(resp) => match resp.json::<Response>().await {
|
||||||
|
|
|
@ -38,7 +38,7 @@ impl Display for Port {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Deserialize, Default, Debug, Hash, Eq, PartialEq)]
|
#[derive(Copy, Clone, Serialize, Deserialize, Default, Debug, Hash, Eq, PartialEq)]
|
||||||
pub struct Mebibytes(usize);
|
pub struct Mebibytes(usize);
|
||||||
|
|
||||||
impl Mebibytes {
|
impl Mebibytes {
|
||||||
|
@ -56,7 +56,6 @@ impl FromStr for Mebibytes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Debug)]
|
|
||||||
pub struct Bytes(pub usize);
|
pub struct Bytes(pub usize);
|
||||||
|
|
||||||
impl Bytes {
|
impl Bytes {
|
||||||
|
|
Loading…
Reference in a new issue