feat(uploader): add ryzencdn local-disk uploader (POST multipart + GET serve)
Deploy Scraper / build-and-deploy (push) Canceled after 0s

Shirokami-API source uploads to Ryzumi S3 (s3.ryzumi.vip) which is DNS-dead
from this VPS. Implemented a local-disk uploader keeping the source's response
shape {success, url, fileName, size}:
- POST /uploader/ryzencdn (multipart 'file' field, magic-byte ext detection)
- GET /uploader/file/{name} (path-traversal safe, MIME by extension)
Files stored under /var/lib/scraper/uploads (owned by scraper user).
This commit is contained in:
asepharyana
2026-09-01 20:39:09 +07:00
parent 8d74d04b43
commit 2769b11918
7 changed files with 185 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
//! Application use-cases for the uploader.
use crate::domain::error::ScrapingError;
use crate::infrastructure::repository::uploader as Repo;
use serde_json::Value;
pub fn upload(buffer: &[u8], file_name: &str) -> Result<Value, ScrapingError> {
Repo::save_file(buffer, file_name).map_err(ScrapingError::Http)
}
pub fn serve(file_name: &str) -> Result<(Vec<u8>, String), ScrapingError> {
Repo::read_file(file_name).map_err(ScrapingError::Http)
}