From 1d8925441354ff93cf84ca1b4a7c0b2f3a7ce5cb Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Tue, 3 Oct 2023 20:18:41 -0400 Subject: [PATCH 1/3] Set up the file service packaging script Improve the dist script --- file-service/Cargo.toml | 6 +----- file-service/dist.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) create mode 100755 file-service/dist.sh diff --git a/file-service/Cargo.toml b/file-service/Cargo.toml index 8238be0..3be7912 100644 --- a/file-service/Cargo.toml +++ b/file-service/Cargo.toml @@ -6,9 +6,6 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[features] -auth-cli = [ "clap" ] - [lib] name = "file_service" path = "src/lib.rs" @@ -20,7 +17,6 @@ path = "src/main.rs" [[bin]] name = "auth-cli" path = "src/bin/cli.rs" -required-features = [ "auth-cli" ] [target.auth-cli.dependencies] @@ -29,7 +25,7 @@ base64ct = { version = "1", features = [ "alloc" ] } build_html = { version = "2" } bytes = { version = "1" } chrono = { version = "0.4", features = ["serde"] } -clap = { version = "4", features = [ "derive" ], optional = true } +clap = { version = "4", features = [ "derive" ] } cookie = { version = "0.17" } futures-util = { version = "0.3" } hex-string = "0.1.0" diff --git a/file-service/dist.sh b/file-service/dist.sh new file mode 100755 index 0000000..56acf95 --- /dev/null +++ b/file-service/dist.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -euo pipefail + +VERSION=`cat Cargo.toml | grep "^version =" | sed -r 's/^version = "(.+)"$/\1/'` + +mkdir -p dist +cp ../target/release/file-service dist +cp ../target/release/auth-cli dist +strip dist/file-service +strip dist/auth-cli +tar -cf file-service-${VERSION}.tar.gz dist/ + -- 2.44.1 From d4a5e0f55d6743f0b5b957f2f5a4a052c6c7f403 Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Wed, 4 Oct 2023 13:15:16 -0400 Subject: [PATCH 2/3] Serve the original file with the main path instead of the thumbnail --- file-service/src/handlers.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/file-service/src/handlers.rs b/file-service/src/handlers.rs index afc0cbd..2e75bf1 100644 --- a/file-service/src/handlers.rs +++ b/file-service/src/handlers.rs @@ -68,7 +68,7 @@ pub async fn file( old_etags: Option, ) -> Result>, Error> { match app.get_file(&FileId::from(id)).await { - Ok(file) => serve_file(file.info.clone(), || file.thumbnail(), old_etags), + Ok(file) => serve_file(file.info.clone(), || file.content(), old_etags), Err(_err) => Response::builder() .status(StatusCode::NOT_FOUND) .body(vec![]), -- 2.44.1 From 525b5389a1cf4cc2069448d71a2b0f3958346ae5 Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Wed, 4 Oct 2023 14:47:30 -0400 Subject: [PATCH 3/3] add .tar.gz to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f8e5e3f..6c435be 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ node_modules dist result *.tgz +*.tar.gz file-service/*.sqlite file-service/*.sqlite-shm file-service/*.sqlite-wal -- 2.44.1