From d2fcbb94384bfd346fba4a52af663caef0936cbd Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Mon, 19 Jan 2026 01:50:20 -0500 Subject: [PATCH] refactor legacy fy routes --- .../application_routes/add_application_routes.rs | 8 ++------ .../src/http_server/routes/application_routes/mod.rs | 2 -- .../routes/legacy_routes/add_legacy_routes.rs | 11 ++++++++--- .../src/http_server/routes/legacy_routes/mod.rs | 6 ++++-- .../tts_routes.rs | 0 .../voice_conversion_routes.rs | 0 crates/service/web/storyteller_web/src/main.rs | 4 ++++ .../web/storyteller_web/src/state/server_state.rs | 8 ++++++++ .../tauri-plugin-http/permissions/schemas/schema.json | 4 ++-- 9 files changed, 28 insertions(+), 15 deletions(-) rename crates/service/web/storyteller_web/src/http_server/routes/{application_routes => legacy_routes}/tts_routes.rs (100%) rename crates/service/web/storyteller_web/src/http_server/routes/{application_routes => legacy_routes}/voice_conversion_routes.rs (100%) diff --git a/crates/service/web/storyteller_web/src/http_server/routes/application_routes/add_application_routes.rs b/crates/service/web/storyteller_web/src/http_server/routes/application_routes/add_application_routes.rs index 5a4493b4ed..cf4551187b 100644 --- a/crates/service/web/storyteller_web/src/http_server/routes/application_routes/add_application_routes.rs +++ b/crates/service/web/storyteller_web/src/http_server/routes/application_routes/add_application_routes.rs @@ -10,11 +10,9 @@ use crate::http_server::routes::application_routes::prompts_routes::add_prompts_ use crate::http_server::routes::application_routes::stripe_artcraft_routes::add_stripe_artcraft_routes; use crate::http_server::routes::application_routes::subscription_routes::add_subscription_routes; use crate::http_server::routes::application_routes::tag_routes::add_tag_routes; -use crate::http_server::routes::application_routes::tts_routes::add_tts_routes; use crate::http_server::routes::application_routes::user_bookmarks_routes::add_user_bookmarks_routes; use crate::http_server::routes::application_routes::user_rating_routes::add_user_rating_routes; use crate::http_server::routes::application_routes::user_routes::add_user_routes; -use crate::http_server::routes::application_routes::voice_conversion_routes::add_voice_conversion_routes; use crate::http_server::routes::application_routes::webhook_routes::add_webhook_routes; use crate::http_server::routes::application_routes::weights_routes::add_weights_routes; use actix_http::body::MessageBody; @@ -41,12 +39,10 @@ where // Artcraft surface area app = add_generate_routes(app); // /v1/generate/... app = add_webhook_routes(app); // /v1/webhooks/... (fal) - - // Remaining FakeYou surface area + + // Legacy FakeYou surface area that might be useful again one day app = add_tag_routes(app); // /v1/tags - app = add_tts_routes(app); // /tts app = add_weights_routes(app); // v1/weights - app = add_voice_conversion_routes(app); // /v1/voice_conversion // Media files routes app = add_media_file_routes(app); // /v1/media_files/... diff --git a/crates/service/web/storyteller_web/src/http_server/routes/application_routes/mod.rs b/crates/service/web/storyteller_web/src/http_server/routes/application_routes/mod.rs index 621722a439..39dd09fa98 100644 --- a/crates/service/web/storyteller_web/src/http_server/routes/application_routes/mod.rs +++ b/crates/service/web/storyteller_web/src/http_server/routes/application_routes/mod.rs @@ -8,11 +8,9 @@ mod moderation_routes; mod stripe_artcraft_routes; mod subscription_routes; mod tag_routes; -mod tts_routes; mod user_bookmarks_routes; mod user_rating_routes; mod user_routes; -mod voice_conversion_routes; mod webhook_routes; mod weights_routes; pub (super) mod add_application_routes; diff --git a/crates/service/web/storyteller_web/src/http_server/routes/legacy_routes/add_legacy_routes.rs b/crates/service/web/storyteller_web/src/http_server/routes/legacy_routes/add_legacy_routes.rs index 22e0d13503..ef2e46b3f7 100644 --- a/crates/service/web/storyteller_web/src/http_server/routes/legacy_routes/add_legacy_routes.rs +++ b/crates/service/web/storyteller_web/src/http_server/routes/legacy_routes/add_legacy_routes.rs @@ -41,10 +41,12 @@ use crate::http_server::deprecated_endpoints::w2l::get_w2l_template_use_count::g use crate::http_server::deprecated_endpoints::w2l::get_w2l_upload_template_job_status::get_w2l_upload_template_job_status_handler; use crate::http_server::deprecated_endpoints::w2l::list_w2l_templates::list_w2l_templates_handler; use crate::http_server::deprecated_endpoints::w2l::set_w2l_template_mod_approval::set_w2l_template_mod_approval_handler; +use crate::http_server::endpoints::app_state::get_app_state_handler::get_app_state_handler; use crate::http_server::endpoints::download_job::enqueue_generic_download::enqueue_generic_download_handler; use crate::http_server::endpoints::download_job::get_generic_upload_job_status::get_generic_download_job_status_handler; use crate::http_server::endpoints::misc::enable_alpha_easy_handler::enable_alpha_easy_handler; use crate::http_server::endpoints::misc::enable_alpha_handler::enable_alpha_handler; +use crate::http_server::endpoints::stats::get_unified_queue_stats_handler::get_unified_queue_stats_handler; use crate::http_server::endpoints::trending::list_trending_tts_models::list_trending_tts_models_handler; use crate::http_server::endpoints::voice_clone_requests::check_if_voice_clone_request_submitted::check_if_voice_clone_request_submitted_handler; use crate::http_server::endpoints::voice_clone_requests::create_voice_clone_request::create_voice_clone_request_handler; @@ -72,6 +74,8 @@ use crate::http_server::routes::legacy_routes::desktop_vc_app_routes::add_deskto use crate::http_server::routes::legacy_routes::image_studio_routes::add_image_studio_routes; use crate::http_server::routes::legacy_routes::model_download_routes::add_model_download_routes; use crate::http_server::routes::legacy_routes::studio_gen2_routes::add_studio_gen2_routes; +use crate::http_server::routes::legacy_routes::tts_routes::add_tts_routes; +use crate::http_server::routes::legacy_routes::voice_conversion_routes::add_voice_conversion_routes; use crate::http_server::routes::legacy_routes::workflow_routes::add_workflow_routes; use actix_helpers::route_builder::RouteBuilder; use actix_http::body::MessageBody; @@ -79,9 +83,6 @@ use actix_service::ServiceFactory; use actix_web::dev::{ServiceRequest, ServiceResponse}; use actix_web::error::Error; use actix_web::{web, App, HttpResponse}; -use crate::http_server::endpoints::app_state::get_app_state_handler::get_app_state_handler; -use crate::http_server::endpoints::service::status_alert_handler::status_alert_handler; -use crate::http_server::endpoints::stats::get_unified_queue_stats_handler::get_unified_queue_stats_handler; pub fn add_legacy_routes (app: App) -> App where @@ -114,6 +115,10 @@ where app = add_media_upload_routes(app); // /v1/media_upload/... app = add_trending_routes(app); // /v1/trending/... + // Remaining FakeYou surface area + app = add_tts_routes(app); // /tts + app = add_voice_conversion_routes(app); // /v1/voice_conversion + // ==================== Animations ==================== let mut app = RouteBuilder::from_app(app) diff --git a/crates/service/web/storyteller_web/src/http_server/routes/legacy_routes/mod.rs b/crates/service/web/storyteller_web/src/http_server/routes/legacy_routes/mod.rs index 3e17bf6935..aed08bccda 100644 --- a/crates/service/web/storyteller_web/src/http_server/routes/legacy_routes/mod.rs +++ b/crates/service/web/storyteller_web/src/http_server/routes/legacy_routes/mod.rs @@ -1,7 +1,9 @@ pub (super) mod add_legacy_routes; mod beta_key_routes; +mod desktop_vc_app_routes; mod image_studio_routes; mod model_download_routes; mod studio_gen2_routes; -mod workflow_routes; -mod desktop_vc_app_routes; \ No newline at end of file +mod tts_routes; +mod voice_conversion_routes; +mod workflow_routes; \ No newline at end of file diff --git a/crates/service/web/storyteller_web/src/http_server/routes/application_routes/tts_routes.rs b/crates/service/web/storyteller_web/src/http_server/routes/legacy_routes/tts_routes.rs similarity index 100% rename from crates/service/web/storyteller_web/src/http_server/routes/application_routes/tts_routes.rs rename to crates/service/web/storyteller_web/src/http_server/routes/legacy_routes/tts_routes.rs diff --git a/crates/service/web/storyteller_web/src/http_server/routes/application_routes/voice_conversion_routes.rs b/crates/service/web/storyteller_web/src/http_server/routes/legacy_routes/voice_conversion_routes.rs similarity index 100% rename from crates/service/web/storyteller_web/src/http_server/routes/application_routes/voice_conversion_routes.rs rename to crates/service/web/storyteller_web/src/http_server/routes/legacy_routes/voice_conversion_routes.rs diff --git a/crates/service/web/storyteller_web/src/main.rs b/crates/service/web/storyteller_web/src/main.rs index e5f9968ac5..96aec69013 100644 --- a/crates/service/web/storyteller_web/src/main.rs +++ b/crates/service/web/storyteller_web/src/main.rs @@ -367,6 +367,10 @@ async fn main() -> AnyhowResult<()> { switch_tts_to_model_weights: easyenv::get_env_bool_or_default("FF_SWITCH_TTS_TO_MODEL_WEIGHTS", false), force_session_studio_flags: easyenv::get_env_bool_or_default("FF_FORCE_SESSION_STUDIO_FLAG", false), force_session_video_style_transfer_flags: easyenv::get_env_bool_or_default("FF_FORCE_SESSION_VST_FLAG", false), + + // Disable voice features + disable_tts: easyenv::get_env_bool_or_default("DISABLE_TTS", false), + disable_voice_conversion: easyenv::get_env_bool_or_default("DISABLE_VOICE_CONVERSION", false), }; let third_party_url_redirector = ThirdPartyUrlRedirector::new(server_environment); diff --git a/crates/service/web/storyteller_web/src/state/server_state.rs b/crates/service/web/storyteller_web/src/state/server_state.rs index 1bcf1cf682..3e2c4be366 100644 --- a/crates/service/web/storyteller_web/src/state/server_state.rs +++ b/crates/service/web/storyteller_web/src/state/server_state.rs @@ -285,6 +285,14 @@ pub struct StaticFeatureFlags { /// TEMPORARY: Require users to have a flag on their `users` table record to use video style transfer. /// This will also prevent anonymous users from using the service APIs marked as VST-only. pub force_session_video_style_transfer_flags: bool, + + /// Disable TTS endpoints + /// If true, respond with 429. + pub disable_tts: bool, + + /// Disable voice conversion endpoints + /// If true, respond with 429. + pub disable_voice_conversion: bool, } /// Instead of top level service denial, these are bans against entities that instead return diff --git a/crates/vendor/tauri-plugin-http/permissions/schemas/schema.json b/crates/vendor/tauri-plugin-http/permissions/schemas/schema.json index 31640bee16..ea774399d5 100644 --- a/crates/vendor/tauri-plugin-http/permissions/schemas/schema.json +++ b/crates/vendor/tauri-plugin-http/permissions/schemas/schema.json @@ -343,10 +343,10 @@ "markdownDescription": "Denies the fetch_send command without any pre-configured scope." }, { - "description": "This permission set configures what kind of\r\nfetch operations are available from the http plugin.\r\n\r\nThis enables all fetch operations but does not\r\nallow explicitly any origins to be fetched. This needs to\r\nbe manually configured before usage.\r\n\r\n#### Granted Permissions\r\n\r\nAll fetch operations are enabled.\r\n\r\n\n#### This default permission set includes:\n\n- `allow-fetch`\n- `allow-fetch-cancel`\n- `allow-fetch-read-body`\n- `allow-fetch-send`", + "description": "This permission set configures what kind of\nfetch operations are available from the http plugin.\n\nThis enables all fetch operations but does not\nallow explicitly any origins to be fetched. This needs to\nbe manually configured before usage.\n\n#### Granted Permissions\n\nAll fetch operations are enabled.\n\n\n#### This default permission set includes:\n\n- `allow-fetch`\n- `allow-fetch-cancel`\n- `allow-fetch-read-body`\n- `allow-fetch-send`", "type": "string", "const": "default", - "markdownDescription": "This permission set configures what kind of\r\nfetch operations are available from the http plugin.\r\n\r\nThis enables all fetch operations but does not\r\nallow explicitly any origins to be fetched. This needs to\r\nbe manually configured before usage.\r\n\r\n#### Granted Permissions\r\n\r\nAll fetch operations are enabled.\r\n\r\n\n#### This default permission set includes:\n\n- `allow-fetch`\n- `allow-fetch-cancel`\n- `allow-fetch-read-body`\n- `allow-fetch-send`" + "markdownDescription": "This permission set configures what kind of\nfetch operations are available from the http plugin.\n\nThis enables all fetch operations but does not\nallow explicitly any origins to be fetched. This needs to\nbe manually configured before usage.\n\n#### Granted Permissions\n\nAll fetch operations are enabled.\n\n\n#### This default permission set includes:\n\n- `allow-fetch`\n- `allow-fetch-cancel`\n- `allow-fetch-read-body`\n- `allow-fetch-send`" } ] }