Skip to content

Commit

Permalink
⚡ Refactor thumbnail generation and scanner IO operations (#426)
Browse files Browse the repository at this point in the history
* ⚡ Refactor thumbnail generation

* ⚡ Refactor scanner IO operations

Push up last nights changes

* debug: push to new tag for testing

* async-ify IO operations outside scan context

* debug: add tracing

* wip: rename library options and add fields

requires migration still

* wip: rename library options, fix frontend

* handwrite migration 😬

* fix ui

* NON FUNCTIONAL: wip migration

kill me

* debug: stop auto pushing

* fix migration?

* wip: support processing options and restructure

* 🥪 lunch allocator experiment

* super wip: distroless image, zip downgrade

* cleanup docker stuff

* Revert "debug: stop auto pushing"

This reverts commit bd6da98.

* remove missed feature

* fix job upsert after refresh

* cleanup comments and wip review

* Reapply "debug: stop auto pushing"

This reverts commit f43c187.

* cleanup
  • Loading branch information
aaronleopold authored Sep 8, 2024
1 parent 7892459 commit 5f9871b
Show file tree
Hide file tree
Showing 79 changed files with 1,936 additions and 1,234 deletions.
1 change: 0 additions & 1 deletion apps/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,3 @@ openssl = { version = "0.10.61", features = ["vendored"] }

[target.x86_64-unknown-linux-musl.dependencies]
openssl = { version = "0.10.61", features = ["vendored"] }

11 changes: 10 additions & 1 deletion apps/server/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ use prisma_client_rust::{
};
use stump_core::{
error::CoreError,
filesystem::{image::ProcessorError, FileError},
filesystem::{
image::{ProcessorError, ThumbnailGenerateError},
FileError,
},
job::error::JobManagerError,
opds::v2_0::OPDSV2Error,
CoreEvent,
Expand Down Expand Up @@ -178,6 +181,12 @@ impl From<reqwest::Error> for APIError {
}
}

impl From<ThumbnailGenerateError> for APIError {
fn from(value: ThumbnailGenerateError) -> Self {
APIError::InternalServerError(value.to_string())
}
}

impl APIError {
pub fn forbidden_discreet() -> APIError {
APIError::Forbidden(String::from(
Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/http_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ use stump_core::config::StumpConfig;
pub async fn run_http_server(config: StumpConfig) -> ServerResult<()> {
let core = StumpCore::new(config.clone()).await;

if let Err(err) = core.run_migrations().await {
tracing::error!("Failed to run migrations: {:?}", err);
return Err(ServerError::ServerStartError(err.to_string()));
if let Err(error) = core.run_migrations().await {
tracing::error!(?error, "Failed to run migrations");
return Err(ServerError::ServerStartError(error.to_string()));
}

core.get_job_controller()
Expand Down
5 changes: 3 additions & 2 deletions apps/server/src/routers/api/v1/emailer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ use stump_core::{
AttachmentMeta, EmailerConfig, EmailerConfigInput, EmailerSendRecord,
EmailerSendTo, Media, RegisteredEmailDevice, SMTPEmailer, User, UserPermission,
},
filesystem::{read_entire_file, ContentType, FileParts, PathUtils},
filesystem::{ContentType, FileParts, PathUtils},
prisma::{emailer, emailer_send_record, registered_email_device, user, PrismaClient},
AttachmentPayload, EmailContentType,
};
use tokio::fs;
use utoipa::ToSchema;

use crate::{
Expand Down Expand Up @@ -517,7 +518,7 @@ async fn send_attachment_email(
extension,
..
} = PathBuf::from(&book.path).file_parts();
let content = read_entire_file(book.path)?;
let content = fs::read(book.path).await?;

// TODO: should error?
match (content.len(), max_attachment_size_bytes) {
Expand Down
Loading

0 comments on commit 5f9871b

Please sign in to comment.