Update dependencies

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/22/head
trivernis 3 years ago
parent 1047320c7c
commit 78e1f26a8b
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -1,6 +1,6 @@
[package]
name = "mediarepo-api"
version = "0.31.0"
version = "0.32.0"
edition = "2018"
license = "gpl-3"
@ -9,7 +9,7 @@ license = "gpl-3"
[dependencies]
tracing = "0.1.32"
thiserror = "1.0.30"
async-trait = { version = "0.1.52", optional = true }
async-trait = { version = "0.1.53", optional = true }
parking_lot = { version = "0.12.0", optional = true }
serde_json = { version = "1.0.79", optional = true }
directories = { version = "4.0.1", optional = true }
@ -20,9 +20,9 @@ url = { version = "2.2.2", optional = true }
pathsearch = { version = "0.2.0", optional = true }
[dependencies.bromine]
version = "0.19.0"
version = "0.20.1"
optional = true
features = ["serialize_bincode"]
features = ["serialize_bincode", "encryption_layer"]
[dependencies.serde]
version = "1.0.136"

@ -1,6 +1,8 @@
use async_trait::async_trait;
use bromine::error::Result;
use bromine::prelude::encrypted::{EncryptedStream, EncryptionOptions};
use bromine::prelude::IPCResult;
use bromine::protocol::encrypted::EncryptedListener;
use bromine::protocol::*;
use std::io::Error;
use std::net::ToSocketAddrs;
@ -9,12 +11,11 @@ use std::task::{Context, Poll};
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tokio::net::{TcpListener, TcpStream};
#[derive(Debug)]
pub enum ApiProtocolListener {
#[cfg(unix)]
UnixSocket(tokio::net::UnixListener),
Tcp(TcpListener),
Tcp(EncryptedListener<TcpListener>),
}
unsafe impl Send for ApiProtocolListener {}
@ -25,12 +26,14 @@ impl AsyncStreamProtocolListener for ApiProtocolListener {
type AddressType = String;
type RemoteAddressType = String;
type Stream = ApiProtocolStream;
type ListenerOptions = ();
#[tracing::instrument]
async fn protocol_bind(address: Self::AddressType) -> Result<Self> {
async fn protocol_bind(address: Self::AddressType, _: Self::ListenerOptions) -> Result<Self> {
if let Some(addr) = address.to_socket_addrs().ok().and_then(|mut a| a.next()) {
let listener = TcpListener::bind(addr).await?;
tracing::info!("Connecting via TCP");
let listener =
EncryptedListener::protocol_bind(addr, EncryptionOptions::default()).await?;
tracing::info!("Connecting via encrypted TCP");
Ok(Self::Tcp(listener))
} else {
@ -67,19 +70,18 @@ impl AsyncStreamProtocolListener for ApiProtocolListener {
))
}
ApiProtocolListener::Tcp(listener) => {
let (stream, addr) = listener.accept().await?;
let (stream, addr) = listener.protocol_accept().await?;
Ok((ApiProtocolStream::Tcp(stream), addr.to_string()))
}
}
}
}
#[derive(Debug)]
pub enum ApiProtocolStream {
#[cfg(unix)]
UnixSocket(tokio::net::UnixStream),
Tcp(TcpStream),
Tcp(EncryptedStream<TcpStream>),
}
unsafe impl Send for ApiProtocolStream {}
@ -97,7 +99,7 @@ impl AsyncProtocolStreamSplit for ApiProtocolStream {
(Box::new(read), Box::new(write))
}
ApiProtocolStream::Tcp(stream) => {
let (read, write) = stream.into_split();
let (read, write) = stream.protocol_into_split();
(Box::new(read), Box::new(write))
}
}
@ -107,10 +109,15 @@ impl AsyncProtocolStreamSplit for ApiProtocolStream {
#[async_trait]
impl AsyncProtocolStream for ApiProtocolStream {
type AddressType = String;
type StreamOptions = ();
async fn protocol_connect(address: Self::AddressType) -> IPCResult<Self> {
async fn protocol_connect(
address: Self::AddressType,
_: Self::StreamOptions,
) -> IPCResult<Self> {
if let Some(addr) = address.to_socket_addrs().ok().and_then(|mut a| a.next()) {
let stream = TcpStream::connect(addr).await?;
let stream =
EncryptedStream::protocol_connect(addr, EncryptionOptions::default()).await?;
Ok(Self::Tcp(stream))
} else {
#[cfg(unix)]

@ -2,6 +2,7 @@ use crate::daemon_management::find_daemon_executable;
use crate::tauri_plugin::commands::AppAccess;
use crate::tauri_plugin::error::PluginResult;
use crate::tauri_plugin::settings::save_settings;
use bromine::prelude::encrypted::EncryptedListener;
use bromine::prelude::{IPCError, IPCResult};
use bromine::IPCBuilder;
use std::io::ErrorKind;
@ -53,7 +54,7 @@ pub async fn check_daemon_running(address: String) -> PluginResult<bool> {
async fn try_connect_daemon(address: String) -> IPCResult<()> {
let address = get_socket_address(address)?;
let ctx = IPCBuilder::<TcpListener>::new()
let ctx = IPCBuilder::<EncryptedListener<TcpListener>>::new()
.address(address)
.build_client()
.await?;

File diff suppressed because it is too large Load Diff

@ -21,12 +21,12 @@ toml = "0.5.8"
structopt = "0.3.26"
glob = "0.3.0"
tracing-flame = "0.2.0"
tracing-appender = "0.2.1"
tracing-appender = "0.2.2"
tracing-log = "0.1.2"
rolling-file = "0.1.0"
num-integer = "0.1.44"
console-subscriber = "0.1.3"
log = "0.4.14"
log = "0.4.16"
opentelemetry = { version = "0.17.0", features = ["rt-tokio"] }
opentelemetry-jaeger = { version = "0.16.0", features = ["rt-tokio"] }
tracing-opentelemetry = "0.17.2"

@ -18,14 +18,14 @@ itertools = "0.10.3"
glob = "0.3.0"
tracing = "0.1.32"
data-encoding = "2.3.2"
tokio-graceful-shutdown = "0.4.4"
tokio-graceful-shutdown = "0.5.0"
thumbnailer = "0.4.0"
bincode = "1.3.3"
tracing-subscriber = "0.3.9"
trait-bound-typemap = "0.3.3"
[dependencies.sea-orm]
version = "0.6.0"
version = "0.7.1"
default-features = false
[dependencies.sqlx]

@ -18,6 +18,6 @@ version = "0.5.11"
features = ["migrate"]
[dependencies.sea-orm]
version = "0.6.0"
version = "0.7.1"
features = ["sqlx-sqlite", "runtime-tokio-native-tls", "macros"]
default-features = false

@ -12,7 +12,7 @@ serde = "1.0.136"
mime_guess = "2.0.4"
mime = "0.3.16"
tracing = "0.1.32"
async-trait = "0.1.52"
async-trait = "0.1.53"
[dependencies.mediarepo-core]
path = "../mediarepo-core"
@ -21,7 +21,7 @@ path = "../mediarepo-core"
path = "../mediarepo-database"
[dependencies.sea-orm]
version = "0.6.0"
version = "0.7.1"
features = ["runtime-tokio-native-tls", "macros"]
default-features = false

@ -3,6 +3,7 @@ use std::net::SocketAddr;
use tokio::net::TcpListener;
use tokio::task::JoinHandle;
use crate::encrypted::EncryptedListener;
use mediarepo_core::bromine::prelude::*;
use mediarepo_core::error::{RepoError, RepoResult};
use mediarepo_core::mediarepo_api::types::misc::InfoResponse;
@ -39,7 +40,7 @@ pub fn start_tcp_server(
let join_handle = tokio::task::Builder::new()
.name("mediarepo_tcp::listen")
.spawn(async move {
get_builder::<TcpListener>(address)
get_builder::<EncryptedListener<TcpListener>>(address)
.insert::<SubsystemKey>(subsystem)
.insert_all(shared_data)
.insert::<SizeMetadataKey>(Default::default())

@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
async-trait = "0.1.52"
async-trait = "0.1.53"
tracing = "0.1.32"
[dependencies.mediarepo-core]

@ -1,5 +1,6 @@
use crate::handle::{CloneableReceiver, JobHandle, JobState};
use crate::jobs::{Job, JobTypeKey};
use mediarepo_core::error::RepoError;
use mediarepo_core::tokio_graceful_shutdown::SubsystemHandle;
use mediarepo_core::trait_bound_typemap::{SendSyncTypeMap, TypeMap, TypeMapKey};
use mediarepo_logic::dao::repo::Repo;
@ -48,11 +49,12 @@ impl JobDispatcher {
let state = Arc::new(RwLock::new(JobState::Queued));
let (sender, mut receiver) = channel(1);
self.subsystem
.start("channel-consumer", move |subsystem| async move {
.start::<RepoError, _, _>("channel-consumer", move |subsystem| async move {
tokio::select! {
_ = receiver.recv() => (),
_ = subsystem.on_shutdown_requested() => (),
}
Ok(())
});
let receiver = CloneableReceiver::new(sender.clone());
@ -62,7 +64,7 @@ impl JobDispatcher {
let repo = self.repo.clone();
self.subsystem
.start("worker-job", move |subsystem| async move {
.start::<RepoError, _, _>("worker-job", move |subsystem| async move {
loop {
let start = Instant::now();
let job_2 = job.clone();

@ -14,7 +14,8 @@ pub mod status_utils;
pub async fn start(top_level: Toplevel, repo: Repo) -> (Toplevel, JobDispatcher) {
let (tx, rx) = channel();
let top_level = top_level.start("mediarepo-worker", |subsystem| async move {
let top_level =
top_level.start::<RepoError, _, _>("mediarepo-worker", |subsystem| async move {
let dispatcher = JobDispatcher::new(subsystem, repo);
tx.send(dispatcher.clone())
.map_err(|_| RepoError::from("failed to send dispatcher"))?;

@ -127,7 +127,7 @@ async fn start_server(opt: Opt, settings: Settings) -> RepoResult<()> {
SendSyncTypeMap::from_iter(shared_data),
)
.await?;
Ok(())
RepoResult::Ok(())
})
})
}
@ -144,7 +144,7 @@ async fn start_server(opt: Opt, settings: Settings) -> RepoResult<()> {
)
.await?;
Ok(())
RepoResult::Ok(())
})
})
}

File diff suppressed because it is too large Load Diff

@ -13,7 +13,7 @@ build = "src/build.rs"
tauri-build = { version = "1.0.0-rc.4", features = [] }
[dependencies]
serde_json = "1.0.78"
serde_json = "1.0.79"
serde = { version = "1.0.136", features = ["derive"] }
thiserror = "1.0.30"
typemap_rev = "0.1.5"
@ -23,7 +23,7 @@ version = "1.0.0-rc.4"
features = ["dialog-all", "path-all", "shell-all"]
[dependencies.tracing-subscriber]
version = "0.3.8"
version = "0.3.9"
features = ["env-filter"]
[dependencies.mediarepo-api]

Loading…
Cancel
Save