Depedency bumps

This commit is contained in:
Antoine Gersant 2023-09-08 19:34:39 -07:00
parent 4807b2d3b9
commit 6f24ff248f
5 changed files with 645 additions and 407 deletions

1018
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -14,8 +14,8 @@ ui = ["native-windows-gui", "native-windows-derive"]
actix-files = { version = "0.6" }
actix-web = { version = "4" }
actix-web-httpauth = { version = "0.8" }
ape = "0.4.0"
base64 = "0.13"
ape = "0.5"
base64 = "0.21"
branca = "0.10.1"
crossbeam-channel = "0.5"
diesel_migrations = { version = "2.0", features = ["sqlite"] }
@ -24,7 +24,7 @@ getopts = "0.2.21"
http = "0.2.8"
id3 = "1.7.0"
lewton = "0.10.2"
libsqlite3-sys = { version = "0.25", features = [
libsqlite3-sys = { version = "0.26", features = [
"bundled",
"bundled-windows",
], optional = true }
@ -45,8 +45,8 @@ serde_derive = "1.0.147"
serde_json = "1.0.87"
simplelog = "0.12.0"
thiserror = "1.0.37"
toml = "0.5"
ureq = "1.5.5"
toml = "0.7"
ureq = "2.7"
url = "2.3"
[dependencies.diesel]
@ -70,7 +70,7 @@ native-windows-gui = { version = "1.0.13", default-features = false, features =
native-windows-derive = { version = "1.0.5", optional = true }
[target.'cfg(unix)'.dependencies]
daemonize = "0.4.1"
daemonize = "0.5"
sd-notify = "0.4.1"
[target.'cfg(windows)'.build-dependencies]

View file

@ -1,3 +1,4 @@
use base64::prelude::*;
use diesel::prelude::*;
use log::{debug, error};
use serde::{Deserialize, Serialize};
@ -12,6 +13,8 @@ const DDNS_UPDATE_URL: &str = "https://ydns.io/api/v1/update/";
pub enum Error {
#[error("DDNS update query failed with HTTP status code `{0}`")]
UpdateQueryFailed(u16),
#[error("DDNS update query failed due to a transport error")]
UpdateQueryTransport,
#[error(transparent)]
DatabaseConnection(#[from] db::Error),
#[error(transparent)]
@ -44,14 +47,18 @@ impl Manager {
}
let full_url = format!("{}?host={}", DDNS_UPDATE_URL, &config.host);
let credentials = format!("{}:{}", &config.username, &config.password);
let response = ureq::get(full_url.as_str())
.auth(&config.username, &config.password)
.set(
"Authorization",
&format!("Basic {}", BASE64_STANDARD_NO_PAD.encode(credentials)),
)
.call();
if response.ok() {
Ok(())
} else {
Err(Error::UpdateQueryFailed(response.status()))
match response {
Ok(_) => Ok(()),
Err(ureq::Error::Status(code, _)) => Err(Error::UpdateQueryFailed(code)),
Err(ureq::Error::Transport(_)) => Err(Error::UpdateQueryTransport),
}
}

View file

@ -12,6 +12,7 @@ use actix_web::{
FromRequest, HttpRequest, HttpResponse, Responder, ResponseError,
};
use actix_web_httpauth::extractors::bearer::BearerAuth;
use base64::prelude::*;
use futures_util::future::err;
use percent_encoding::percent_decode_str;
use std::future::Future;
@ -670,7 +671,8 @@ async fn lastfm_link(
let base64_content = percent_decode_str(&payload.content).decode_utf8_lossy();
// Base64 decode
let popup_content = base64::decode(base64_content.as_bytes())
let popup_content = BASE64_STANDARD_NO_PAD
.decode(base64_content.as_bytes())
.map_err(|_| APIError::LastFMLinkContentBase64DecodeError)?;
// UTF-8 decode

View file

@ -162,6 +162,7 @@ impl From<ddns::Error> for APIError {
ddns::Error::Database(e) => APIError::Database(e),
ddns::Error::DatabaseConnection(e) => e.into(),
ddns::Error::UpdateQueryFailed(s) => APIError::DdnsUpdateQueryFailed(s),
ddns::Error::UpdateQueryTransport => APIError::DdnsUpdateQueryFailed(0),
}
}
}