added more support for supabase-js

This commit is contained in:
2026-03-12 10:18:52 +02:00
parent c0792f2e1d
commit 6708cf28a7
62 changed files with 6563 additions and 526 deletions

View File

@@ -1,9 +1,10 @@
pub mod handlers;
pub mod tus;
use aws_config::BehaviorVersion;
use aws_sdk_s3::config::Credentials;
use aws_sdk_s3::{config::Region, Client};
use axum::{extract::DefaultBodyLimit, routing::{get, post}, Router};
use axum::{extract::DefaultBodyLimit, routing::{get, post, patch}, Router};
use common::Config;
use handlers::StorageState;
use sqlx::PgPool;
@@ -52,9 +53,20 @@ pub async fn init(db: PgPool, config: Config) -> Router {
.route("/bucket", get(handlers::list_buckets))
.route("/object/list/:bucket_id", post(handlers::list_objects))
.route(
"/object/:bucket_id/:filename",
"/object/sign/:bucket_id/*filename",
post(handlers::sign_object).get(handlers::get_signed_object),
)
.route(
"/object/:bucket_id/*filename",
get(handlers::download_object).post(handlers::upload_object),
)
.layer(DefaultBodyLimit::max(10 * 1024 * 1024)) // 10MB limit
// TUS Resumable Uploads
.route("/upload/resumable", post(tus::tus_create_upload).options(tus::tus_options))
.route("/upload/resumable/:upload_id",
patch(tus::tus_patch_upload)
.head(tus::tus_head_upload)
.options(tus::tus_options)
)
.layer(DefaultBodyLimit::max(1024 * 1024 * 1024)) // 1GB limit for TUS
.with_state(state)
}