only a few compile errors left with storyteller-web

This commit is contained in:
Brandon Thomas committed 2023-07-19 01:09:10 -04:00
1 parent a75c1f391a
commit 9dd91ce7cc
81 files changed
+79 -164

No files matched your search

@@ -1,6 +1,5 @@
use anyhow::anyhow;
use errors::AnyhowResult;
use log::error;
use once_cell::sync::Lazy;
use regex::Regex;
use sqlx::MySqlPool;
@@ -11,13 +11,12 @@ 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<T, B> (app: App<T, B>) -> App<T, B>
pub fn add_suggested_stripe_billing_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -11,13 +11,12 @@ 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<T, B> (app: App<T, B>) -> App<T, B>
pub fn add_suggested_api_v1_account_creation_and_session_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -52,7 +52,7 @@ pub async fn logout_handler(
mysql_pool: web::Data<MySqlPool>,
) -> Result<HttpResponse, LogoutError>
{
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))
}
@@ -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)
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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()
}
@@ -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 {
@@ -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;
@@ -1,4 +1,3 @@
use actix_http::http::StatusCode;
use actix_web::{HttpResponse, HttpRequest, Responder, get};
use log::warn;
@@ -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;
@@ -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;
@@ -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!("<h1>Vocodes 2.0</h1><h2>unsetting `{}` cookie</h2> {} | {} | {}",
ALPHA_COOKIE_NAME, ENABLE_LINK, DISABLE_LINK, STATUS_LINK))
}
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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};
@@ -13,9 +13,9 @@ use crate::server_state::StaticFeatureFlags;
use errors::AnyhowResult;
use futures_util::future::{err, ok, Either, Ready};
use http_server_common::request::get_request_ip::get_service_request_ip;
use log::warn;
use std::io::Write;
use std::task::{Context, Poll};
use log::warn;
// There are two steps in middleware processing.
// 1. Middleware initialization, middleware factory gets called with
@@ -39,7 +39,7 @@ impl ResponseError for PushbackError {
StatusCode::TOO_MANY_REQUESTS
}
fn error_response(&self) -> HttpResponse<Body> {
fn error_response(&self) -> HttpResponse<BoxBody> {
// 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.
@@ -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.
@@ -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;
@@ -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)
}
@@ -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<T>(
};
HttpResponseBuilder::new(error_payload.status_code())
.set_header(header::CONTENT_TYPE, "application/json")
.set_header(CONTENT_TYPE, "application/json")
.body(body)
}
@@ -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;
@@ -1,5 +1,4 @@
use actix_helpers::route_builder::RouteBuilder;
use actix_http::body::MessageBody;
use actix_service::ServiceFactory;
use actix_web::dev::{ServiceRequest, ServiceResponse};
use actix_web::error::Error;
@@ -117,13 +116,12 @@ 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<T, B> (app: App<T, B>) -> App<T, B>
pub fn add_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -211,13 +209,12 @@ pub fn add_routes<T, B> (app: App<T, B>) -> App<T, B>
// ==================== MODERATOR ROUTES ====================
fn add_moderator_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_moderator_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -353,13 +350,12 @@ fn add_moderator_routes<T, B> (app: App<T, B>) -> App<T, B>
// ==================== TTS ROUTES ====================
fn add_tts_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_tts_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -436,13 +432,12 @@ fn add_tts_routes<T, B> (app: App<T, B>) -> App<T, B>
// ==================== WAV2LIP ROUTES ====================
fn add_w2l_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_w2l_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -519,13 +514,12 @@ fn add_w2l_routes<T, B> (app: App<T, B>) -> App<T, B>
// ==================== WEB VOICE CONVERSION ROUTES ====================
fn add_web_vc_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_web_vc_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -603,13 +597,12 @@ fn add_web_vc_routes<T, B> (app: App<T, B>) -> App<T, B>
// ==================== VOCODER ROUTES ====================
fn add_vocoder_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_vocoder_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -641,13 +634,12 @@ fn add_vocoder_routes<T, B> (app: App<T, B>) -> App<T, B>
// ==================== RETRIEVAL ROUTES ("GENERIC_DOWNLOAD_JOBS") ====================
fn add_remote_download_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_remote_download_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -664,13 +656,12 @@ fn add_remote_download_routes<T, B> (app: App<T, B>) -> App<T, B>
// ==================== CATEGORY ROUTES ====================
fn add_category_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_category_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -735,13 +726,12 @@ fn add_category_routes<T, B> (app: App<T, B>) -> App<T, B>
// ==================== USER PROFILE ROUTES ====================
fn add_user_profile_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_user_profile_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -783,13 +773,12 @@ fn add_user_profile_routes<T, B> (app: App<T, B>) -> App<T, B>
// ==================== API TOKEN ROUTES ====================
fn add_api_token_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_api_token_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -816,13 +805,12 @@ fn add_api_token_routes<T, B> (app: App<T, B>) -> App<T, B>
// ==================== API TOKEN ROUTES ====================
fn add_voice_clone_request_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_voice_clone_request_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -841,13 +829,12 @@ fn add_voice_clone_request_routes<T, B> (app: App<T, B>) -> App<T, B>
// ==================== INVESTOR DEMO MODE ====================
fn add_investor_demo_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_investor_demo_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -866,13 +853,12 @@ fn add_investor_demo_routes<T, B> (app: App<T, B>) -> App<T, B>
// ==================== FLAG ROUTES ====================
fn add_flag_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_flag_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -893,13 +879,12 @@ fn add_flag_routes<T, B> (app: App<T, B>) -> App<T, B>
// ==================== DESKTOP APP ROUTES ====================
fn add_desktop_app_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_desktop_app_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -926,13 +911,12 @@ fn add_desktop_app_routes<T, B> (app: App<T, B>) -> App<T, B>
// ==================== MEDIA UPLOAD ROUTES ====================
fn add_media_upload_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_media_upload_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -955,13 +939,12 @@ fn add_media_upload_routes<T, B> (app: App<T, B>) -> App<T, B>
// ==================== TRENDING ROUTES ====================
fn add_trending_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_trending_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -975,13 +958,12 @@ fn add_trending_routes<T, B> (app: App<T, B>) -> App<T, B>
}
// ==================== USER RATING ROUTES ====================
fn add_user_rating_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_user_rating_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -1003,13 +985,12 @@ fn add_user_rating_routes<T, B> (app: App<T, B>) -> App<T, B>
// 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<T, B> (app: App<T, B>) -> App<T, B>
fn add_twitch_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,
@@ -1064,13 +1045,12 @@ fn add_twitch_routes<T, B> (app: App<T, B>) -> App<T, B>
}
// ============= SUBSCRIPTION ROUTES ===================
fn add_subscription_routes<T, B> (app: App<T, B>) -> App<T, B>
fn add_subscription_routes<T> (app: App<T>) -> App<T>
where
B: MessageBody,
T: ServiceFactory<
ServiceRequest,
Config = (),
Response = ServiceResponse<B>,
Response = ServiceResponse,
Error = Error,
InitError = (),
>,