From 1e39cbb0c558cdc95c4a59aab2e5b07b3c3ea7ab Mon Sep 17 00:00:00 2001 From: spinline Date: Sun, 8 Feb 2026 18:16:45 +0300 Subject: [PATCH] =?UTF-8?q?perf:=20backend=20binary=20boyutunu=20d=C3=BC?= =?UTF-8?q?=C5=9F=C3=BCrmek=20i=C3=A7in=20Swagger=20UI=20opsiyonel=20yap?= =?UTF-8?q?=C4=B1ld=C4=B1=20ve=20build=20komutu=20optimize=20edildi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build-mips.yml | 3 ++- backend/Cargo.toml | 3 ++- backend/src/main.rs | 13 ++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/build-mips.yml b/.gitea/workflows/build-mips.yml index a6d5956..499ed32 100644 --- a/.gitea/workflows/build-mips.yml +++ b/.gitea/workflows/build-mips.yml @@ -48,7 +48,8 @@ jobs: CFLAGS_mips_unknown_linux_musl: "-msoft-float" run: | # Kök dizinden derleyerek workspace profil ayarlarının (LTO, z, strip) uygulanmasını sağlıyoruz - cargo zigbuild -p backend --target mips-unknown-linux-musl --release -Z build-std=std,panic_abort + # Sadece push-notifications özelliğini aktif ediyoruz (swagger UI kapanır, boyut düşer) + cargo zigbuild -p backend --target mips-unknown-linux-musl --release -Z build-std=std,panic_abort --no-default-features --features push-notifications file target/mips-unknown-linux-musl/release/backend - name: Rename Binary diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 61c13ca..67316a0 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [features] default = ["push-notifications"] push-notifications = ["web-push", "openssl"] +swagger = ["utoipa-swagger-ui"] [dependencies] axum = { version = "0.8", features = ["macros", "ws"] } @@ -29,7 +30,7 @@ shared = { path = "../shared" } thiserror = "2.0.18" dotenvy = "0.15.7" utoipa = { version = "5.4.0", features = ["axum_extras"] } -utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] } +utoipa-swagger-ui = { version = "9.0.2", features = ["axum"], optional = true } web-push = { version = "0.10", default-features = false, features = ["hyper-client"], optional = true } base64 = "0.22" openssl = { version = "0.10", features = ["vendored"], optional = true } diff --git a/backend/src/main.rs b/backend/src/main.rs index 5bd9a53..876414a 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -33,6 +33,7 @@ use tower_http::{ trace::TraceLayer, }; use utoipa::OpenApi; +#[cfg(feature = "swagger")] use utoipa_swagger_ui::SwaggerUi; #[derive(Clone)] @@ -98,6 +99,7 @@ struct Args { reset_password: Option, } +#[cfg(feature = "swagger")] #[cfg(feature = "push-notifications")] #[derive(OpenApi)] #[openapi( @@ -146,6 +148,7 @@ struct Args { )] struct ApiDoc; +#[cfg(feature = "swagger")] #[cfg(not(feature = "push-notifications"))] #[derive(OpenApi)] #[openapi( @@ -462,9 +465,13 @@ async fn main() { } }); - let app = Router::new() - .merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi())) - // Setup & Auth Routes + let app = Router::new(); + + #[cfg(feature = "swagger")] + let app = app.merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi())); + + // Setup & Auth Routes + let app = app .route("/api/setup/status", get(handlers::setup::get_setup_status_handler)) .route("/api/setup", post(handlers::setup::setup_handler)) .route(