MAYBE BROKEN: Full actix/tokio/etc. upgrade on storyteller-web

This commit is contained in:
Brandon Thomas 2021-11-12 01:12:39 -05:00
parent e424297abf
commit c40d772ebc
68 changed files with 473 additions and 610 deletions

818
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -22,23 +22,12 @@ dotenv = "0.15.0"
log = "0.4.14"
# Web
# NB: One microservice requires old Tokio (thus old actix), and another new Tokio (new actix).
# Thus I'm being extremely extra here and supporting both.
actix-cors-old = { package = "actix-cors", version = "0.5.4", optional = true }
actix-http-old = { package = "actix-http", version = "2.2.0", optional = true }
actix-web-old = { package = "actix-web", version = "3.3.2", optional = true }
actix-cors-new = { package = "actix-cors", version = "0.6.0-beta.3", optional = true }
actix-http-new = { package = "actix-http", version = "3.0.0-beta.11", optional = true }
actix-web-new = { package = "actix-web", version = "4.0.0-beta.10", optional = true }
actix-cors = "0.6.0-beta.3"
actix-http = "3.0.0-beta.11"
actix-web = "4.0.0-beta.10"
# Serialization
serde = "1.0.125"
serde_derive = "1.0.125"
serde_json = "1.0.64"
toml = "0.5.8"
[features]
# default = ["actix-cors-new", "actix-web-new", "actix-http-new"]
actix-new = ["actix-cors-new", "actix-http-new", "actix-web-new"]
actix-old = ["actix-cors-old", "actix-http-old", "actix-web-old"]

View File

@ -10,44 +10,6 @@
// I don't think this will be too hard to maintain. AFAICT, the only major differences are which
// package "HttpResponseBuilder" is located in.
#[cfg(all(feature = "actix-new", not(feature = "actix-old")))]
//#[cfg(feature = "actix-cors-new")]
extern crate actix_cors_new as actix_cors;
#[cfg(all(feature = "actix-new", not(feature = "actix-old")))]
//#[cfg(feature = "actix-http-new")]
extern crate actix_http_new as actix_http;
#[cfg(all(feature = "actix-new", not(feature = "actix-old")))]
//#[cfg(feature = "actix-web-new")]
extern crate actix_web_new as actix_web;
#[cfg(all(feature = "actix-old", not(feature = "actix-new")))]
//#[cfg(feature = "actix-cors-old")]
extern crate actix_cors_old as actix_cors;
#[cfg(all(feature = "actix-old", not(feature = "actix-new")))]
//#[cfg(feature = "actix-http-old")]
extern crate actix_http_old as actix_http;
#[cfg(all(feature = "actix-old", not(feature = "actix-new")))]
//#[cfg(feature = "actix-web-old")]
extern crate actix_web_old as actix_web;
//#[cfg(any(
// all(feature = "actix-cors-new", not(feature = "actix-cors-old")),
// all(feature = "actix-cors-old", not(feature = "actix-cors-new")),
//))]
#[cfg(any(
feature = "actix-new",
feature = "actix-old",
))]
pub mod cors;
#[cfg(any(
feature = "actix-new",
feature = "actix-old",
))]
pub mod endpoints;
#[cfg(any(
feature = "actix-new",
feature = "actix-old",
))]
pub mod response;

View File

