summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2024-11-14 21:43:54 +0000
committerLibravatar cel 🌸 <cel@blos.sm>2024-11-14 21:43:54 +0000
commit67b54449a1bbde257e9454419e7bb70ebc515c0f (patch)
treee23710c2d1f5d219205f26af727b478e455a0071 /src/main.rs
parent469a3ad33914f7eff6edc9ca7fabb12f2950da84 (diff)
downloadcritch-67b54449a1bbde257e9454419e7bb70ebc515c0f.tar.gz
critch-67b54449a1bbde257e9454419e7bb70ebc515c0f.tar.bz2
critch-67b54449a1bbde257e9454419e7bb70ebc515c0f.zip
implement artwork uploadHEADmain
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 93ab9d6..e0bf429 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,4 @@
+use poem::endpoint::StaticFilesEndpoint;
use poem::session::{CookieConfig, CookieSession};
use poem::web::cookie::CookieKey;
use poem::{delete, post, put, EndpointExt};
@@ -10,6 +11,7 @@ use critch::Critch;
#[tokio::main]
async fn main() -> Result<(), std::io::Error> {
let config = Config::from_file("./critch.toml").unwrap();
+ let uploads_dir = config.files_dir().to_owned();
let state = Critch::new(config).await;
let cookie_config = CookieConfig::private(CookieKey::generate());
@@ -47,6 +49,7 @@ async fn main() -> Result<(), std::io::Error> {
"/artworks/:artwork/comments",
post(routes::artworks::comments::post).delete(routes::artworks::comments::delete),
)
+ .nest("/uploads", StaticFilesEndpoint::new(uploads_dir))
.catch_all_error(routes::error::error)
.data(state)
.with(cookie_session);