diff --git a/Cargo.lock b/Cargo.lock index c136ee19d..4a318fa91 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,23 +119,6 @@ dependencies = [ "tokio-util 0.3.1", ] -[[package]] -name = "actix-codec" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13895df506faee81e423febbae3a33b27fca71831b96bb3d60adf16ebcfea952" -dependencies = [ - "bitflags", - "bytes 1.3.0", - "futures-core", - "futures-sink", - "log", - "memchr", - "pin-project-lite 0.2.9", - "tokio 1.25.0", - "tokio-util 0.6.9", -] - [[package]] name = "actix-codec" version = "0.5.1" @@ -188,12 +171,12 @@ dependencies = [ [[package]] name = "actix-cors" -version = "0.6.0-beta.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa59d36d7ad063401d94ada05264a303791796ad5222d0954cc21f2e1052e99b" +checksum = "b340e9cfa5b08690aae90fb61beb44e9b06f44fe3d0f93781aaa58cfba86245e" dependencies = [ - "actix-service 2.0.1", - "actix-web 4.0.0-beta.10", + "actix-utils 3.0.0", + "actix-web 4.0.1", "derive_more", "futures-util", "log", @@ -203,14 +186,14 @@ dependencies = [ [[package]] name = "actix-files" -version = "0.6.0-beta.8" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3754d4632de16dd68f6a5d379cf9d7200ec26020482e26aa16560a258e92f3" +checksum = "d832782fac6ca7369a70c9ee9a20554623c5e51c76e190ad151780ebea1cf689" dependencies = [ "actix-http 3.3.0", "actix-service 2.0.1", "actix-utils 3.0.0", - "actix-web 4.0.0-beta.10", + "actix-web 4.0.1", "askama_escape", "bitflags", "bytes 1.3.0", @@ -221,6 +204,7 @@ dependencies = [ "mime", "mime_guess", "percent-encoding 2.2.0", + "pin-project-lite 0.2.9", ] [[package]] @@ -279,6 +263,7 @@ dependencies = [ "actix-service 2.0.1", "actix-utils 3.0.0", "ahash 0.7.6", + "base64 0.21.0", "bitflags", "brotli", "bytes 1.3.0", @@ -287,14 +272,18 @@ dependencies = [ "encoding_rs", "flate2", "futures-core", + "h2 0.3.15", "http", "httparse", "httpdate 1.0.1", "itoa 1.0.3", "language-tags 0.3.2", + "local-channel", "mime", "percent-encoding 2.2.0", "pin-project-lite 0.2.9", + "rand 0.8.5", + "sha1 0.10.4", "smallvec 1.10.0", "tokio 1.25.0", "tokio-util 0.7.4", @@ -329,7 +318,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee3878dadc5d0e2afa0439b4e1ef3b03fa2feb72c208d8c6f196ed6242979f6d" dependencies = [ "actix-utils 3.0.0", - "actix-web 4.0.0-beta.10", + "actix-web 4.0.1", "bytes 1.3.0", "derive_more", "futures-core", @@ -356,16 +345,15 @@ dependencies = [ [[package]] name = "actix-router" -version = "0.5.0-beta.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36b95ce0d76d1aa2f98b681702807475ade0f99bd4552546a6843a966d42ea3d" +checksum = "d66ff4d247d2b160861fa2866457e85706833527840e4133f8f49aa423a38799" dependencies = [ "bytestring", - "firestorm", "http", - "log", "regex", "serde", + "tracing", ] [[package]] @@ -416,18 +404,20 @@ dependencies = [ [[package]] name = "actix-server" -version = "2.0.0-beta.6" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7367665785765b066ad16e1086d26a087f696bc7c42b6f93004ced6cfcf1eeca" +checksum = "0da34f8e659ea1b077bb4637948b815cd3768ad5a188fdcd74ff4d84240cd824" dependencies = [ "actix-rt 2.7.0", "actix-service 2.0.1", "actix-utils 3.0.0", "futures-core", - "log", - "mio 0.7.11", + "futures-util", + "mio 0.8.5", "num_cpus", + "socket2 0.4.7", "tokio 1.25.0", + "tracing", ] [[package]] @@ -563,35 +553,34 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.0.0-beta.10" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8a4b9d00991d8da308070a5cea7f1bbaa153a91c3fb5567937d99b9f46d601e" +checksum = "f4e5ebffd51d50df56a3ae0de0e59487340ca456f05dd0b90c0a7a6dd6a74d31" dependencies = [ - "actix-codec 0.4.1", + "actix-codec 0.5.1", "actix-http 3.3.0", "actix-macros 0.2.3", - "actix-router 0.5.0-beta.2", + "actix-router 0.5.1", "actix-rt 2.7.0", - "actix-server 2.0.0-beta.6", + "actix-server 2.1.1", "actix-service 2.0.1", "actix-utils 3.0.0", - "actix-web-codegen 0.5.0-beta.5", + "actix-web-codegen 4.2.0", "ahash 0.7.6", "bytes 1.3.0", + "bytestring", "cfg-if 1.0.0", - "cookie 0.15.1", + "cookie 0.16.2", "derive_more", - "either", "encoding_rs", "futures-core", "futures-util", - "itoa 0.4.7", + "itoa 1.0.3", "language-tags 0.3.2", "log", "mime", "once_cell", - "paste", - "pin-project 1.0.7", + "pin-project-lite 0.2.9", "regex", "serde", "serde_json", @@ -604,19 +593,20 @@ dependencies = [ [[package]] name = "actix-web-actors" -version = "4.0.0-beta.7" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b43c8e03f1877bc010316de455ee479aa0de0ae0717d49041db5f38fa192de" +checksum = "bf6e9ccc371cfddbed7aa842256a4abc7a6dcac9f3fce392fe1d0f68cfd136b2" dependencies = [ "actix", - "actix-codec 0.4.1", + "actix-codec 0.5.1", "actix-http 3.3.0", - "actix-web 4.0.0-beta.10", + "actix-web 4.0.1", "bytes 1.3.0", "bytestring", "futures-core", - "pin-project 1.0.7", + "pin-project-lite 0.2.9", "tokio 1.25.0", + "tokio-util 0.7.4", ] [[package]] @@ -632,11 +622,11 @@ dependencies = [ [[package]] name = "actix-web-codegen" -version = "0.5.0-beta.5" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfe80a8828fa88a0420dc8fdd4c16b8207326c917f17701881b063eadc2a8d3b" +checksum = "2262160a7ae29e3415554a3f1fc04c764b1540c116aa524683208078b7a75bc9" dependencies = [ - "actix-router 0.5.0-beta.2", + "actix-router 0.5.1", "proc-macro2", "quote", "syn 1.0.107", @@ -657,14 +647,14 @@ dependencies = [ name = "actix_helpers" version = "0.0.1" dependencies = [ - "actix-cors 0.6.0-beta.3", + "actix-cors 0.6.4", "actix-files", "actix-http 3.3.0", "actix-multipart", "actix-rt 2.7.0", "actix-service 2.0.1", "actix-utils 3.0.0", - "actix-web 4.0.0-beta.10", + "actix-web 4.0.1", "actix-web-actors", "cidr-utils", "errors", @@ -736,14 +726,14 @@ dependencies = [ name = "aichatbot-sidecar" version = "0.0.1" dependencies = [ - "actix-cors 0.6.0-beta.3", + "actix-cors 0.6.4", "actix-files", "actix-http 3.3.0", "actix-multipart", "actix-rt 2.7.0", "actix-service 2.0.1", "actix-utils 3.0.0", - "actix-web 4.0.0-beta.10", + "actix-web 4.0.1", "actix-web-actors", "actix_helpers", "async-openai", @@ -1165,9 +1155,9 @@ dependencies = [ name = "billing_component" version = "0.0.1" dependencies = [ - "actix-cors 0.6.0-beta.3", + "actix-cors 0.6.4", "actix-http 3.3.0", - "actix-web 4.0.0-beta.10", + "actix-web 4.0.1", "anyhow", "async-stripe", "async-trait", @@ -1649,9 +1639,9 @@ dependencies = [ name = "component_subsystem_inference_workloads" version = "0.0.1" dependencies = [ - "actix-cors 0.6.0-beta.3", + "actix-cors 0.6.4", "actix-http 3.3.0", - "actix-web 4.0.0-beta.10", + "actix-web 4.0.1", "anyhow", "base64 0.13.0", "chrono", @@ -1743,17 +1733,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "cookie" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f1c7727e460397e56abc4bddc1d49e07a1ad78fc98eb2e1c8f032a58a2f80d" -dependencies = [ - "percent-encoding 2.2.0", - "time 0.2.26", - "version_check", -] - [[package]] name = "cookie" version = "0.16.2" @@ -2453,14 +2432,14 @@ dependencies = [ name = "dummy-service" version = "0.0.1" dependencies = [ - "actix-cors 0.6.0-beta.3", + "actix-cors 0.6.4", "actix-files", "actix-http 3.3.0", "actix-multipart", "actix-rt 2.7.0", "actix-service 2.0.1", "actix-utils 3.0.0", - "actix-web 4.0.0-beta.10", + "actix-web 4.0.1", "actix-web-actors", "actix_helpers", "chrono", @@ -2812,12 +2791,6 @@ dependencies = [ "errors", ] -[[package]] -name = "firestorm" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31586bda1b136406162e381a3185a506cdfc1631708dd40cba2f6628d8634499" - [[package]] name = "flate2" version = "1.0.26" @@ -3391,13 +3364,13 @@ dependencies = [ [[package]] name = "http" -version = "0.2.5" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes 1.3.0", "fnv", - "itoa 0.4.7", + "itoa 1.0.3", ] [[package]] @@ -3452,10 +3425,10 @@ dependencies = [ name = "http_server_common" version = "0.0.1" dependencies = [ - "actix-cors 0.6.0-beta.3", + "actix-cors 0.6.4", "actix-http 3.3.0", "actix-rt 2.7.0", - "actix-web 4.0.0-beta.10", + "actix-web 4.0.1", "anyhow", "base64 0.13.0", "chrono", @@ -3613,83 +3586,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "image-generation-service" -version = "0.0.1" -dependencies = [ - "actix", - "actix-cors 0.6.0-beta.3", - "actix-files", - "actix-http 3.3.0", - "actix-multipart", - "actix-rt 2.7.0", - "actix-service 2.0.1", - "actix-utils 3.0.0", - "actix-web 4.0.0-beta.10", - "actix-web-actors", - "anyhow", - "base64 0.13.0", - "bcrypt", - "chrono", - "cloud_storage", - "config", - "container_common", - "data-encoding", - "derive_more", - "diesel", - "dotenv", - "easyenv", - "errors", - "futures 0.1.31", - "futures 0.3.26", - "futures-util", - "google_drive_common", - "hex", - "hmac 0.10.1", - "hostname", - "http_server_common", - "hyper 0.14.24", - "infer 0.5.0", - "jobs_common", - "jwt", - "language-tags 0.3.2", - "lazy_static", - "lexical-sort", - "lfu", - "limitation", - "log", - "lru_time_cache", - "magic-crypt", - "md-5", - "memory_caching", - "mysql_queries", - "native-tls", - "once_cell", - "pulldown-cmark", - "r2d2_redis", - "rand 0.8.5", - "redis_common", - "regex", - "reqwest", - "reusable_types", - "ring 0.17.0-alpha.11", - "rust-s3", - "serde", - "serde_derive", - "serde_json", - "sha2 0.9.5", - "sqlx", - "subprocess", - "tempdir", - "time 0.2.26", - "tokio 1.25.0", - "toml", - "tts_common", - "twitch_common", - "user_input_common", - "uuid 0.8.2", -] - [[package]] name = "indexmap" version = "1.9.2" @@ -3728,7 +3624,7 @@ dependencies = [ name = "inference-job" version = "0.0.1" dependencies = [ - "actix-web 4.0.0-beta.10", + "actix-web 4.0.1", "actix_helpers", "anyhow", "bootstrap", @@ -4060,6 +3956,18 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +[[package]] +name = "local-channel" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f303ec0e94c6c54447f84f3b0ef7af769858a9c4ef56ef2a986d3dcd4c3fc9c" +dependencies = [ + "futures-core", + "futures-sink", + "futures-util", + "local-waker", +] + [[package]] name = "local-waker" version = "0.1.1" @@ -4317,25 +4225,12 @@ dependencies = [ "kernel32-sys", "libc", "log", - "miow 0.2.2", + "miow", "net2", "slab", "winapi 0.2.8", ] -[[package]] -name = "mio" -version = "0.7.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956" -dependencies = [ - "libc", - "log", - "miow 0.3.7", - "ntapi", - "winapi 0.3.9", -] - [[package]] name = "mio" version = "0.8.5" @@ -4371,15 +4266,6 @@ dependencies = [ "ws2_32-sys", ] -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "mockall" version = "0.11.3" @@ -4609,15 +4495,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" -[[package]] -name = "ntapi" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "num" version = "0.1.42" @@ -6653,14 +6530,14 @@ checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" name = "storyteller-web" version = "0.0.1" dependencies = [ - "actix-cors 0.6.0-beta.3", + "actix-cors 0.6.4", "actix-files", "actix-http 3.3.0", "actix-multipart", "actix-rt 2.7.0", "actix-service 2.0.1", "actix-utils 3.0.0", - "actix-web 4.0.0-beta.10", + "actix-web 4.0.1", "actix-web-actors", "actix_helpers", "anyhow", @@ -6686,6 +6563,7 @@ dependencies = [ "errors", "futures 0.1.31", "futures 0.3.26", + "futures-core", "futures-util", "google_drive_common", "hashing", @@ -6713,6 +6591,7 @@ dependencies = [ "native-tls", "newrelic-telemetry", "once_cell", + "pin-project-lite 0.2.9", "pulldown-cmark", "r2d2_redis", "rand 0.8.5", @@ -7787,7 +7666,7 @@ dependencies = [ "actix-rt 2.7.0", "actix-service 2.0.1", "actix-utils 3.0.0", - "actix-web 4.0.0-beta.10", + "actix-web 4.0.1", "actix-web-actors", "anyhow", "base64 0.13.0", @@ -8034,7 +7913,7 @@ dependencies = [ name = "url_config" version = "0.0.1" dependencies = [ - "actix-web 4.0.0-beta.10", + "actix-web 4.0.1", "anyhow", "http_server_common", "reusable_types", @@ -8057,7 +7936,7 @@ dependencies = [ name = "users_component" version = "0.0.1" dependencies = [ - "actix-web 4.0.0-beta.10", + "actix-web 4.0.1", "anyhow", "base64 0.13.0", "bcrypt", @@ -8487,7 +8366,7 @@ dependencies = [ "actix-rt 2.7.0", "actix-service 2.0.1", "actix-utils 3.0.0", - "actix-web 4.0.0-beta.10", + "actix-web 4.0.1", "actix-web-actors", "anyhow", "base64 0.13.0", diff --git a/Cargo.toml b/Cargo.toml index 5a345dd19..3680e246a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,7 +61,6 @@ members = [ "crates/service/job/w2l_inference_job", "crates/service/other/twitch_pubsub_subscriber", "crates/service/web/dummy_service", - "crates/service/web/image_generation_service", "crates/service/web/storyteller_web", "crates/service/web/websocket_gateway", diff --git a/crates/lib/actix_helpers/src/extractors/get_ip_from_header.rs b/crates/lib/actix_helpers/src/extractors/get_ip_from_header.rs index 64e171175..7eb82e7ea 100644 --- a/crates/lib/actix_helpers/src/extractors/get_ip_from_header.rs +++ b/crates/lib/actix_helpers/src/extractors/get_ip_from_header.rs @@ -1,5 +1,5 @@ -use actix_http::http::HeaderMap; -use actix_web::http::HeaderName; +use actix_http::header::HeaderMap; +use actix_http::header::HeaderName; use std::str::FromStr; pub (crate) fn get_ip_from_header(headers: &HeaderMap, header_name: &str) -> Option { diff --git a/crates/lib/actix_helpers/src/middleware/banned_cidr_filter/banned_cidr_filter.rs b/crates/lib/actix_helpers/src/middleware/banned_cidr_filter/banned_cidr_filter.rs index 32e446be9..024107492 100644 --- a/crates/lib/actix_helpers/src/middleware/banned_cidr_filter/banned_cidr_filter.rs +++ b/crates/lib/actix_helpers/src/middleware/banned_cidr_filter/banned_cidr_filter.rs @@ -23,12 +23,12 @@ impl BannedCidrFilter { } } -impl Transform for BannedCidrFilter +impl Transform for BannedCidrFilter where - S: Service, + S: Service, Error = Error>, S::Future: 'static, { - type Response = ServiceResponse; + type Response = ServiceResponse; type Error = Error; type InitError = (); type Transform = BannedCidrFilterMiddleware; diff --git a/crates/lib/actix_helpers/src/middleware/banned_cidr_filter/banned_cidr_filter_middleware.rs b/crates/lib/actix_helpers/src/middleware/banned_cidr_filter/banned_cidr_filter_middleware.rs index a54925285..b7086c8f6 100644 --- a/crates/lib/actix_helpers/src/middleware/banned_cidr_filter/banned_cidr_filter_middleware.rs +++ b/crates/lib/actix_helpers/src/middleware/banned_cidr_filter/banned_cidr_filter_middleware.rs @@ -7,26 +7,28 @@ use crate::middleware::banned_ip_filter::banned_error::BannedError; use futures_util::future::{err, Either, Ready}; use std::net::IpAddr; use std::str::FromStr; -use std::task::{Context, Poll}; +//use std::task::{Context, Poll}; pub struct BannedCidrFilterMiddleware { pub (crate) service: S, pub (crate) cidr_bans: BannedCidrSet, } -impl Service for BannedCidrFilterMiddleware +impl Service for BannedCidrFilterMiddleware where - S: Service, + S: Service, Error = Error>, S::Future: 'static, { - type Response = ServiceResponse; + type Response = ServiceResponse; type Error = Error; type Future = Either>>; - // alternatively(?), actix_service::forward_ready!(service); - fn poll_ready(&self, cx: &mut Context) -> Poll> { - self.service.poll_ready(cx) - } + //// alternatively(?), actix_service::forward_ready!(service); + //fn poll_ready(&self, cx: &mut Context) -> Poll> { + // self.service.poll_ready(cx) + //} + + actix_service::forward_ready!(service); fn call(&self, request: ServiceRequest) -> Self::Future { let ip_address = get_service_request_ip_address(&request); diff --git a/crates/lib/actix_helpers/src/middleware/banned_ip_filter/banned_error.rs b/crates/lib/actix_helpers/src/middleware/banned_ip_filter/banned_error.rs index 86bcf085b..3dca83a27 100644 --- a/crates/lib/actix_helpers/src/middleware/banned_ip_filter/banned_error.rs +++ b/crates/lib/actix_helpers/src/middleware/banned_ip_filter/banned_error.rs @@ -1,4 +1,4 @@ -use actix_http::body::Body; +use actix_http::body::BoxBody; use actix_http::header::CONTENT_TYPE; use actix_web::http::StatusCode; use actix_web::http::header::ContentType; @@ -20,7 +20,7 @@ impl ResponseError for BannedError { StatusCode::UNAUTHORIZED } - fn error_response(&self) -> HttpResponse { + fn error_response(&self) -> HttpResponse { // NB: I'm setting a string error because I mistakenly got caught by this in local dev // and couldn't figure out the issue for a bit. At least I can grep for this string. // However, I need to balance this requirement with not cluing in those that are banned. diff --git a/crates/lib/actix_helpers/src/middleware/banned_ip_filter/banned_ip_filter.rs b/crates/lib/actix_helpers/src/middleware/banned_ip_filter/banned_ip_filter.rs index 55fb4a3fd..e06f8f32b 100644 --- a/crates/lib/actix_helpers/src/middleware/banned_ip_filter/banned_ip_filter.rs +++ b/crates/lib/actix_helpers/src/middleware/banned_ip_filter/banned_ip_filter.rs @@ -23,12 +23,12 @@ impl BannedIpFilter { } } -impl Transform for BannedIpFilter +impl Transform for BannedIpFilter where - S: Service, + S: Service, Error = Error>, S::Future: 'static, { - type Response = ServiceResponse; + type Response = ServiceResponse; type Error = Error; type InitError = (); type Transform = BannedIpFilterMiddleware; diff --git a/crates/lib/actix_helpers/src/middleware/banned_ip_filter/banned_ip_filter_middleware.rs b/crates/lib/actix_helpers/src/middleware/banned_ip_filter/banned_ip_filter_middleware.rs index abc46dd91..1c5d0e865 100644 --- a/crates/lib/actix_helpers/src/middleware/banned_ip_filter/banned_ip_filter_middleware.rs +++ b/crates/lib/actix_helpers/src/middleware/banned_ip_filter/banned_ip_filter_middleware.rs @@ -5,7 +5,7 @@ use crate::extractors::get_service_request_ip_address::get_service_request_ip_ad use crate::middleware::banned_ip_filter::banned_error::BannedError; use crate::middleware::banned_ip_filter::ip_ban_list::ip_ban_list::IpBanList; use futures_util::future::{err, Either, Ready}; -use std::task::{Context, Poll}; +//use std::task::{Context, Poll}; // There are two steps in middleware processing. // 1. Middleware initialization, middleware factory gets called with @@ -17,19 +17,21 @@ pub struct BannedIpFilterMiddleware { pub (crate) ip_ban_list: IpBanList, } -impl Service for BannedIpFilterMiddleware +impl Service for BannedIpFilterMiddleware where - S: Service, + S: Service, Error = Error>, S::Future: 'static, { - type Response = ServiceResponse; + type Response = ServiceResponse; type Error = Error; type Future = Either>>; - // alternatively(?), actix_service::forward_ready!(service); - fn poll_ready(&self, cx: &mut Context) -> Poll> { - self.service.poll_ready(cx) - } + //// alternatively(?), actix_service::forward_ready!(service); + //fn poll_ready(&self, cx: &mut Context) -> Poll> { + // self.service.poll_ready(cx) + //} + + actix_service::forward_ready!(service); fn call(&self, request: ServiceRequest) -> Self::Future { let ip_address = get_service_request_ip_address(&request); diff --git a/crates/lib/actix_helpers/src/middleware/disabled_endpoint_filter/disabled_endpoint_filter.rs b/crates/lib/actix_helpers/src/middleware/disabled_endpoint_filter/disabled_endpoint_filter.rs index 4cef0b121..4a314a6d3 100644 --- a/crates/lib/actix_helpers/src/middleware/disabled_endpoint_filter/disabled_endpoint_filter.rs +++ b/crates/lib/actix_helpers/src/middleware/disabled_endpoint_filter/disabled_endpoint_filter.rs @@ -23,12 +23,12 @@ impl DisabledEndpointFilter { } } -impl Transform for DisabledEndpointFilter +impl Transform for DisabledEndpointFilter where - S: Service, + S: Service, Error = Error>, S::Future: 'static, { - type Response = ServiceResponse; + type Response = ServiceResponse; type Error = Error; type InitError = (); type Transform = DisabledEndpointFilterMiddleware; diff --git a/crates/lib/actix_helpers/src/middleware/disabled_endpoint_filter/disabled_endpoint_filter_middleware.rs b/crates/lib/actix_helpers/src/middleware/disabled_endpoint_filter/disabled_endpoint_filter_middleware.rs index 703c344e9..cf43ada21 100644 --- a/crates/lib/actix_helpers/src/middleware/disabled_endpoint_filter/disabled_endpoint_filter_middleware.rs +++ b/crates/lib/actix_helpers/src/middleware/disabled_endpoint_filter/disabled_endpoint_filter_middleware.rs @@ -4,7 +4,7 @@ use actix_web::dev::{ServiceRequest, ServiceResponse}; use crate::middleware::disabled_endpoint_filter::disabled_endpoints::disabled_endpoints::DisabledEndpoints; use crate::middleware::disabled_endpoint_filter::disabled_error::DisabledError; use futures_util::future::{err, Either, Ready}; -use std::task::{Context, Poll}; +//use std::task::{Context, Poll}; // There are two steps in middleware processing. // 1. Middleware initialization, middleware factory gets called with @@ -16,19 +16,21 @@ pub struct DisabledEndpointFilterMiddleware { pub (crate) disabled_endpoints: DisabledEndpoints, } -impl Service for DisabledEndpointFilterMiddleware +impl Service for DisabledEndpointFilterMiddleware where - S: Service, + S: Service, Error = Error>, S::Future: 'static, { - type Response = ServiceResponse; + type Response = ServiceResponse; type Error = Error; type Future = Either>>; - // alternatively(?), actix_service::forward_ready!(service); - fn poll_ready(&self, cx: &mut Context) -> Poll> { - self.service.poll_ready(cx) - } + //// alternatively(?), actix_service::forward_ready!(service); + //fn poll_ready(&self, cx: &mut Context) -> Poll> { + // self.service.poll_ready(cx) + //} + + actix_service::forward_ready!(service); fn call(&self, request: ServiceRequest) -> Self::Future { let endpoint = request.path(); diff --git a/crates/lib/actix_helpers/src/middleware/disabled_endpoint_filter/disabled_error.rs b/crates/lib/actix_helpers/src/middleware/disabled_endpoint_filter/disabled_error.rs index 216ed5aab..ac5a786bd 100644 --- a/crates/lib/actix_helpers/src/middleware/disabled_endpoint_filter/disabled_error.rs +++ b/crates/lib/actix_helpers/src/middleware/disabled_endpoint_filter/disabled_error.rs @@ -1,4 +1,4 @@ -use actix_http::body::Body; +use actix_http::body::BoxBody; use actix_http::header::CONTENT_TYPE; use actix_web::http::StatusCode; use actix_web::http::header::ContentType; @@ -20,7 +20,7 @@ impl ResponseError for DisabledError { StatusCode::TOO_MANY_REQUESTS } - fn error_response(&self) -> HttpResponse { + fn error_response(&self) -> HttpResponse { // NB: I'm setting a string error because I mistakenly got caught by this in local dev // and couldn't figure out the issue for a bit. At least I can grep for this string. // However, I need to balance this requirement with not cluing in those that are banned. diff --git a/crates/lib/actix_helpers/src/route_builder.rs b/crates/lib/actix_helpers/src/route_builder.rs index b4752aad0..7fa16fece 100644 --- a/crates/lib/actix_helpers/src/route_builder.rs +++ b/crates/lib/actix_helpers/src/route_builder.rs @@ -3,7 +3,6 @@ use actix_service::ServiceFactory; use actix_web::dev::{Handler, ServiceRequest, ServiceResponse}; use actix_web::error::Error; use actix_web::{App, web, HttpResponse, FromRequest, Responder}; -use std::future::Future; // TODO: Check that routes don't overlap. // TODO: Properly handle scoped routes in a nice DSL. @@ -21,7 +20,7 @@ where InitError = (), >, { - app: App, + app: App, } impl RouteBuilder @@ -36,24 +35,23 @@ impl RouteBuilder >, { /// Constructor - pub fn from_app(app: App) -> Self { + pub fn from_app(app: App) -> Self { Self { app } } /// Return back to Actix App. - pub fn into_app(self) -> App { + pub fn into_app(self) -> App { self.app } /// Add an HTTP GET route. This also adds the HEAD request for CORS. - pub fn add_get(mut self, path: &str, handler: F) -> Self + pub fn add_get(mut self, path: &str, handler: F) -> Self where - F: Handler, - S: FromRequest + 'static, - R: Future + 'static, - R::Output: Responder + 'static, + F: Handler, + Args: FromRequest + 'static, + F::Output: Responder + 'static, { self.app = self.app.service( web::resource(path) @@ -64,12 +62,11 @@ impl RouteBuilder } /// Add an HTTP POST route. This also adds the HEAD request for CORS. - pub fn add_post(mut self, path: &str, handler: F) -> Self + pub fn add_post(mut self, path: &str, handler: F) -> Self where - F: Handler, - S: FromRequest + 'static, - R: Future + 'static, - R::Output: Responder + 'static, + F: Handler, + Args: FromRequest + 'static, + F::Output: Responder + 'static, { self.app = self.app.service( web::resource(path) diff --git a/crates/lib/deprecated/http_server_common/src/cors.rs b/crates/lib/deprecated/http_server_common/src/cors.rs index bb3ff5d95..a38850004 100644 --- a/crates/lib/deprecated/http_server_common/src/cors.rs +++ b/crates/lib/deprecated/http_server_common/src/cors.rs @@ -1,5 +1,4 @@ use actix_cors::Cors; -use actix_http::http; use log::info; use reusable_types::server_environment::ServerEnvironment; @@ -38,11 +37,11 @@ fn do_build_cors_config(is_production: bool) -> Cors { cors.allowed_methods(vec!["GET", "POST", "OPTIONS", "DELETE"]) .supports_credentials() .allowed_headers(vec![ - http::header::ACCEPT, - http::header::ACCESS_CONTROL_ALLOW_ORIGIN, // Tabulator Ajax - http::header::CONTENT_TYPE, - http::header::ACCESS_CONTROL_ALLOW_CREDENTIALS, // https://stackoverflow.com/a/46412839 - http::header::HeaderName::from_static("x-requested-with") // Tabulator Ajax sends + actix_http::header::ACCEPT, + actix_http::header::ACCESS_CONTROL_ALLOW_ORIGIN, // Tabulator Ajax + actix_http::header::CONTENT_TYPE, + actix_http::header::ACCESS_CONTROL_ALLOW_CREDENTIALS, // https://stackoverflow.com/a/46412839 + actix_http::header::HeaderName::from_static("x-requested-with") // Tabulator Ajax sends ]) .max_age(3600) } @@ -204,6 +203,7 @@ pub fn add_development_only(cors: Cors) -> Cors { #[cfg(test)] mod tests { use actix_cors::Cors; + use actix_http::body::{BoxBody, EitherBody}; use actix_web::dev::{Service, ServiceRequest, ServiceResponse, Transform}; use actix_web::http::StatusCode; use actix_web::test::TestRequest; @@ -212,7 +212,7 @@ mod tests { use reusable_types::server_environment::ServerEnvironment; use speculoos::{assert_that, asserting}; - async fn make_test_request(cors: &Cors, hostname: &str) -> ServiceResponse { + async fn make_test_request(cors: &Cors, hostname: &str) -> ServiceResponse> { let cors= cors.new_transform(test::ok_service()) .await .unwrap(); diff --git a/crates/lib/deprecated/http_server_common/src/endpoints/root_index.rs b/crates/lib/deprecated/http_server_common/src/endpoints/root_index.rs index ba745827f..e48a1be56 100644 --- a/crates/lib/deprecated/http_server_common/src/endpoints/root_index.rs +++ b/crates/lib/deprecated/http_server_common/src/endpoints/root_index.rs @@ -1,4 +1,4 @@ -use actix_http::http::StatusCode; +use actix_http::StatusCode; use actix_web::HttpResponse; diff --git a/crates/lib/deprecated/http_server_common/src/error/simple_json_error_response.rs b/crates/lib/deprecated/http_server_common/src/error/simple_json_error_response.rs index 79b2ef8b2..90d11b05d 100644 --- a/crates/lib/deprecated/http_server_common/src/error/simple_json_error_response.rs +++ b/crates/lib/deprecated/http_server_common/src/error/simple_json_error_response.rs @@ -30,9 +30,9 @@ struct SimpleGenericJsonError { #[cfg(test)] mod tests { + use actix_http::body::{BoxBody, MessageBody}; use crate::error::simple_json_error_response::simple_json_error_response; use actix_web::http::StatusCode; - use actix_http::body::AnyBody; #[test] pub fn serialization() { @@ -43,13 +43,10 @@ mod tests { assert_eq!(response.status(), StatusCode::TOO_MANY_REQUESTS); let body = response.into_body(); - match body { - AnyBody::Bytes(bytes) => { - let bytes = bytes.to_vec(); - let body = String::from_utf8(bytes).unwrap(); - assert_eq!(body, "{\"success\":false,\"error_reason\":\"foo\"}"); - } - _ => panic!("this failed"), - } + + let bytes = body.try_into_bytes().expect("bytes should extract"); + let body = String::from_utf8(bytes.to_vec()).unwrap(); + + assert_eq!(body, "{\"success\":false,\"error_reason\":\"foo\"}"); } } diff --git a/crates/lib/deprecated/http_server_common/src/request/get_request_ip.rs b/crates/lib/deprecated/http_server_common/src/request/get_request_ip.rs index 3085e5811..9760f6671 100644 --- a/crates/lib/deprecated/http_server_common/src/request/get_request_ip.rs +++ b/crates/lib/deprecated/http_server_common/src/request/get_request_ip.rs @@ -1,6 +1,7 @@ +use actix_http::header::HeaderMap; +use actix_http::header::HeaderName; use actix_web::HttpRequest; use actix_web::dev::ServiceRequest; -use actix_web::http::{HeaderMap, HeaderName}; use log::debug; use std::str::FromStr; diff --git a/crates/lib/mysql_queries/src/queries/twitch/twitch_event_rules/reorder_twitch_event_rules.rs b/crates/lib/mysql_queries/src/queries/twitch/twitch_event_rules/reorder_twitch_event_rules.rs index 65ac494f9..28d915e0c 100644 --- a/crates/lib/mysql_queries/src/queries/twitch/twitch_event_rules/reorder_twitch_event_rules.rs +++ b/crates/lib/mysql_queries/src/queries/twitch/twitch_event_rules/reorder_twitch_event_rules.rs @@ -1,6 +1,5 @@ use anyhow::anyhow; use errors::AnyhowResult; -use log::error; use once_cell::sync::Lazy; use regex::Regex; use sqlx::MySqlPool; diff --git a/crates/lib/tts_common/src/clean_symbols.rs b/crates/lib/tts_common/src/clean_symbols.rs index 1391c04e7..f73bf28f2 100644 --- a/crates/lib/tts_common/src/clean_symbols.rs +++ b/crates/lib/tts_common/src/clean_symbols.rs @@ -173,7 +173,7 @@ mod tests { use once_cell::sync::Lazy; use crate::clean_symbols::clean_symbols; - const TIME_BOMB_EPOCH_STR : &'static str = "2023-06-01T00:00:00.00Z"; + const TIME_BOMB_EPOCH_STR : &'static str = "2023-11-01T00:00:00.00Z"; static TIME_BOMB_EPOCH: Lazy> = Lazy::new(|| { let datetime = DateTime::parse_from_rfc3339(TIME_BOMB_EPOCH_STR) diff --git a/crates/service/plugins/billing/src/default_routes.rs b/crates/service/plugins/billing/src/default_routes.rs index 17e507316..5ea512293 100644 --- a/crates/service/plugins/billing/src/default_routes.rs +++ b/crates/service/plugins/billing/src/default_routes.rs @@ -11,7 +11,7 @@ use crate::stripe::http_endpoints::customer_portal::stripe_create_customer_porta use crate::stripe::http_endpoints::webhook::stripe_webhook_handler::stripe_webhook_handler; use crate::users::http_endpoints::list_active_user_subscriptions_handler::list_active_user_subscriptions_handler; -pub fn add_suggested_stripe_billing_routes (app: App) -> App +pub fn add_suggested_stripe_billing_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< diff --git a/crates/service/plugins/users/src/default_routes.rs b/crates/service/plugins/users/src/default_routes.rs index 264c57e9e..c3c19f062 100644 --- a/crates/service/plugins/users/src/default_routes.rs +++ b/crates/service/plugins/users/src/default_routes.rs @@ -11,7 +11,7 @@ use crate::endpoints::session_info_handler::session_info_handler; // NB: This does not include the user edit endpoints since FakeYou's API mounts them alongside other things. // A 'v2' API would mount under a v2 prefix and the entity type. -pub fn add_suggested_api_v1_account_creation_and_session_routes (app: App) -> App +pub fn add_suggested_api_v1_account_creation_and_session_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< diff --git a/crates/service/plugins/users/src/endpoints/logout_handler.rs b/crates/service/plugins/users/src/endpoints/logout_handler.rs index ae2e77b85..e88065f70 100644 --- a/crates/service/plugins/users/src/endpoints/logout_handler.rs +++ b/crates/service/plugins/users/src/endpoints/logout_handler.rs @@ -52,7 +52,7 @@ pub async fn logout_handler( mysql_pool: web::Data, ) -> Result { - let delete_cookie = match http_request.cookie("session") { + let mut delete_cookie = match http_request.cookie("session") { Some(cookie) => { match session_cookie_manager.decode_session_token(&cookie) { Err(e) => { @@ -77,8 +77,11 @@ pub async fn logout_handler( let body = serde_json::to_string(&response) .map_err(|_e| LogoutError::ServerError)?; + // Mark cookie for deletion + delete_cookie.make_removal(); + Ok(HttpResponse::Ok() - .del_cookie(&delete_cookie) + .cookie(delete_cookie) .content_type("application/json") .body(body)) } diff --git a/crates/service/plugins/users/src/utils/session_cookie_manager.rs b/crates/service/plugins/users/src/utils/session_cookie_manager.rs index e3e7b9abf..9d3e8cc10 100644 --- a/crates/service/plugins/users/src/utils/session_cookie_manager.rs +++ b/crates/service/plugins/users/src/utils/session_cookie_manager.rs @@ -14,7 +14,6 @@ use jwt::VerifyWithKey; use log::warn; use sha2::Sha256; use std::collections::BTreeMap; -use time::OffsetDateTime; /** * Cookie version history @@ -80,9 +79,11 @@ impl SessionCookieManager { } pub fn delete_cookie(&self) -> Cookie { - Cookie::build(SESSION_COOKIE_NAME, "DELETED") - .expires(OffsetDateTime::unix_epoch()) - .finish() + let mut cookie = Cookie::build(SESSION_COOKIE_NAME, "DELETED") + .expires(actix_web::cookie::time::OffsetDateTime::UNIX_EPOCH) + .finish(); + cookie.make_removal(); + cookie } pub fn decode_session_cookie_payload(&self, session_cookie: &Cookie) diff --git a/crates/service/web/image_generation_service/Cargo.toml b/crates/service/web/image_generation_service/Cargo.toml deleted file mode 100644 index d6f828654..000000000 --- a/crates/service/web/image_generation_service/Cargo.toml +++ /dev/null @@ -1,130 +0,0 @@ -[package] -publish = false -name = "image-generation-service" -edition = "2018" -version = "0.0.1" -authors = [ - "Brandon Thomas ", - "Brandon Thomas ", -] - -# Main server monolith -[[bin]] -name = "image-generation-service" -path = "src/main.rs" - -[dependencies] - -# Internal -cloud_storage = { path = "../../../lib/api_clients/cloud_storage" } -config = { path = "../../../lib/deprecated/config" } -container_common = { path = "../../../lib/deprecated/container_common" } -errors = { path = "../../../lib/errors" } -google_drive_common = { path = "../../../lib/api_clients/google_drive_common" } -http_server_common = { path = "../../../lib/deprecated/http_server_common" } -jobs_common = { path = "../../../lib/jobs_common" } -memory_caching = { path = "../../../lib/caching/memory_caching" } -mysql_queries = { path = "../../../lib/mysql_queries" } -redis_common = { path = "../../../lib/redis_common" } -reusable_types = { path = "../../../_types/reusable_types" } -tts_common = { path = "../../../lib/tts_common" } -twitch_common = { path = "../../../lib/api_clients/twitch_common" } -user_input_common = { path = "../../../lib/user_input_common" } - -# External -anyhow = "1.0.40" -base64 = "0.13.0" -chrono = { version = "0.4.19", features = ["serde"] } -derive_more = "0.99.14" -dotenv = "0.15.0" -easyenv = "0.0.9" -hex = "0.4.3" -hostname = "0.3.1" -lazy_static = "1.4.0" -lexical-sort = "0.3.1" -lfu = "0.2.5" -log = "0.4.14" -once_cell = "1.9.0" -rand = "0.8.3" -regex = "1.5.4" -time = "0.2.26" -uuid = { version = "0.8.2", features = ["v4"] } - -# Language tag parsing -# TODO: Move to language support crate -language-tags = "0.3.2" # Parsing single tags richly - -# HTTP -# TODO/NB: This is just for Twitch, but we might need it later. -reqwest = { version = "0.11.4" } -native-tls = "0.2.8" - -# Runtime -# NB: We switched to Tokio from `async-std` for broader ecosystem support. -tokio = { version = "1.6.0", features = ["macros"] } - -# Futures -futures = { version = "0.3.17", features = ["thread-pool"] } # feature for ThreadPool -futures-util = "0.3.9" -futures_old_for_limiter = { package = "futures", version = "0.1.29" } # Older version of futures for `limiter` crate - -# MySql Database -# "offline" supports typesafe builds without a live database -# "rustls" doesn't appear to work with IP addresses, per: -# https://github.com/launchbadge/sqlx/issues/1095#issuecomment-798050828 -sqlx = { version = "0.6.2", features = [ "mysql", "runtime-actix-native-tls", "offline", "chrono" ] } - -# Redis Database -limitation = "0.1.1" # Redis rate limiter -r2d2_redis = "0.14.0" - -# In-memory caching -lru_time_cache = "0.11.11" - -# Files -data-encoding = "2.3.2" -ring = "0.17.0-alpha.10" -infer = "0.5.0" - -# The "never-encode-slash" feature seems to have been removed: -# https://github.com/durch/rust-s3/pull/254 -rust-s3 = { version = "0.32.3" } - -subprocess = "0.2.6" -tempdir = "0.3.7" - -actix = "0.12.0" -actix-cors = "0.6.0-beta.3" -actix-files= "0.6.0-beta.8" -actix-http = "3.0.0-beta.11" -actix-multipart = "0.4.0-beta.7" -actix-rt = "2.4.0" -actix-service = "2.0.1" -actix-utils = "3.0.0" -actix-web = "4.0.0-beta.10" -actix-web-actors = "4.0.0-beta.7" -jwt = "0.13.0" - -# NB: Hyper is just for HTTP client use in jobs. I'd use Actix client, but I need tokio runtime -# NB: Furthermore, the Tokio runtime is old, so I have to use an older Hyper. -hyper = { version = "0.14.14" } - -# Crypto -bcrypt = "0.8" # password hashes -hmac = "0.10.0" # cookies -magic-crypt = "3.1.8" # encrypting sort IDs for the frontend so we don't leak info -md-5 = "0.9.1" # gravatar -sha2 = "0.9.5" # file hashes, inference text hashes, etc. - -# Serialization -serde = "1.0.125" -serde_derive = "1.0.125" -serde_json = "1.0.64" -toml = "0.5.8" - -# Text processing -pulldown-cmark = "0.8.0" - -[build-dependencies] -# NB: Only using diesel for migrations support -diesel = { version = "1.4.6", features = ["mysql"] } diff --git a/crates/service/web/image_generation_service/src/main.rs b/crates/service/web/image_generation_service/src/main.rs deleted file mode 100644 index eedcba781..000000000 --- a/crates/service/web/image_generation_service/src/main.rs +++ /dev/null @@ -1,247 +0,0 @@ -// Never allow these -#![forbid(private_in_public)] -#![forbid(unused_must_use)] // NB: It's unsafe to not close/check some things - -// Okay to toggle -//#![forbid(warnings)] -#![allow(unreachable_patterns)] -#![allow(unused_imports)] -#![allow(unused_mut)] -#![allow(unused_variables)] - -// Always allow -#![allow(dead_code)] -#![allow(non_snake_case)] - -#[macro_use] extern crate lazy_static; -#[macro_use] extern crate magic_crypt; -#[macro_use] extern crate serde_derive; - -mod routes; -mod server_state; - -use actix_web::middleware::{DefaultHeaders, Logger}; -use actix_web::{App, HttpServer, web}; -use cloud_storage::bucket_client::BucketClient; -use config::common_env::CommonEnv; -use config::shared_constants::{DEFAULT_MYSQL_CONNECTION_STRING, DEFAULT_RUST_LOG}; -use errors::AnyhowResult; -use crate::routes::add_routes; -use crate::server_state::{EnvConfig, InMemoryCaches, ServerState}; -use http_server_common::cors::build_production_cors_config; -use limitation::Limiter; -use log::info; -use memory_caching::single_item_ttl_cache::SingleItemTtlCache; -use r2d2_redis::{r2d2, RedisConnectionManager}; -use sqlx::mysql::MySqlPoolOptions; -use std::sync::Arc; -use std::time::Duration; -use tokio::runtime::Runtime; - -const DEFAULT_BIND_ADDRESS : &'static str = "0.0.0.0:12345"; - -#[actix_web::main] -async fn main() -> AnyhowResult<()> { - easyenv::init_all_with_default_logging(Some(DEFAULT_RUST_LOG)); - - // NB: Do not check this secrets-containing dotenv file into VCS. - // This file should only contain *development* secrets, never production. - let _ = dotenv::from_filename(".env-secrets").ok(); - - let common_env = CommonEnv::read_from_env()?; // TODO: Deprecate and remove - - info!("Obtaining hostname..."); - - let server_hostname = hostname::get() - .ok() - .and_then(|h| h.into_string().ok()) - .unwrap_or("image-generation-service".to_string()); - - info!("Hostname: {}", &server_hostname); - - info!("Connecting to database..."); - - let db_connection_string = - easyenv::get_env_string_or_default( - "MYSQL_URL", - DEFAULT_MYSQL_CONNECTION_STRING); - - let pool = MySqlPoolOptions::new() - .max_connections(easyenv::get_env_num("MYSQL_MAX_CONNECTIONS", 5)?) - .connect(&db_connection_string) - .await?; - - // let firehose_publisher = FirehosePublisher { - // mysql_pool: pool.clone(), // NB: Pool is clone/sync/send-safe - // }; - // - // let badge_granter = BadgeGranter { - // mysql_pool: pool.clone(), // NB: Pool is clone/sync/send-safe - // firehose_publisher: firehose_publisher.clone(), // NB: Also safe - // }; - - let redis_manager = RedisConnectionManager::new( - common_env.redis_0_connection_string.clone())?; - - let redis_pool = r2d2::Pool::builder() - .build(redis_manager)?; - - info!("Setting up Redis rate limiters..."); - - //let logged_out_redis_rate_limiter = { - // let limiter_enabled = easyenv::get_env_bool_or_default("LIMITER_LOGGED_OUT_ENABLED", true); - // let limiter_max_requests = easyenv::get_env_num("LIMITER_LOGGED_OUT_MAX_REQUESTS", 3)?; - // let limiter_window_seconds = easyenv::get_env_num("LIMITER_LOGGED_OUT_WINDOW_SECONDS", 10)?; - // - // let limiter = Limiter::build(&common_env.redis_0_connection_string) - // .limit(limiter_max_requests) - // .period(Duration::from_secs(limiter_window_seconds)) - // .finish()?; - // - // RedisRateLimiter::new(limiter, "logged_out", limiter_enabled) - //}; - - //let logged_in_redis_rate_limiter = { - // let limiter_enabled = easyenv::get_env_bool_or_default("LIMITER_LOGGED_IN_ENABLED", true); - // let limiter_max_requests = easyenv::get_env_num("LIMITER_LOGGED_IN_MAX_REQUESTS", 3)?; - // let limiter_window_seconds = easyenv::get_env_num("LIMITER_LOGGED_IN_WINDOW_SECONDS", 10)?; - // - // let limiter = Limiter::build(&common_env.redis_0_connection_string) - // .limit(limiter_max_requests) - // .period(Duration::from_secs(limiter_window_seconds)) - // .finish()?; - // - // RedisRateLimiter::new(limiter, "logged_in", limiter_enabled) - //}; - - //let api_high_priority_redis_rate_limiter = { - // let limiter_enabled = easyenv::get_env_bool_or_default("LIMITER_API_HIGH_PRIORITY_ENABLED", true); - // let limiter_max_requests = easyenv::get_env_num("LIMITER_API_HIGH_PRIORITY_MAX_REQUESTS", 30)?; - // let limiter_window_seconds = easyenv::get_env_num("LIMITER_API_HIGH_PRIORITY_WINDOW_SECONDS", 30)?; - // - // let limiter = Limiter::build(&common_env.redis_0_connection_string) - // .limit(limiter_max_requests) - // .period(Duration::from_secs(limiter_window_seconds)) - // .finish()?; - // - // RedisRateLimiter::new(limiter, "api_high_priority", limiter_enabled) - //}; - - //let model_upload_rate_limiter = { - // let limiter_enabled = easyenv::get_env_bool_or_default("LIMITER_MODEL_UPLOAD_ENABLED", true); - // let limiter_max_requests = easyenv::get_env_num("LIMITER_MODEL_UPLOAD_MAX_REQUESTS", 3)?; - // let limiter_window_seconds = easyenv::get_env_num("LIMITER_MODEL_UPLOAD_WINDOW_SECONDS", 10)?; - // - // let limiter = Limiter::build(&common_env.redis_0_connection_string) - // .limit(limiter_max_requests) - // .period(Duration::from_secs(limiter_window_seconds)) - // .finish()?; - // - // RedisRateLimiter::new(limiter, "model_upload", limiter_enabled) - //}; - - info!("Reading env vars and setting up utils..."); - - let bind_address = easyenv::get_env_string_or_default("BIND_ADDRESS", DEFAULT_BIND_ADDRESS); - let num_workers = easyenv::get_env_num("NUM_WORKERS", 8)?; - let hmac_secret = easyenv::get_env_string_or_default("COOKIE_SECRET", "notsecret"); - let cookie_domain = easyenv::get_env_string_or_default("COOKIE_DOMAIN", ".vo.codes"); - let cookie_secure = easyenv::get_env_bool_or_default("COOKIE_SECURE", true); - let cookie_http_only = easyenv::get_env_bool_or_default("COOKIE_HTTP_ONLY", true); - let website_homepage_redirect = - easyenv::get_env_string_or_default("WEBSITE_HOMEPAGE_REDIRECT", "https://vo.codes/"); - - //let cookie_manager = CookieManager::new(&cookie_domain, &hmac_secret); - //let session_checker = SessionChecker::new(&cookie_manager); - - let access_key = easyenv::get_env_string_required("ACCESS_KEY")?; - let secret_key = easyenv::get_env_string_required("SECRET_KEY")?; - let region_name = easyenv::get_env_string_required("REGION_NAME")?; - - // NB: This secret really isn't too important. - // We can even rotate it without too much impact to users. - //let sort_key_crypto_secret = - // easyenv::get_env_string_or_default("SORT_KEY_SECRET", "webscale"); - //let sort_key_crypto = SortKeyCrypto::new(&sort_key_crypto_secret); - - // Background jobs. - - // let health_check_status = HealthCheckStatus::new(); - // let health_check_status2 = health_check_status.clone(); - // let ip_banlist = IpBanlistSet::new(); - // let ip_banlist2 = ip_banlist.clone(); - // let mysql_pool3 = pool.clone(); - // let mysql_pool4 = pool.clone(); - - let tokio_runtime = Runtime::new()?; - - // info!("Spawning DB health checker thread."); - // - // tokio_runtime.spawn(async { - // db_health_checker_thread(health_check_status2, mysql_pool3).await; - // }); - // - // info!("Spawning IP ban polling thread."); - // - // tokio_runtime.spawn(async { - // poll_ip_bans(ip_banlist2, mysql_pool4).await; - // }); - - let server_state = ServerState { - env_config: EnvConfig { - num_workers, - bind_address, - cookie_domain, - cookie_secure, - cookie_http_only, - website_homepage_redirect, - }, - hostname: server_hostname, - mysql_pool: pool, - redis_pool, - caches: InMemoryCaches { - }, - }; - - serve(server_state) - .await?; - Ok(()) -} - -pub async fn serve(server_state: ServerState) -> AnyhowResult<()> -{ - let bind_address = server_state.env_config.bind_address.clone(); - let num_workers = server_state.env_config.num_workers.clone(); - let hostname = server_state.hostname.clone(); - - let server_state_arc = web::Data::new(Arc::new(server_state)); - - info!("Starting HTTP service."); - - let log_format = "[%{HOSTNAME}e] %a \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\" %T"; - - HttpServer::new(move || { - // NB: Safe to clone due to internal arc - //let ip_banlist = server_state_arc.ip_banlist.clone(); - let build_sha = std::fs::read_to_string("/GIT_SHA").unwrap_or(String::from("unknown")); - - let app = App::new() - .app_data(server_state_arc.clone()) - .wrap(build_production_cors_config()) - .wrap(DefaultHeaders::new() - .header("X-Backend-Hostname", &hostname) - .header("X-Build-Sha", build_sha.trim())) - //.wrap(IpFilter::new(ip_banlist)) - .wrap(Logger::new(&log_format) - .exclude("/liveness") - .exclude("/readiness")); - - add_routes(app) - }) - .bind(bind_address)? - .workers(num_workers) - .run() - .await?; - - Ok(()) -} diff --git a/crates/service/web/image_generation_service/src/routes.rs b/crates/service/web/image_generation_service/src/routes.rs deleted file mode 100644 index cf0ac3de1..000000000 --- a/crates/service/web/image_generation_service/src/routes.rs +++ /dev/null @@ -1,29 +0,0 @@ -use actix_http::body::MessageBody; -use actix_service::ServiceFactory; -use actix_web::dev::{ServiceRequest, ServiceResponse}; -use actix_web::error::Error; -use actix_web::{App, web, HttpResponse}; -use http_server_common::endpoints::default_route_404::default_route_404; -use http_server_common::endpoints::root_index::get_root_index; - -pub fn add_routes (app: App) -> App - where - B: MessageBody, - T: ServiceFactory< - ServiceRequest, - Config = (), - Response = ServiceResponse, - Error = Error, - InitError = (), - >, -{ - app - //.service(web::resource("/_status") - // .route(web::get().to(get_health_check_handler)) - // .route(web::head().to(|| HttpResponse::Ok()))) - .service(web::resource("/") - .route(web::get().to(get_root_index)) - .route(web::head().to(|| HttpResponse::Ok())) - ) - .default_service( web::route().to(default_route_404)) -} diff --git a/crates/service/web/image_generation_service/src/server_state.rs b/crates/service/web/image_generation_service/src/server_state.rs deleted file mode 100644 index 16a4276c9..000000000 --- a/crates/service/web/image_generation_service/src/server_state.rs +++ /dev/null @@ -1,59 +0,0 @@ -use r2d2_redis::{r2d2, RedisConnectionManager}; -use sqlx::MySqlPool; - -/// State that is injected into every endpoint. -pub struct ServerState { - pub env_config: EnvConfig, - - pub hostname: String, - - //pub health_check_status: HealthCheckStatus, - - pub mysql_pool: MySqlPool, - - pub redis_pool: r2d2::Pool, - - //pub redis_rate_limiters: RedisRateLimiters, - - //pub cookie_manager: CookieManager, - - //pub session_checker: SessionChecker, - - //pub sort_key_crypto: SortKeyCrypto, - - //pub ip_banlist: IpBanlistSet, - - pub caches: InMemoryCaches, -} - -#[derive(Clone)] -pub struct EnvConfig { - // Number of thread workers. - pub num_workers: usize, - pub bind_address: String, - pub cookie_domain: String, - pub cookie_secure: bool, - pub cookie_http_only: bool, - pub website_homepage_redirect: String, -} - -/// Different rate limiters for different users -//#[derive(Clone)] -//pub struct RedisRateLimiters { -// /// Logged out users have stricter limits -// pub logged_out: RedisRateLimiter, -// -// /// Logged in users have a little more leeway -// pub logged_in: RedisRateLimiter, -// -// /// API consumers have even higher priority -// /// (Temporary for VidVoice.ai; a long term solution builds an in-memory cache -// /// of these or finds a better rate limit library that allows on-demand rate -// /// constructions) -// pub api_high_priority: RedisRateLimiter, -//} - -/// In-memory caches -#[derive(Clone)] -pub struct InMemoryCaches { -} diff --git a/crates/service/web/storyteller_web/Cargo.toml b/crates/service/web/storyteller_web/Cargo.toml index fabf0eee2..549956f1a 100644 --- a/crates/service/web/storyteller_web/Cargo.toml +++ b/crates/service/web/storyteller_web/Cargo.toml @@ -96,6 +96,8 @@ tokio = { version = "1.6.0", features = ["macros"] } futures = { version = "0.3.17", features = ["thread-pool"] } # feature for ThreadPool futures-util = "0.3.9" futures_old_for_limiter = { package = "futures", version = "0.1.29" } # Older version of futures for `limiter` crate +futures-core = "0.3.26" # NB: For middleware/futures upgrade +pin-project-lite = "0.2.9" # NB: For middleware/futures upgrade # MySql Database # "offline" supports typesafe builds without a live database diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/api_tokens/create_api_token.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/api_tokens/create_api_token.rs index 4a330743e..437adb606 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/api_tokens/create_api_token.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/api_tokens/create_api_token.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/api_tokens/delete_api_token.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/api_tokens/delete_api_token.rs index 519acfe40..212fdb2eb 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/api_tokens/delete_api_token.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/api_tokens/delete_api_token.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/api_tokens/edit_api_token.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/api_tokens/edit_api_token.rs index ce39738d7..4b47d6465 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/api_tokens/edit_api_token.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/api_tokens/edit_api_token.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/api_tokens/list_api_tokens.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/api_tokens/list_api_tokens.rs index 8ca31e247..ee7ad75b2 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/api_tokens/list_api_tokens.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/api_tokens/list_api_tokens.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/categories/create_category.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/categories/create_category.rs index 012f20d6d..57816d691 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/categories/create_category.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/categories/create_category.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/categories/get_category.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/categories/get_category.rs index bc5866b5b..998c3154b 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/categories/get_category.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/categories/get_category.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/categories/tts/assign_tts_category.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/categories/tts/assign_tts_category.rs index b81b221ba..7ad1bb930 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/categories/tts/assign_tts_category.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/categories/tts/assign_tts_category.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/download_job/enqueue_generic_download.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/download_job/enqueue_generic_download.rs index 386758e1d..5b1df4262 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/download_job/enqueue_generic_download.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/download_job/enqueue_generic_download.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/download_job/get_generic_upload_job_status.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/download_job/get_generic_upload_job_status.rs index 0ba7af44a..ac7692508 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/download_job/get_generic_upload_job_status.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/download_job/get_generic_upload_job_status.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/events/list_events.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/events/list_events.rs index 21457af5f..dd6bf16f3 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/events/list_events.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/events/list_events.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/inference_job/get_inference_job_status.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/inference_job/get_inference_job_status.rs index ec771d6af..eee988253 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/inference_job/get_inference_job_status.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/inference_job/get_inference_job_status.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/investor_demo/disable_demo_mode_handler.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/investor_demo/disable_demo_mode_handler.rs index ddbd07086..b22c85faf 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/investor_demo/disable_demo_mode_handler.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/investor_demo/disable_demo_mode_handler.rs @@ -1,17 +1,17 @@ use actix_http::header; -use actix_http::http::StatusCode; use actix_web::cookie::Cookie; +use actix_web::cookie::time::OffsetDateTime; +use actix_web::http::StatusCode; use actix_web::web::Query; use actix_web::{HttpResponse, HttpRequest, Responder, get, web, HttpMessage}; use crate::http_server::endpoints::investor_demo::default_redirect::{DEFAULT_INVESTOR_REDIRECT, redirect_is_allowed}; use crate::http_server::endpoints::investor_demo::demo_cookie::STORYTELLER_DEMO_COOKIE_NAME; use crate::server_state::ServerState; +use http_server_common::request::get_request_host::get_request_host; use hyper::header::LOCATION; use log::info; use std::ops::Deref; use std::sync::Arc; -use time::OffsetDateTime; -use http_server_common::request::get_request_host::get_request_host; #[derive(Deserialize)] pub struct QueryFields { @@ -48,7 +48,7 @@ pub async fn disable_demo_mode_handler( // Kill the cookie let mut cookie_builder = Cookie::build(STORYTELLER_DEMO_COOKIE_NAME, "") .secure(server_state.env_config.cookie_secure) // HTTPS-only - .expires(OffsetDateTime::unix_epoch()) + .expires(OffsetDateTime::UNIX_EPOCH) .http_only(false) // This is meant to be exposed to Javascript! // NB: Since we're setting this from direct HTTP access rather than XHR, the browser // implicitly sets the path used to access the cookie, ie. '/demo_mode', which is not what @@ -60,10 +60,11 @@ pub async fn disable_demo_mode_handler( cookie_builder = cookie_builder.domain(cookie_domain); } - let cookie = cookie_builder.finish(); + let mut cookie = cookie_builder.finish(); + cookie.make_removal(); // Remove the cookie HttpResponse::build(StatusCode::FOUND) .append_header((header::LOCATION, safe_redirect_url.to_string())) - .del_cookie(&cookie) + .cookie(cookie) .finish() } diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/investor_demo/enable_demo_mode_handler.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/investor_demo/enable_demo_mode_handler.rs index 2f75d9d20..54f3482bf 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/investor_demo/enable_demo_mode_handler.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/investor_demo/enable_demo_mode_handler.rs @@ -1,17 +1,16 @@ use actix_http::header; -use actix_http::http::StatusCode; use actix_web::cookie::Cookie; +use actix_web::http::StatusCode; use actix_web::web::Query; use actix_web::{HttpResponse, HttpRequest, Responder, get, web, HttpMessage}; use crate::http_server::endpoints::investor_demo::default_redirect::{DEFAULT_INVESTOR_REDIRECT, redirect_is_allowed}; use crate::http_server::endpoints::investor_demo::demo_cookie::STORYTELLER_DEMO_COOKIE_NAME; use crate::server_state::ServerState; -use hyper::header::LOCATION; +use http_server_common::request::get_request_host::get_request_host; use log::info; use std::ops::Deref; use std::sync::Arc; use time::OffsetDateTime; -use http_server_common::request::get_request_host::get_request_host; #[derive(Deserialize)] pub struct QueryFields { diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/media_uploads/list_user_media_uploads_of_type.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/media_uploads/list_user_media_uploads_of_type.rs index b7b20bb06..95c86b772 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/media_uploads/list_user_media_uploads_of_type.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/media_uploads/list_user_media_uploads_of_type.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/misc/default_route_404.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/misc/default_route_404.rs index 6bc7403c1..dd7987189 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/misc/default_route_404.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/misc/default_route_404.rs @@ -1,4 +1,3 @@ -use actix_http::http::StatusCode; use actix_web::{HttpResponse, HttpRequest, Responder, get}; use log::warn; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/misc/detect_locale_handler.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/misc/detect_locale_handler.rs index 0682b2ad6..f23e545be 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/misc/detect_locale_handler.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/misc/detect_locale_handler.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/misc/enable_alpha_easy_handler.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/misc/enable_alpha_easy_handler.rs index c93aea0d4..122c0cf4c 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/misc/enable_alpha_easy_handler.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/misc/enable_alpha_easy_handler.rs @@ -1,10 +1,9 @@ use actix_web::cookie::Cookie; -use actix_http::http::StatusCode; +use actix_web::http::header::LOCATION; use actix_web::web::Query; use actix_web::{HttpResponse, HttpRequest, Responder, get, web, HttpMessage}; use crate::http_server::endpoints::misc::alpha_cookie::alpha_cookie; use crate::server_state::ServerState; -use hyper::header::LOCATION; use log::info; use std::ops::Deref; use std::sync::Arc; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/misc/enable_alpha_handler.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/misc/enable_alpha_handler.rs index b07d76375..b92ee7bbd 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/misc/enable_alpha_handler.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/misc/enable_alpha_handler.rs @@ -1,5 +1,5 @@ use actix_web::cookie::Cookie; -use actix_http::http::StatusCode; +use actix_web::http::StatusCode; use actix_web::web::Query; use actix_web::{HttpResponse, HttpRequest, Responder, get, web, HttpMessage}; use crate::http_server::endpoints::misc::alpha_cookie::{ALPHA_COOKIE_NAME, alpha_cookie}; @@ -26,7 +26,7 @@ pub async fn enable_alpha_handler(http_request: HttpRequest, { info!("GET /alpha"); - let cookie = alpha_cookie(&server_state); + let mut cookie = alpha_cookie(&server_state); match query.enable { None => { @@ -45,9 +45,11 @@ pub async fn enable_alpha_handler(http_request: HttpRequest, ALPHA_COOKIE_NAME, ENABLE_LINK, DISABLE_LINK, STATUS_LINK)) } Some(false) => { + cookie.make_removal(); // Delete cookie + HttpResponse::build(StatusCode::OK) .content_type(CONTENT_TYPE) - .del_cookie(&cookie) + .cookie(cookie) .body(format!("

Vocodes 2.0

unsetting `{}` cookie

{} | {} | {}", ALPHA_COOKIE_NAME, ENABLE_LINK, DISABLE_LINK, STATUS_LINK)) } diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/misc/root_index.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/misc/root_index.rs index 960d858d0..68dfd6ca4 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/misc/root_index.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/misc/root_index.rs @@ -1,7 +1,7 @@ -use actix_http::http::StatusCode; use actix_web::Error; use actix_web::Responder; use actix_web::Result; +use actix_web::http::StatusCode; use actix_web::web::Data; use actix_web::{HttpResponse, HttpRequest, get}; use crate::server_state::ServerState; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/approval/pending_w2l_templates.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/approval/pending_w2l_templates.rs index ac64726e6..2b7de326f 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/approval/pending_w2l_templates.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/approval/pending_w2l_templates.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/categories/delete_category.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/categories/delete_category.rs index 1a5855a71..3ddecb079 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/categories/delete_category.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/categories/delete_category.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/categories/edit_category.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/categories/edit_category.rs index 97f4253a0..8baeb7646 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/categories/edit_category.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/categories/edit_category.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/categories/list_tts_categories_for_moderation.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/categories/list_tts_categories_for_moderation.rs index ac52242b9..410a2805a 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/categories/list_tts_categories_for_moderation.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/categories/list_tts_categories_for_moderation.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/ip_bans/add_ip_ban.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/ip_bans/add_ip_ban.rs index 5fd2a159c..12e395812 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/ip_bans/add_ip_ban.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/ip_bans/add_ip_ban.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/ip_bans/delete_ip_ban.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/ip_bans/delete_ip_ban.rs index 2b1e7714a..031059579 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/ip_bans/delete_ip_ban.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/ip_bans/delete_ip_ban.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/ip_bans/get_ip_ban.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/ip_bans/get_ip_ban.rs index 28ffb360c..b0db4e5ac 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/ip_bans/get_ip_ban.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/ip_bans/get_ip_ban.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/ip_bans/list_ip_bans.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/ip_bans/list_ip_bans.rs index cb74ccf78..a07e2236f 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/ip_bans/list_ip_bans.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/ip_bans/list_ip_bans.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/jobs/get_tts_inference_queue_count.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/jobs/get_tts_inference_queue_count.rs index 2622e5d8a..0e9dafc4e 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/jobs/get_tts_inference_queue_count.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/jobs/get_tts_inference_queue_count.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/jobs/get_w2l_inference_queue_count.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/jobs/get_w2l_inference_queue_count.rs index ac19f61c5..53bd1f970 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/jobs/get_w2l_inference_queue_count.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/jobs/get_w2l_inference_queue_count.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::cookie::Cookie; use actix_web::HttpResponseBuilder; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/jobs/kill_tts_inference_jobs.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/jobs/kill_tts_inference_jobs.rs index c9af3e565..2e3daa7de 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/jobs/kill_tts_inference_jobs.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/jobs/kill_tts_inference_jobs.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/stats/get_voice_count_stats.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/stats/get_voice_count_stats.rs index ad0a7cbb8..ffa7b2568 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/stats/get_voice_count_stats.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/stats/get_voice_count_stats.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_bans/ban_user.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_bans/ban_user.rs index 4fd6d5122..534a30b90 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_bans/ban_user.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_bans/ban_user.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_bans/list_banned_users.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_bans/list_banned_users.rs index 310c64a9a..4c207aaa8 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_bans/list_banned_users.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_bans/list_banned_users.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::cookie::Cookie; use actix_web::HttpResponseBuilder; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_roles/list_roles.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_roles/list_roles.rs index 876515e56..64032091e 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_roles/list_roles.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_roles/list_roles.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_roles/list_staff.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_roles/list_staff.rs index f0816027e..85ac53f10 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_roles/list_staff.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_roles/list_staff.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_roles/set_user_role.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_roles/set_user_role.rs index 2f97a6f2f..556f23cdd 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_roles/set_user_role.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/user_roles/set_user_role.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/users/list_users.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/users/list_users.rs index 30f840e6a..57340bd5f 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/users/list_users.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/moderation/users/list_users.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/service/health_check_handler.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/service/health_check_handler.rs index 9fd046343..d75f0b78b 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/service/health_check_handler.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/service/health_check_handler.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/stubs/app_model_downloads.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/stubs/app_model_downloads.rs index b44bea307..bf59c08d3 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/stubs/app_model_downloads.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/stubs/app_model_downloads.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/stubs/app_news.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/stubs/app_news.rs index 24609dfa8..33500ea5c 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/stubs/app_news.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/stubs/app_news.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/stubs/app_plans.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/stubs/app_plans.rs index ec9762219..30daed717 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/stubs/app_plans.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/stubs/app_plans.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/stubs/post_app_analytics.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/stubs/post_app_analytics.rs index 4c719eae3..dc5a79d73 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/stubs/post_app_analytics.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/stubs/post_app_analytics.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/tts/delete_tts_model.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/tts/delete_tts_model.rs index 739febf9a..c21fe83e4 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/tts/delete_tts_model.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/tts/delete_tts_model.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/tts/delete_tts_result.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/tts/delete_tts_result.rs index 450d638f1..302b81aec 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/tts/delete_tts_result.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/tts/delete_tts_result.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/tts/get_tts_inference_job_status.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/tts/get_tts_inference_job_status.rs index c4ea9ad27..11be0da4b 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/tts/get_tts_inference_job_status.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/tts/get_tts_inference_job_status.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/tts/get_tts_model_use_count.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/tts/get_tts_model_use_count.rs index a1936be3a..9845795bb 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/tts/get_tts_model_use_count.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/tts/get_tts_model_use_count.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::cookie::Cookie; use actix_web::HttpResponseBuilder; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/tts/get_tts_result.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/tts/get_tts_result.rs index abaca6cb6..cffff7e18 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/tts/get_tts_result.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/tts/get_tts_result.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/tts/get_tts_upload_model_job_status.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/tts/get_tts_upload_model_job_status.rs index e03d3ac54..c9fbb5550 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/tts/get_tts_upload_model_job_status.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/tts/get_tts_upload_model_job_status.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/tts/list_user_tts_inference_results.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/tts/list_user_tts_inference_results.rs index ee05dde7b..5917988e7 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/tts/list_user_tts_inference_results.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/tts/list_user_tts_inference_results.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/tts/list_user_tts_models.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/tts/list_user_tts_models.rs index e78c62717..22b61bb00 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/tts/list_user_tts_models.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/tts/list_user_tts_models.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/create_event_rule.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/create_event_rule.rs index 3cf38460b..d07c0f7c7 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/create_event_rule.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/create_event_rule.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/delete_event_rule.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/delete_event_rule.rs index 232af3bf7..586835816 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/delete_event_rule.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/delete_event_rule.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/edit_event_rule.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/edit_event_rule.rs index 7741a5723..83ed8b898 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/edit_event_rule.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/edit_event_rule.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/get_event_rule.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/get_event_rule.rs index 6795a7fc5..7707f7eda 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/get_event_rule.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/get_event_rule.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/list_event_rules_for_user.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/list_event_rules_for_user.rs index 19d337e14..d51b7eb8a 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/list_event_rules_for_user.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/list_event_rules_for_user.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/reorder_twitch_event_rules.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/reorder_twitch_event_rules.rs index 5a7b8e6c4..9e8b9fefe 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/reorder_twitch_event_rules.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/twitch/event_rules/reorder_twitch_event_rules.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/voice_clone_requests/check_if_voice_clone_request_submitted.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/voice_clone_requests/check_if_voice_clone_request_submitted.rs index 897f07075..1187e3824 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/voice_clone_requests/check_if_voice_clone_request_submitted.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/voice_clone_requests/check_if_voice_clone_request_submitted.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/voice_clone_requests/create_voice_clone_request.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/voice_clone_requests/create_voice_clone_request.rs index a8c7252e1..1fbdadc26 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/voice_clone_requests/create_voice_clone_request.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/voice_clone_requests/create_voice_clone_request.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/delete_w2l_result.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/delete_w2l_result.rs index d0b70e8f2..ca3b0a5ad 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/delete_w2l_result.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/delete_w2l_result.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/delete_w2l_template.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/delete_w2l_template.rs index 3a9397b27..7fe5bcf79 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/delete_w2l_template.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/delete_w2l_template.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_inference_job_status.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_inference_job_status.rs index 0e7749a32..99cbd92ca 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_inference_job_status.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_inference_job_status.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_result.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_result.rs index 5b2a16c27..be568051f 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_result.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_result.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_template.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_template.rs index 4d135bb63..d3bfe0d3a 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_template.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_template.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_template_use_count.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_template_use_count.rs index e754d9370..53b4338c7 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_template_use_count.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_template_use_count.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::cookie::Cookie; use actix_web::HttpResponseBuilder; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_upload_template_job_status.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_upload_template_job_status.rs index ba9b0f466..cbf4f1458 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_upload_template_job_status.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/get_w2l_upload_template_job_status.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::cookie::Cookie; use actix_web::HttpResponseBuilder; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/list_user_w2l_inference_results.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/list_user_w2l_inference_results.rs index c65b9cd4d..4aaaa24a0 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/list_user_w2l_inference_results.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/list_user_w2l_inference_results.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/list_user_w2l_templates.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/list_user_w2l_templates.rs index e540d8ccb..2bb091cbd 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/list_user_w2l_templates.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/list_user_w2l_templates.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/list_w2l_templates.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/list_w2l_templates.rs index 0f93a69b2..6ade45c83 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/list_w2l_templates.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/list_w2l_templates.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/set_w2l_template_mod_approval.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/set_w2l_template_mod_approval.rs index b2b534a2b..f30d5abcb 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/set_w2l_template_mod_approval.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/w2l/set_w2l_template_mod_approval.rs @@ -1,5 +1,4 @@ use actix_http::Error; -use actix_http::http::header; use actix_web::HttpResponseBuilder; use actix_web::cookie::Cookie; use actix_web::error::ResponseError; diff --git a/crates/service/web/storyteller_web/src/http_server/middleware/pushback_filter_middleware.rs b/crates/service/web/storyteller_web/src/http_server/middleware/pushback_filter_middleware.rs index 1f955a41e..f73d6d84f 100644 --- a/crates/service/web/storyteller_web/src/http_server/middleware/pushback_filter_middleware.rs +++ b/crates/service/web/storyteller_web/src/http_server/middleware/pushback_filter_middleware.rs @@ -1,9 +1,9 @@ use actix_http::StatusCode; -use actix_http::http::{header, HeaderMap, HeaderValue}; -use actix_http::{error, body::Body, Response}; +use actix_http::body::BoxBody; +use actix_http::header::HeaderName; +use actix_http::{error, Response}; use actix_web::dev::{Service, Transform}; use actix_web::dev::{ServiceRequest, ServiceResponse}; -use actix_web::http::HeaderName; use actix_web::http::header::USER_AGENT; use actix_web::web::{BytesMut, Buf, BufMut}; use actix_web::{Error, HttpResponse}; @@ -11,11 +11,16 @@ use actix_web::{ResponseError, HttpMessage, HttpRequest, HttpResponseBuilder}; use crate::http_server::web_utils::response_error_helpers::to_simple_json_error; use crate::server_state::StaticFeatureFlags; use errors::AnyhowResult; +use futures_core::ready; use futures_util::future::{err, ok, Either, Ready}; use http_server_common::request::get_request_ip::get_service_request_ip; -use std::io::Write; -use std::task::{Context, Poll}; use log::warn; +use pin_project_lite::pin_project; +use std::future::Future; +use std::io::Write; +use std::marker::PhantomData; +use std::pin::Pin; +use std::task::{Context, Poll}; // There are two steps in middleware processing. // 1. Middleware initialization, middleware factory gets called with @@ -39,7 +44,7 @@ impl ResponseError for PushbackError { StatusCode::TOO_MANY_REQUESTS } - fn error_response(&self) -> HttpResponse { + fn error_response(&self) -> HttpResponse { // NB: I'm setting a string error code because I mistakenly got caught by this in local dev // and couldn't figure out the issue for a bit. At least I can grep for this string. // However, I need to balance this requirement with not cluing in those that are banned. @@ -62,12 +67,12 @@ impl PushbackFilter { } } -impl Transform for PushbackFilter +impl Transform for PushbackFilter where - S: Service, + S: Service, Error = Error>, S::Future: 'static, { - type Response = ServiceResponse; + type Response = ServiceResponse; type Error = Error; type InitError = (); type Transform = PushbackFilterMiddleware; @@ -83,19 +88,21 @@ pub struct PushbackFilterMiddleware { feature_flags: StaticFeatureFlags, } -impl Service for PushbackFilterMiddleware +impl Service for PushbackFilterMiddleware where - S: Service, + S: Service, Error = Error>, S::Future: 'static, { - type Response = ServiceResponse; + type Response = ServiceResponse; type Error = Error; type Future = Either>>; - // alternatively(?), actix_service::forward_ready!(service); - fn poll_ready(&self, cx: &mut Context) -> Poll> { - self.service.poll_ready(cx) - } + //// alternatively(?), actix_service::forward_ready!(service); + //fn poll_ready(&self, cx: &mut Context) -> Poll> { + // self.service.poll_ready(cx) + //} + + actix_service::forward_ready!(service); fn call(&self, req: ServiceRequest) -> Self::Future { // NB: Ordinarily the filter should be disabled. diff --git a/crates/service/web/storyteller_web/src/http_server/web_utils/get_host_header.rs b/crates/service/web/storyteller_web/src/http_server/web_utils/get_host_header.rs index e3e1bfe86..15879bedd 100644 --- a/crates/service/web/storyteller_web/src/http_server/web_utils/get_host_header.rs +++ b/crates/service/web/storyteller_web/src/http_server/web_utils/get_host_header.rs @@ -1,7 +1,5 @@ -use actix_http::http::HeaderMap; -use actix_http::http::HeaderName; +use actix_http::header::{HeaderMap, HeaderName}; use actix_web::HttpRequest; -use actix_web::http::HeaderValue; use errors::AnyhowResult; // NB: This is extracted because CLion is having incredible difficulty with these types. diff --git a/crates/service/web/storyteller_web/src/http_server/web_utils/redis_rate_limiter.rs b/crates/service/web/storyteller_web/src/http_server/web_utils/redis_rate_limiter.rs index bcdc89e66..a89c8ef25 100644 --- a/crates/service/web/storyteller_web/src/http_server/web_utils/redis_rate_limiter.rs +++ b/crates/service/web/storyteller_web/src/http_server/web_utils/redis_rate_limiter.rs @@ -1,7 +1,7 @@ //! NB: This doesn't live in the `util.redis` package because it depends on `http_server`. //! It's only used for the server anyway, so living here makes sense. -use actix_http::http::{HeaderName, HeaderMap}; +use actix_http::header::HeaderName; use actix_web::HttpRequest; use futures_old_for_limiter::Future; use http_server_common::request::get_request_ip::get_request_ip; diff --git a/crates/service/web/storyteller_web/src/http_server/web_utils/response_error_helpers.rs b/crates/service/web/storyteller_web/src/http_server/web_utils/response_error_helpers.rs index e950731d7..606a3b240 100644 --- a/crates/service/web/storyteller_web/src/http_server/web_utils/response_error_helpers.rs +++ b/crates/service/web/storyteller_web/src/http_server/web_utils/response_error_helpers.rs @@ -1,4 +1,4 @@ -use actix_http::http::header; +use actix_http::header::CONTENT_TYPE; use actix_web::HttpResponseBuilder; use actix_web::http::StatusCode; use actix_web::{HttpResponse, ResponseError}; @@ -25,6 +25,6 @@ pub fn to_simple_json_error( }; HttpResponseBuilder::new(status_code) - .set_header(header::CONTENT_TYPE, "application/json") + .set_header(CONTENT_TYPE, "application/json") .body(body) } \ No newline at end of file diff --git a/crates/service/web/storyteller_web/src/http_server/web_utils/serialize_as_json_error.rs b/crates/service/web/storyteller_web/src/http_server/web_utils/serialize_as_json_error.rs index d288c9205..fa1cb2702 100644 --- a/crates/service/web/storyteller_web/src/http_server/web_utils/serialize_as_json_error.rs +++ b/crates/service/web/storyteller_web/src/http_server/web_utils/serialize_as_json_error.rs @@ -1,4 +1,4 @@ -use actix_http::http::{StatusCode, header}; +use actix_http::header::CONTENT_TYPE; use actix_web::HttpResponse; use actix_web::HttpResponseBuilder; use actix_web::error::ResponseError; @@ -16,6 +16,6 @@ pub fn serialize_as_json_error( }; HttpResponseBuilder::new(error_payload.status_code()) - .set_header(header::CONTENT_TYPE, "application/json") + .set_header(CONTENT_TYPE, "application/json") .body(body) } diff --git a/crates/service/web/storyteller_web/src/main.rs b/crates/service/web/storyteller_web/src/main.rs index 9f3060815..9f28e84a4 100644 --- a/crates/service/web/storyteller_web/src/main.rs +++ b/crates/service/web/storyteller_web/src/main.rs @@ -39,7 +39,6 @@ use actix_helpers::middleware::banned_cidr_filter::load_cidr_ban_set_from_file:: use actix_helpers::middleware::banned_ip_filter::banned_ip_filter::BannedIpFilter; use actix_helpers::middleware::banned_ip_filter::ip_ban_list::ip_ban_list::IpBanList; use actix_helpers::middleware::banned_ip_filter::ip_ban_list::load_ip_ban_list_from_directory::load_ip_ban_list_from_directory; -use actix_http::http; use actix_web::middleware::{Logger, DefaultHeaders}; use actix_web::{HttpServer, web, HttpResponse, App, middleware}; use anyhow::anyhow; diff --git a/crates/service/web/storyteller_web/src/routes.rs b/crates/service/web/storyteller_web/src/routes.rs index e8426661a..da2c27513 100644 --- a/crates/service/web/storyteller_web/src/routes.rs +++ b/crates/service/web/storyteller_web/src/routes.rs @@ -117,7 +117,7 @@ use users_component::default_routes::add_suggested_api_v1_account_creation_and_s use users_component::endpoints::edit_profile_handler::edit_profile_handler; use users_component::endpoints::get_profile_handler::get_profile_handler; -pub fn add_routes (app: App) -> App +pub fn add_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -211,7 +211,7 @@ pub fn add_routes (app: App) -> App // ==================== MODERATOR ROUTES ==================== -fn add_moderator_routes (app: App) -> App +fn add_moderator_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -353,7 +353,7 @@ fn add_moderator_routes (app: App) -> App // ==================== TTS ROUTES ==================== -fn add_tts_routes (app: App) -> App +fn add_tts_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -436,7 +436,7 @@ fn add_tts_routes (app: App) -> App // ==================== WAV2LIP ROUTES ==================== -fn add_w2l_routes (app: App) -> App +fn add_w2l_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -519,7 +519,7 @@ fn add_w2l_routes (app: App) -> App // ==================== WEB VOICE CONVERSION ROUTES ==================== -fn add_web_vc_routes (app: App) -> App +fn add_web_vc_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -603,7 +603,7 @@ fn add_web_vc_routes (app: App) -> App // ==================== VOCODER ROUTES ==================== -fn add_vocoder_routes (app: App) -> App +fn add_vocoder_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -641,7 +641,7 @@ fn add_vocoder_routes (app: App) -> App // ==================== RETRIEVAL ROUTES ("GENERIC_DOWNLOAD_JOBS") ==================== -fn add_remote_download_routes (app: App) -> App +fn add_remote_download_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -664,7 +664,7 @@ fn add_remote_download_routes (app: App) -> App // ==================== CATEGORY ROUTES ==================== -fn add_category_routes (app: App) -> App +fn add_category_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -735,7 +735,7 @@ fn add_category_routes (app: App) -> App // ==================== USER PROFILE ROUTES ==================== -fn add_user_profile_routes (app: App) -> App +fn add_user_profile_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -783,7 +783,7 @@ fn add_user_profile_routes (app: App) -> App // ==================== API TOKEN ROUTES ==================== -fn add_api_token_routes (app: App) -> App +fn add_api_token_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -816,7 +816,7 @@ fn add_api_token_routes (app: App) -> App // ==================== API TOKEN ROUTES ==================== -fn add_voice_clone_request_routes (app: App) -> App +fn add_voice_clone_request_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -841,7 +841,7 @@ fn add_voice_clone_request_routes (app: App) -> App // ==================== INVESTOR DEMO MODE ==================== -fn add_investor_demo_routes (app: App) -> App +fn add_investor_demo_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -866,7 +866,7 @@ fn add_investor_demo_routes (app: App) -> App // ==================== FLAG ROUTES ==================== -fn add_flag_routes (app: App) -> App +fn add_flag_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -893,7 +893,7 @@ fn add_flag_routes (app: App) -> App // ==================== DESKTOP APP ROUTES ==================== -fn add_desktop_app_routes (app: App) -> App +fn add_desktop_app_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -926,7 +926,7 @@ fn add_desktop_app_routes (app: App) -> App // ==================== MEDIA UPLOAD ROUTES ==================== -fn add_media_upload_routes (app: App) -> App +fn add_media_upload_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -955,7 +955,7 @@ fn add_media_upload_routes (app: App) -> App // ==================== TRENDING ROUTES ==================== -fn add_trending_routes (app: App) -> App +fn add_trending_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -975,7 +975,7 @@ fn add_trending_routes (app: App) -> App } // ==================== USER RATING ROUTES ==================== -fn add_user_rating_routes (app: App) -> App +fn add_user_rating_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -1003,7 +1003,7 @@ fn add_user_rating_routes (app: App) -> App // TODO: Maybe move these into an "oauth-gateway" type http service. // We'll want the domain to have reputation and not confuse people. // It'll also be nice to accrue all oauth things here. -fn add_twitch_routes (app: App) -> App +fn add_twitch_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< @@ -1064,7 +1064,7 @@ fn add_twitch_routes (app: App) -> App } // ============= SUBSCRIPTION ROUTES =================== -fn add_subscription_routes (app: App) -> App +fn add_subscription_routes (app: App) -> App where B: MessageBody, T: ServiceFactory< diff --git a/crates/service/web/websocket_gateway/src/main.rs b/crates/service/web/websocket_gateway/src/main.rs index 0581f1a0b..71499311f 100644 --- a/crates/service/web/websocket_gateway/src/main.rs +++ b/crates/service/web/websocket_gateway/src/main.rs @@ -17,7 +17,6 @@ pub mod endpoints_ws; pub mod server_state; use actix_cors::Cors; -use actix_http::http; use actix_web::middleware::{Logger, DefaultHeaders}; use actix_web::{HttpServer, web, HttpResponse, App}; use config::shared_constants::DEFAULT_MYSQL_CONNECTION_STRING; diff --git a/execute_tests.sh b/execute_tests.sh index a7ca5e4a9..d8c3e2e52 100755 --- a/execute_tests.sh +++ b/execute_tests.sh @@ -12,5 +12,12 @@ cargo test \ --exclude sqlite_queries \ --exclude aichatbot-sidecar \ --exclude fakeyou_client \ - --exclude billing_component + --exclude billing_component \ + --exclude inference-job + +# Single broken tests +cargo test \ + --package inference-job \ + -- \ + --skip util::audiowmark::tests::test_audiowmark