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] [package]
name = "mediarepo-api" name = "mediarepo-api"
version = "0.31.0" version = "0.32.0"
edition = "2018" edition = "2018"
license = "gpl-3" license = "gpl-3"
@ -9,7 +9,7 @@ license = "gpl-3"
[dependencies] [dependencies]
tracing = "0.1.32" tracing = "0.1.32"
thiserror = "1.0.30" 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 } parking_lot = { version = "0.12.0", optional = true }
serde_json = { version = "1.0.79", optional = true } serde_json = { version = "1.0.79", optional = true }
directories = { version = "4.0.1", 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 } pathsearch = { version = "0.2.0", optional = true }
[dependencies.bromine] [dependencies.bromine]
version = "0.19.0" version = "0.20.1"
optional = true optional = true
features = ["serialize_bincode"] features = ["serialize_bincode", "encryption_layer"]
[dependencies.serde] [dependencies.serde]
version = "1.0.136" version = "1.0.136"

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

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

File diff suppressed because it is too large Load Diff

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

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

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

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

@ -3,6 +3,7 @@ use std::net::SocketAddr;
use tokio::net::TcpListener; use tokio::net::TcpListener;
use tokio::task::JoinHandle; use tokio::task::JoinHandle;
use crate::encrypted::EncryptedListener;
use mediarepo_core::bromine::prelude::*; use mediarepo_core::bromine::prelude::*;
use mediarepo_core::error::{RepoError, RepoResult}; use mediarepo_core::error::{RepoError, RepoResult};
use mediarepo_core::mediarepo_api::types::misc::InfoResponse; use mediarepo_core::mediarepo_api::types::misc::InfoResponse;
@ -39,7 +40,7 @@ pub fn start_tcp_server(
let join_handle = tokio::task::Builder::new() let join_handle = tokio::task::Builder::new()
.name("mediarepo_tcp::listen") .name("mediarepo_tcp::listen")
.spawn(async move { .spawn(async move {
get_builder::<TcpListener>(address) get_builder::<EncryptedListener<TcpListener>>(address)
.insert::<SubsystemKey>(subsystem) .insert::<SubsystemKey>(subsystem)
.insert_all(shared_data) .insert_all(shared_data)
.insert::<SizeMetadataKey>(Default::default()) .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 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
async-trait = "0.1.52" async-trait = "0.1.53"
tracing = "0.1.32" tracing = "0.1.32"
[dependencies.mediarepo-core] [dependencies.mediarepo-core]

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

@ -14,7 +14,8 @@ pub mod status_utils;
pub async fn start(top_level: Toplevel, repo: Repo) -> (Toplevel, JobDispatcher) { pub async fn start(top_level: Toplevel, repo: Repo) -> (Toplevel, JobDispatcher) {
let (tx, rx) = channel(); 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); let dispatcher = JobDispatcher::new(subsystem, repo);
tx.send(dispatcher.clone()) tx.send(dispatcher.clone())
.map_err(|_| RepoError::from("failed to send dispatcher"))?; .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), SendSyncTypeMap::from_iter(shared_data),
) )
.await?; .await?;
Ok(()) RepoResult::Ok(())
}) })
}) })
} }
@ -144,7 +144,7 @@ async fn start_server(opt: Opt, settings: Settings) -> RepoResult<()> {
) )
.await?; .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 = [] } tauri-build = { version = "1.0.0-rc.4", features = [] }
[dependencies] [dependencies]
serde_json = "1.0.78" serde_json = "1.0.79"
serde = { version = "1.0.136", features = ["derive"] } serde = { version = "1.0.136", features = ["derive"] }
thiserror = "1.0.30" thiserror = "1.0.30"
typemap_rev = "0.1.5" typemap_rev = "0.1.5"
@ -23,7 +23,7 @@ version = "1.0.0-rc.4"
features = ["dialog-all", "path-all", "shell-all"] features = ["dialog-all", "path-all", "shell-all"]
[dependencies.tracing-subscriber] [dependencies.tracing-subscriber]
version = "0.3.8" version = "0.3.9"
features = ["env-filter"] features = ["env-filter"]
[dependencies.mediarepo-api] [dependencies.mediarepo-api]

Loading…
Cancel
Save