pre-download static files, and add api versioning

This commit is contained in:
Aiden McClelland
2022-02-07 23:44:22 -07:00
committed by Aiden McClelland
parent 01d766fce9
commit d3c5648608
8 changed files with 171 additions and 115 deletions

View File

@@ -218,3 +218,18 @@ pub fn dir_size<'a, P: AsRef<Path> + 'a + Send + Sync>(
}
.boxed()
}
pub fn response_to_reader(response: reqwest::Response) -> impl AsyncRead + Unpin {
tokio_util::io::StreamReader::new(response.bytes_stream().map_err(|e| {
std::io::Error::new(
if e.is_connect() {
std::io::ErrorKind::ConnectionRefused
} else if e.is_timeout() {
std::io::ErrorKind::TimedOut
} else {
std::io::ErrorKind::Other
},
e,
)
}))
}

View File

@@ -122,7 +122,7 @@ impl EmbassyLogger {
let log_epoch = Arc::new(AtomicU64::new(rand::random()));
let sharing = Arc::new(AtomicBool::new(share_errors));
let share_dest = match share_dest {
None => "http://registry.privacy34kn4ez3y3nijweec6w4g54i3g54sdv7r5mr6soma3w4begyd.onion/support/error-logs".to_owned(),
None => "http://registry.privacy34kn4ez3y3nijweec6w4g54i3g54sdv7r5mr6soma3w4begyd.onion/support/v0/error-logs".to_owned(),
Some(a) => a.to_string(),
};
let tor_proxy = Client::builder()