@@ -1,6 +1,6 @@
|
||||
#[cfg(feature = "blurhashing")]
|
||||
use conduwuit::config::BlurhashConfig as CoreBlurhashConfig;
|
||||
use conduwuit::{Result, implement};
|
||||
use tuwunel_core::config::BlurhashConfig as CoreBlurhashConfig;
|
||||
use tuwunel_core::{Result, implement};
|
||||
|
||||
use super::Service;
|
||||
|
||||
@@ -12,7 +12,7 @@ pub fn create_blurhash(
|
||||
_content_type: Option<&str>,
|
||||
_file_name: Option<&str>,
|
||||
) -> Result<Option<String>> {
|
||||
conduwuit::debug_warn!("blurhashing on upload support was not compiled");
|
||||
tuwunel_core::debug_warn!("blurhashing on upload support was not compiled");
|
||||
|
||||
Ok(None)
|
||||
}
|
||||
@@ -33,7 +33,7 @@ pub fn create_blurhash(
|
||||
}
|
||||
|
||||
get_blurhash_from_request(file, content_type, file_name, config)
|
||||
.map_err(|e| conduwuit::err!(debug_error!("blurhashing error: {e}")))
|
||||
.map_err(|e| tuwunel_core::err!(debug_error!("blurhashing error: {e}")))
|
||||
.map(Some)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
use conduwuit::{
|
||||
use futures::StreamExt;
|
||||
use ruma::{Mxc, OwnedMxcUri, UserId, http_headers::ContentDisposition};
|
||||
use tuwunel_core::{
|
||||
Err, Result, debug, debug_info, err,
|
||||
utils::{ReadyExt, str_from_bytes, stream::TryIgnore, string_from_bytes},
|
||||
};
|
||||
use database::{Database, Interfix, Map};
|
||||
use futures::StreamExt;
|
||||
use ruma::{Mxc, OwnedMxcUri, UserId, http_headers::ContentDisposition};
|
||||
use tuwunel_database::{Database, Interfix, Map, serialize_key};
|
||||
|
||||
use super::{preview::UrlPreviewData, thumbnail::Dim};
|
||||
|
||||
@@ -42,7 +42,7 @@ impl Data {
|
||||
) -> Result<Vec<u8>> {
|
||||
let dim: &[u32] = &[dim.width, dim.height];
|
||||
let key = (mxc, dim, content_disposition, content_type);
|
||||
let key = database::serialize_key(key)?;
|
||||
let key = serialize_key(key)?;
|
||||
self.mediaid_file.insert(&key, []);
|
||||
if let Some(user) = user {
|
||||
let key = (mxc, user);
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::{
|
||||
time::Instant,
|
||||
};
|
||||
|
||||
use conduwuit::{
|
||||
use tuwunel_core::{
|
||||
Config, Result, debug, debug_info, debug_warn, error, info,
|
||||
utils::{ReadyExt, stream::TryIgnore},
|
||||
warn,
|
||||
@@ -95,7 +95,7 @@ pub(crate) async fn checkup_sha256_media(services: &Services) -> Result<()> {
|
||||
}
|
||||
|
||||
async fn handle_media_check(
|
||||
dbs: &(&Arc<database::Map>, &Arc<database::Map>),
|
||||
dbs: &(&Arc<tuwunel_database::Map>, &Arc<tuwunel_database::Map>),
|
||||
config: &Config,
|
||||
files: &HashSet<OsString>,
|
||||
key: &[u8],
|
||||
|
||||
@@ -9,16 +9,16 @@ use std::{path::PathBuf, sync::Arc, time::SystemTime};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use base64::{Engine as _, engine::general_purpose};
|
||||
use conduwuit::{
|
||||
Err, Result, Server, debug, debug_error, debug_info, debug_warn, err, error, trace,
|
||||
utils::{self, MutexMap},
|
||||
warn,
|
||||
};
|
||||
use ruma::{Mxc, OwnedMxcUri, UserId, http_headers::ContentDisposition};
|
||||
use tokio::{
|
||||
fs,
|
||||
io::{AsyncReadExt, AsyncWriteExt, BufReader},
|
||||
};
|
||||
use tuwunel_core::{
|
||||
Err, Result, Server, debug, debug_error, debug_info, debug_warn, err, error, trace,
|
||||
utils::{self, MutexMap},
|
||||
warn,
|
||||
};
|
||||
|
||||
use self::data::{Data, Metadata};
|
||||
pub use self::thumbnail::Dim;
|
||||
|
||||
@@ -7,10 +7,9 @@
|
||||
|
||||
use std::time::SystemTime;
|
||||
|
||||
use conduwuit::{Err, Result, debug, err};
|
||||
use conduwuit_core::implement;
|
||||
use ipaddress::IPAddress;
|
||||
use serde::Serialize;
|
||||
use tuwunel_core::{Err, Result, debug, err, implement};
|
||||
use url::Url;
|
||||
|
||||
use super::Service;
|
||||
@@ -105,9 +104,9 @@ async fn request_url_preview(&self, url: &Url) -> Result<UrlPreviewData> {
|
||||
#[cfg(feature = "url_preview")]
|
||||
#[implement(Service)]
|
||||
pub async fn download_image(&self, url: &str) -> Result<UrlPreviewData> {
|
||||
use conduwuit::utils::random_string;
|
||||
use image::ImageReader;
|
||||
use ruma::Mxc;
|
||||
use tuwunel_core::utils::random_string;
|
||||
|
||||
let image = self.services.client.url_preview.get(url).send().await?;
|
||||
let image = image.bytes().await?;
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
use std::{fmt::Debug, time::Duration};
|
||||
|
||||
use conduwuit::{
|
||||
Err, Error, Result, debug_warn, err, implement,
|
||||
utils::content_disposition::make_content_disposition,
|
||||
};
|
||||
use http::header::{CONTENT_DISPOSITION, CONTENT_TYPE, HeaderValue};
|
||||
use ruma::{
|
||||
Mxc, ServerName, UserId,
|
||||
@@ -17,6 +13,10 @@ use ruma::{
|
||||
federation::authenticated_media::{Content, FileOrLocation},
|
||||
},
|
||||
};
|
||||
use tuwunel_core::{
|
||||
Err, Error, Result, debug_warn, err, implement,
|
||||
utils::content_disposition::make_content_disposition,
|
||||
};
|
||||
|
||||
use super::{Dim, FileMeta};
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
|
||||
use std::{cmp, num::Saturating as Sat};
|
||||
|
||||
use conduwuit::{Result, checked, err, implement};
|
||||
use ruma::{Mxc, UInt, UserId, http_headers::ContentDisposition, media::Method};
|
||||
use tokio::{
|
||||
fs,
|
||||
io::{AsyncReadExt, AsyncWriteExt},
|
||||
};
|
||||
use tuwunel_core::{Result, checked, err, implement};
|
||||
|
||||
use super::{FileMeta, data::Metadata};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user