@ -1,12 +1,8 @@
use actix_http::http::header;
use actix_web::HttpResponseBuilder;
use actix_web::http::StatusCode;
use actix_web::{HttpResponse, ResponseError};
#[cfg(feature = "actix-new")]
use actix_web::HttpResponseBuilder;
#[cfg(not(feature = "actix-new"))]
use actix_web::dev::HttpResponseBuilder;
#[derive(Serialize)]
pub struct SimpleGenericJsonError {

View File

@ -1,18 +1,8 @@
use actix_http::http::{StatusCode, header};
use actix_web::HttpResponse;
use serde::Serialize;
#[cfg(feature = "actix-new")]
use actix_web::error::ResponseError;
#[cfg(feature = "actix-new")]
use actix_web::HttpResponseBuilder;
#[cfg(not(feature = "actix-new"))]
use actix_http::ResponseError;
#[cfg(not(feature = "actix-new"))]
use actix_web::dev::HttpResponseBuilder;
use actix_web::error::ResponseError;
use serde::Serialize;
/// Turn error responses into JSON HTTP responses
pub fn serialize_as_json_error<T>(

View File

@ -39,7 +39,7 @@ path = "src/w2l_inference_job.rs"
# Internal
config = { path = "../lib/config" }
http_server_common = { path = "../lib/http_server_common", features = ["actix-old"] }
http_server_common = { path = "../lib/http_server_common" }
# External
anyhow = "1.0.40"
@ -67,8 +67,8 @@ uuid = { version = "0.8.2", features = ["v4"] }
#async-std = { version = "1.6", features = [ "attributes" ] }
# NB(2): Really unfortunate. We can't use Tokio 1.x due to a bug in `rust-s3` that I filed:
# https://github.com/durch/rust-s3/issues/198
#tokio = { version = "1.6.0", features = ["macros"] }
tokio = { version = "0.2.25", features = ["macros"] }
tokio = { version = "1.6.0", features = ["macros"] }
#tokio = { version = "0.2.25", features = ["macros"] }
# MySql Database
# "offline" supports typesafe builds without a live database
@ -76,8 +76,8 @@ tokio = { version = "0.2.25", features = ["macros"] }
# https://github.com/launchbadge/sqlx/issues/1095#issuecomment-798050828
#sqlx = { version = "0.5", features = [ "mysql", "runtime-async-std-native-tls", "offline", "chrono" ] }
# NB: We can't use `sqlx` 0.5 due to the `rust-s3` bug that requires a Tokio 1.x -> 0.2 downgrade
#sqlx = { version = "0.5", features = [ "mysql", "runtime-actix-native-tls", "offline", "chrono" ] }
sqlx = { version = "0.4", features = [ "mysql", "runtime-tokio-native-tls", "offline", "chrono" ] }
sqlx = { version = "0.5", features = [ "mysql", "runtime-actix-native-tls", "offline", "chrono" ] }
#sqlx = { version = "0.4", features = [ "mysql", "runtime-tokio-native-tls", "offline", "chrono" ] }
# Redis Database
limitation = "0.1.1" # Redis rate limiter
@ -93,25 +93,39 @@ ring = "0.17.0-alpha.10"
# in the 0.27.* series, so we have to downgrade to 0.26, which includes a broad downgrade from Tokio 1.0 -> 0.2
#rust-s3 = "0.27.0-rc4"
#rust-s3 = { version = "0.27.0-rc4", features = ["with-async-std"], default-features = false }
rust-s3 = { version = "0.26" }
#rust-s3 = { version = "0.26" }
#rust-s3 = { version = "0.28", features = ["with-async-std"], default-features = false }
rust-s3 = { version = "0.28" }
infer = "0.5.0"
subprocess = "0.2.6"
tempdir = "0.3.7"
# Web
actix = "0.10"
actix-cors = "0.5.4"
actix-files= "0.5"
actix-http = "2.2.0"
actix-multipart = "0.3.0" # TODO: Ready for 0.4 upgrade
actix-rt = "2.2.0"
actix-service = "1.0.6"
#actix = "0.10"
#actix-cors = "0.5.4"
#actix-files= "0.5"
#actix-http = "2.2.0"
#actix-rt = "2.2.0"
#actix-service = "1.0.6"
#actix-utils = "3.0.0"
#actix-web = "3.3.2"
#actix-web-actors = "3"
#jwt = "0.13.0"
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" # TODO: Ready for 0.4 upgrade
actix-rt = "2.4.0"
actix-service = "2.0.1"
actix-utils = "3.0.0"
actix-web = "3.3.2"
actix-web-actors = "3"
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.13.10" }

View File

@ -5,7 +5,7 @@ use crate::util::anyhow_result::AnyhowResult;
use crate::util::random_prefix_crockford_token::random_prefix_crockford_token;
use log::{warn,info};
use sqlx::error::Error::Database;
use sqlx::mysql::MySqlDone;
use sqlx::mysql::MySqlQueryResult;
use sqlx::{MySqlPool};
use std::sync::Arc;
@ -314,7 +314,7 @@ SET
Ok(record_id)
}
fn handle_results(query_result: Result<MySqlDone, sqlx::Error>) -> AnyhowResult<u64> {
fn handle_results(query_result: Result<MySqlQueryResult, sqlx::Error>) -> AnyhowResult<u64> {
let record_id = match query_result {
Ok(res) => {
res.last_insert_id()

View File

@ -4,7 +4,7 @@ use crate::util::anyhow_result::AnyhowResult;
use crate::util::random_prefix_crockford_token::random_prefix_crockford_token;
use log::{warn,info};
use sqlx::error::Error::Database;
use sqlx::mysql::MySqlDone;
use sqlx::mysql::MySqlQueryResult;
use sqlx::{MySqlPool};
use std::sync::Arc;
@ -207,7 +207,7 @@ SET
Ok(record_id)
}
fn handle_results(query_result: Result<MySqlDone, sqlx::Error>) -> AnyhowResult<u64> {
fn handle_results(query_result: Result<MySqlQueryResult, sqlx::Error>) -> AnyhowResult<u64> {
let record_id = match query_result {
Ok(res) => {
res.last_insert_id()

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::{Responder, web, HttpResponse, error, HttpRequest, HttpMessage};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::{Responder, web, HttpResponse, error, HttpRequest, HttpMessage};

View File

@ -1,4 +1,4 @@
use actix_http::cookie::Cookie;
use actix_web::cookie::Cookie;
use crate::server_state::ServerState;
pub const ALPHA_COOKIE_NAME : &'static str = "enable-alpha";

View File

@ -1,4 +1,4 @@
use actix_http::cookie::Cookie;
use actix_web::cookie::Cookie;
use actix_http::http::StatusCode;
use actix_web::web::Query;
use actix_web::{HttpResponse, HttpRequest, Responder, get, web, HttpMessage};

View File

@ -1,4 +1,4 @@
use actix_http::cookie::Cookie;
use actix_web::cookie::Cookie;
use actix_http::http::StatusCode;
use actix_web::web::Query;
use actix_web::{HttpResponse, HttpRequest, Responder, get, web, HttpMessage};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::{Responder, web, HttpResponse, error, HttpRequest};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::{Responder, web, HttpResponse, error, HttpRequest};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::{Responder, web, HttpResponse, error, HttpRequest};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::{Responder, web, HttpResponse, error, HttpRequest};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::{Path, Json};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::{Path, Json};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::{Responder, web, HttpResponse, error, HttpRequest};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::{Responder, web, HttpResponse, error, HttpRequest};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::{Responder, web, HttpResponse, error, HttpRequest, HttpMessage};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::{Responder, web, HttpResponse, error, HttpRequest};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::{Path, Query};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::{Path, Query};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::{Responder, web, HttpResponse, error, HttpRequest};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::{Responder, web, HttpResponse, error, HttpRequest, HttpMessage};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::{Responder, web, HttpResponse, error, HttpRequest, HttpMessage};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::{Path, Json};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::{Path, Json};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::{Responder, web, HttpResponse, error, HttpRequest};

View File

@ -1,7 +1,7 @@
use actix_http::http::header;
use actix_multipart::{Multipart, Field};
use actix_web::body::ResponseBody::Body;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::http::StatusCode;
use actix_web::http::header::ContentDisposition;
use actix_web::web::{Data, Json, BytesMut};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::{Responder, web, HttpResponse, error, HttpRequest};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::{Responder, web, HttpResponse, error, HttpRequest, HttpMessage};

View File

@ -1,7 +1,7 @@
use actix_http::Error;
use actix_http::http::header;
use actix_web::cookie::Cookie;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use actix_web::http::StatusCode;
use actix_web::web::Path;

View File

@ -1 +1 @@
pub mod ip_filter_middleware;
//pub mod ip_filter_middleware; // TODO(FIXME): Bad upgrade

View File

@ -1,5 +1,5 @@
use actix_http::http::header;
use actix_web::dev::HttpResponseBuilder;
use actix_web::HttpResponseBuilder;
use actix_web::http::StatusCode;
use actix_web::{HttpResponse, ResponseError};

View File

@ -1,8 +1,8 @@
use actix_http::http::{StatusCode, header};
use actix_web::HttpResponse;
use actix_web::HttpResponseBuilder;
use actix_web::error::ResponseError;
use serde::Serialize;
use actix_http::ResponseError;
use actix_web::dev::HttpResponseBuilder;
/// Turn error responses into JSON HTTP responses
pub fn serialize_as_json_error<T>(

View File

@ -90,7 +90,7 @@ use crate::http_server::endpoints::w2l::get_w2l_template_use_count::get_w2l_temp
use crate::http_server::endpoints::w2l::get_w2l_upload_template_job_status::get_w2l_upload_template_job_status_handler;
use crate::http_server::endpoints::w2l::list_w2l_templates::list_w2l_templates_handler;
use crate::http_server::endpoints::w2l::set_w2l_template_mod_approval::set_w2l_template_mod_approval_handler;
use crate::http_server::middleware::ip_filter_middleware::IpFilter;
//use crate::http_server::middleware::ip_filter_middleware::IpFilter;
use crate::http_server::web_utils::cookie_manager::CookieManager;
use crate::http_server::web_utils::redis_rate_limiter::RedisRateLimiter;
use crate::http_server::web_utils::session_checker::SessionChecker;
@ -325,7 +325,7 @@ pub async fn serve(server_state: ServerState) -> AnyhowResult<()>
.wrap(DefaultHeaders::new()
.header("X-Backend-Hostname", &hostname)
.header("X-Build-Sha", ""))
.wrap(IpFilter::new(ip_banlist))
//.wrap(IpFilter::new(ip_banlist)) // TODO(FIXME): Bad upgrade
// ==================== ACCOUNT CREATION / SESSION MANAGEMENT ====================
.service(
web::resource("/create_account")

View File

@ -29,13 +29,21 @@ impl BucketClient {
bucket_name: &str,
optional_bucket_root: Option<&str>) -> anyhow::Result<Self>
{
let credentials = Credentials::new(
/*let credentials = Credentials::new(
Some(&access_key),
Some(&secret_key),
None,
None,
None,
)?;
)?;*/
let credentials = Credentials {
access_key: Some(access_key.to_string()),
secret_key: Some(secret_key.to_string()),
security_token: None,
session_token: None,
};
// NB: The GCS buckets aren't supported by default.
let region = Region::Custom {
region: region_name.to_owned(),
@ -184,7 +192,9 @@ impl BucketClient {
info!("downloading from bucket: {:?}", &object_path_str);
let mut output_file = std::fs::File::create(filesystem_path)?;
//let mut output_file = std::fs::File::create(filesystem_path)?;
//let mut output_file = async_std::fs::File::create(filesystem_path).await?;
let mut output_file = tokio::fs::File::create(filesystem_path).await?;
let status_code = self.bucket.get_object_stream(&object_path_str, &mut output_file).await?;