From cc2054838a658e8d3141a88e075fc588827a0c85 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Wed, 18 Jan 2023 15:54:15 +0000 Subject: [PATCH 1/7] chore: swap okapi for revolt_okapi --- Cargo.lock | 75 ++++++++++++++++--- crates/delta/Cargo.toml | 5 +- crates/delta/src/main.rs | 2 +- crates/delta/src/routes/bots/mod.rs | 2 +- crates/delta/src/routes/channels/mod.rs | 2 +- crates/delta/src/routes/customisation/mod.rs | 2 +- crates/delta/src/routes/invites/mod.rs | 2 +- crates/delta/src/routes/mod.rs | 4 +- crates/delta/src/routes/onboard/mod.rs | 2 +- crates/delta/src/routes/push/mod.rs | 2 +- crates/delta/src/routes/servers/mod.rs | 2 +- crates/delta/src/routes/sync/mod.rs | 2 +- .../src/routes/users/get_default_avatar.rs | 8 +- crates/delta/src/routes/users/mod.rs | 2 +- crates/quark/Cargo.toml | 10 +-- crates/quark/src/impl/rocket.rs | 8 +- crates/quark/src/util/result.rs | 11 +-- crates/quark/src/web/idempotency.rs | 8 +- crates/quark/src/web/ratelimiter.rs | 6 +- crates/quark/src/web/swagger.rs | 2 +- 20 files changed, 103 insertions(+), 54 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d74da317..63bd840a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2842,9 +2842,9 @@ dependencies = [ "regex", "reqwest", "revolt-quark", + "revolt_rocket_okapi", "rocket", - "rocket_empty", - "rocket_okapi", + "rocket_empty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rocket_rauth", "schemars", "serde", @@ -2880,7 +2880,6 @@ dependencies = [ "mongodb", "nanoid", "num_enum", - "okapi", "once_cell", "optional_struct", "pretty_env_logger", @@ -2888,11 +2887,12 @@ dependencies = [ "redis-kiss", "regex", "reqwest", + "revolt_okapi", + "revolt_rocket_okapi", "rocket", "rocket_cors", - "rocket_empty", + "rocket_empty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rocket_http", - "rocket_okapi", "schemars", "sentry", "serde", @@ -2902,6 +2902,47 @@ dependencies = [ "web-push", ] +[[package]] +name = "revolt_okapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23bfdf7ae769c3042fe727f6e5c17363b02a64b4b33ad60c3e5f73b26df7835b" +dependencies = [ + "log", + "schemars", + "serde", + "serde_json", +] + +[[package]] +name = "revolt_rocket_okapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "275e1e9bd3343f75225cafa64f4bfb939c8b21c5f861141180fc0e24769ff6cf" +dependencies = [ + "either", + "log", + "revolt_okapi", + "revolt_rocket_okapi_codegen", + "rocket", + "schemars", + "serde", + "serde_json", +] + +[[package]] +name = "revolt_rocket_okapi_codegen" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6620569d8ac8f0a1690fcca13f488503807a60e96ebf729749b59aca1dbef9" +dependencies = [ + "darling", + "proc-macro2", + "quote 1.0.18", + "rocket_http", + "syn 1.0.96", +] + [[package]] name = "ring" version = "0.16.20" @@ -2996,9 +3037,10 @@ dependencies = [ [[package]] name = "rocket_cors" -version = "0.5.2" -source = "git+https://github.com/lawliet89/rocket_cors?rev=5843861a88958c16bfaa0b40f0d8910772bcd2f6#5843861a88958c16bfaa0b40f0d8910772bcd2f6" +version = "0.6.0-alpha1" +source = "git+https://github.com/lawliet89/rocket_cors?rev=c17e8145baa4790319fdb6a473e465b960f55e7c#c17e8145baa4790319fdb6a473e465b960f55e7c" dependencies = [ + "http", "log", "regex", "rocket", @@ -3011,12 +3053,21 @@ dependencies = [ [[package]] name = "rocket_empty" -version = "0.1.0" -source = "git+https://github.com/insertish/rocket_empty?branch=master#9d8234fc3bb215ea241b787301e8cff68ae53652" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c0922e47f981204fee38578a8efcf47a5c1a4ac0eb7f59e6bdfa3e61c8e3d69" +dependencies = [ + "revolt_okapi", + "revolt_rocket_okapi", + "rocket", +] + +[[package]] +name = "rocket_empty" +version = "0.1.1" +source = "git+https://github.com/insertish/rocket_empty?branch=master#7488be6a5d2a70744fe81b9dcc60df5866b4c8ba" dependencies = [ - "okapi", "rocket", - "rocket_okapi", ] [[package]] @@ -3082,7 +3133,7 @@ dependencies = [ "okapi", "rauth", "rocket", - "rocket_empty", + "rocket_empty 0.1.1 (git+https://github.com/insertish/rocket_empty?branch=master)", "rocket_okapi", "schemars", "serde", diff --git a/crates/delta/Cargo.toml b/crates/delta/Cargo.toml index c59b7b50..39d2814b 100644 --- a/crates/delta/Cargo.toml +++ b/crates/delta/Cargo.toml @@ -51,13 +51,12 @@ mobc-redis = { version = "0.7.0", default-features = false, features = ["async-s # web rocket = { version = "0.5.0-rc.2", default-features = false, features = ["json"] } -rocket_empty = { git = "https://github.com/insertish/rocket_empty", branch = "master" } +rocket_empty = { version = "0.1.1", features = ["schema"] } rocket_rauth = { git = "https://github.com/insertish/rauth", rev = "cbdec69c684a4854fbedba9ed1f0e7ee466bf3f7" } # spec generation schemars = "0.8.8" -# rocket_okapi = "0.8.0-rc.1" -rocket_okapi = { git = "https://github.com/insertish/okapi", rev = "a1048d0c8cd771e424ec97d33d825c32e06aa120", features = [ "swagger" ] } +revolt_rocket_okapi = { version = "0.9.1", features = [ "swagger" ] } # quark revolt-quark = { path = "../quark" } diff --git a/crates/delta/src/main.rs b/crates/delta/src/main.rs index 1851101e..728bdcf6 100644 --- a/crates/delta/src/main.rs +++ b/crates/delta/src/main.rs @@ -1,7 +1,7 @@ #[macro_use] extern crate rocket; #[macro_use] -extern crate rocket_okapi; +extern crate revolt_rocket_okapi; #[macro_use] extern crate serde_json; #[macro_use] diff --git a/crates/delta/src/routes/bots/mod.rs b/crates/delta/src/routes/bots/mod.rs index c29b90e5..0ae1a954 100644 --- a/crates/delta/src/routes/bots/mod.rs +++ b/crates/delta/src/routes/bots/mod.rs @@ -1,5 +1,5 @@ +use revolt_rocket_okapi::revolt_okapi::openapi3::OpenApi; use rocket::Route; -use rocket_okapi::okapi::openapi3::OpenApi; mod create; mod delete; diff --git a/crates/delta/src/routes/channels/mod.rs b/crates/delta/src/routes/channels/mod.rs index 255660d4..60ff88cd 100644 --- a/crates/delta/src/routes/channels/mod.rs +++ b/crates/delta/src/routes/channels/mod.rs @@ -1,5 +1,5 @@ +use revolt_rocket_okapi::revolt_okapi::openapi3::OpenApi; use rocket::Route; -use rocket_okapi::okapi::openapi3::OpenApi; mod channel_ack; mod channel_delete; diff --git a/crates/delta/src/routes/customisation/mod.rs b/crates/delta/src/routes/customisation/mod.rs index 19ce099a..56d40995 100644 --- a/crates/delta/src/routes/customisation/mod.rs +++ b/crates/delta/src/routes/customisation/mod.rs @@ -1,5 +1,5 @@ +use revolt_rocket_okapi::revolt_okapi::openapi3::OpenApi; use rocket::Route; -use rocket_okapi::okapi::openapi3::OpenApi; mod emoji_create; mod emoji_delete; diff --git a/crates/delta/src/routes/invites/mod.rs b/crates/delta/src/routes/invites/mod.rs index 059b6d94..7d64a7d9 100644 --- a/crates/delta/src/routes/invites/mod.rs +++ b/crates/delta/src/routes/invites/mod.rs @@ -1,5 +1,5 @@ +use revolt_rocket_okapi::revolt_okapi::openapi3::OpenApi; use rocket::Route; -use rocket_okapi::okapi::openapi3::OpenApi; mod invite_delete; mod invite_fetch; diff --git a/crates/delta/src/routes/mod.rs b/crates/delta/src/routes/mod.rs index f50ef91f..b1af7ecf 100644 --- a/crates/delta/src/routes/mod.rs +++ b/crates/delta/src/routes/mod.rs @@ -1,7 +1,7 @@ +use revolt_rocket_okapi::{revolt_okapi::openapi3::OpenApi, settings::OpenApiSettings}; pub use rocket::http::Status; pub use rocket::response::Redirect; use rocket::{Build, Rocket}; -use rocket_okapi::{okapi::openapi3::OpenApi, settings::OpenApiSettings}; mod bots; mod channels; @@ -39,7 +39,7 @@ pub fn mount(mut rocket: Rocket) -> Rocket { } fn custom_openapi_spec() -> OpenApi { - use rocket_okapi::okapi::openapi3::*; + use revolt_rocket_okapi::revolt_okapi::openapi3::*; let mut extensions = schemars::Map::new(); extensions.insert( diff --git a/crates/delta/src/routes/onboard/mod.rs b/crates/delta/src/routes/onboard/mod.rs index 16ec2708..68da95ab 100644 --- a/crates/delta/src/routes/onboard/mod.rs +++ b/crates/delta/src/routes/onboard/mod.rs @@ -1,5 +1,5 @@ +use revolt_rocket_okapi::revolt_okapi::openapi3::OpenApi; use rocket::Route; -use rocket_okapi::okapi::openapi3::OpenApi; mod complete; mod hello; diff --git a/crates/delta/src/routes/push/mod.rs b/crates/delta/src/routes/push/mod.rs index e5d5d151..2409dc60 100644 --- a/crates/delta/src/routes/push/mod.rs +++ b/crates/delta/src/routes/push/mod.rs @@ -1,5 +1,5 @@ +use revolt_rocket_okapi::revolt_okapi::openapi3::OpenApi; use rocket::Route; -use rocket_okapi::okapi::openapi3::OpenApi; mod subscribe; mod unsubscribe; diff --git a/crates/delta/src/routes/servers/mod.rs b/crates/delta/src/routes/servers/mod.rs index 8cea54f2..15cdd735 100644 --- a/crates/delta/src/routes/servers/mod.rs +++ b/crates/delta/src/routes/servers/mod.rs @@ -1,5 +1,5 @@ +use revolt_rocket_okapi::revolt_okapi::openapi3::OpenApi; use rocket::Route; -use rocket_okapi::okapi::openapi3::OpenApi; mod ban_create; mod ban_list; diff --git a/crates/delta/src/routes/sync/mod.rs b/crates/delta/src/routes/sync/mod.rs index 4083bd44..35acf239 100644 --- a/crates/delta/src/routes/sync/mod.rs +++ b/crates/delta/src/routes/sync/mod.rs @@ -1,5 +1,5 @@ +use revolt_rocket_okapi::revolt_okapi::openapi3::OpenApi; use rocket::Route; -use rocket_okapi::okapi::openapi3::OpenApi; mod get_settings; mod get_unreads; diff --git a/crates/delta/src/routes/users/get_default_avatar.rs b/crates/delta/src/routes/users/get_default_avatar.rs index b388ba6b..5b39b320 100644 --- a/crates/delta/src/routes/users/get_default_avatar.rs +++ b/crates/delta/src/routes/users/get_default_avatar.rs @@ -1,7 +1,7 @@ +use revolt_rocket_okapi::revolt_okapi::openapi3::{self, MediaType, RefOr}; use rocket::http::ContentType; use rocket::response::{self, Responder}; use rocket::{Request, Response}; -use rocket_okapi::okapi::openapi3::{self, MediaType, RefOr}; use schemars::schema::{InstanceType, SchemaObject, SingleOrVec}; pub struct CachedFile((ContentType, Vec)); @@ -16,10 +16,10 @@ impl<'r> Responder<'r, 'static> for CachedFile { } } -impl rocket_okapi::response::OpenApiResponderInner for CachedFile { +impl revolt_rocket_okapi::response::OpenApiResponderInner for CachedFile { fn responses( - _gen: &mut rocket_okapi::gen::OpenApiGenerator, - ) -> std::result::Result { + _gen: &mut revolt_rocket_okapi::gen::OpenApiGenerator, + ) -> std::result::Result { let mut responses = schemars::Map::new(); let mut content = schemars::Map::new(); diff --git a/crates/delta/src/routes/users/mod.rs b/crates/delta/src/routes/users/mod.rs index 008ae216..2908148d 100644 --- a/crates/delta/src/routes/users/mod.rs +++ b/crates/delta/src/routes/users/mod.rs @@ -1,5 +1,5 @@ +use revolt_rocket_okapi::revolt_okapi::openapi3::OpenApi; use rocket::Route; -use rocket_okapi::okapi::openapi3::OpenApi; mod add_friend; mod block_user; diff --git a/crates/quark/Cargo.toml b/crates/quark/Cargo.toml index 52659170..4c85f53f 100644 --- a/crates/quark/Cargo.toml +++ b/crates/quark/Cargo.toml @@ -38,10 +38,8 @@ bson = { version = "2.1.0", features = ["chrono-0_4"] } # Spec Generation schemars = "0.8.8" -okapi = { git = "https://github.com/insertish/okapi", rev = "a1048d0c8cd771e424ec97d33d825c32e06aa120" } -rocket_okapi = { git = "https://github.com/insertish/okapi", rev = "a1048d0c8cd771e424ec97d33d825c32e06aa120" } -# okapi = "0.7.0-rc.1" -# rocket_okapi = "0.8.0-rc.1" +revolt_okapi = "0.9.1" +revolt_rocket_okapi = { version = "0.9.1", features = [ "swagger" ] } # Databases redis-kiss = { version = "0.1.3" } @@ -82,8 +80,8 @@ web-push = "0.7.2" # Implementations rocket_http = { optional = true, version = "0.5.0-rc.2" } rocket = { optional = true, version = "0.5.0-rc.2", default-features = false, features = ["json"] } -rocket_empty = { optional = true, git = "https://github.com/insertish/rocket_empty", branch = "master" } -rocket_cors = { optional = true, git = "https://github.com/lawliet89/rocket_cors", rev = "5843861a88958c16bfaa0b40f0d8910772bcd2f6" } +rocket_empty = { version = "0.1.1", optional = true, features = [ "schema" ] } +rocket_cors = { optional = true, git = "https://github.com/lawliet89/rocket_cors", rev = "c17e8145baa4790319fdb6a473e465b960f55e7c" } # rAuth rauth = { git = "https://github.com/insertish/rauth", rev = "cbdec69c684a4854fbedba9ed1f0e7ee466bf3f7", features = [ "async-std-runtime" ] } diff --git a/crates/quark/src/impl/rocket.rs b/crates/quark/src/impl/rocket.rs index f36c8e1a..0756bd38 100644 --- a/crates/quark/src/impl/rocket.rs +++ b/crates/quark/src/impl/rocket.rs @@ -1,7 +1,7 @@ -use okapi::openapi3::{SecurityScheme, SecuritySchemeData}; use rauth::models::Session; -use rocket_okapi::gen::OpenApiGenerator; -use rocket_okapi::request::{OpenApiFromRequest, RequestHeaderInput}; +use revolt_okapi::openapi3::{SecurityScheme, SecuritySchemeData}; +use revolt_rocket_okapi::gen::OpenApiGenerator; +use revolt_rocket_okapi::request::{OpenApiFromRequest, RequestHeaderInput}; use rocket::http::Status; use rocket::request::{self, FromRequest, Outcome, Request}; @@ -53,7 +53,7 @@ impl<'r> OpenApiFromRequest<'r> for User { _gen: &mut OpenApiGenerator, _name: String, _required: bool, - ) -> rocket_okapi::Result { + ) -> revolt_rocket_okapi::Result { let mut requirements = schemars::Map::new(); requirements.insert("Session Token".to_owned(), vec![]); diff --git a/crates/quark/src/util/result.rs b/crates/quark/src/util/result.rs index 6ee2fe63..995ad6e2 100644 --- a/crates/quark/src/util/result.rs +++ b/crates/quark/src/util/result.rs @@ -1,4 +1,5 @@ -use okapi::openapi3::{self, SchemaObject}; +use revolt_okapi::openapi3::SchemaObject; +use revolt_rocket_okapi::revolt_okapi::openapi3; use rocket::{ http::{ContentType, Status}, response::{self, Responder}, @@ -194,11 +195,11 @@ impl<'r> Responder<'r, 'static> for Error { } } -impl rocket_okapi::response::OpenApiResponderInner for Error { +impl revolt_rocket_okapi::response::OpenApiResponderInner for Error { fn responses( - gen: &mut rocket_okapi::gen::OpenApiGenerator, - ) -> std::result::Result { - let mut content = okapi::Map::new(); + gen: &mut revolt_rocket_okapi::gen::OpenApiGenerator, + ) -> std::result::Result { + let mut content = revolt_okapi::Map::new(); let settings = schemars::gen::SchemaSettings::default().with(|s| { s.option_nullable = true; diff --git a/crates/quark/src/web/idempotency.rs b/crates/quark/src/web/idempotency.rs index c1e0230c..769341e7 100644 --- a/crates/quark/src/web/idempotency.rs +++ b/crates/quark/src/web/idempotency.rs @@ -1,11 +1,11 @@ use crate::{Error, Result}; use async_std::sync::Mutex; +use revolt_rocket_okapi::gen::OpenApiGenerator; +use revolt_rocket_okapi::request::{OpenApiFromRequest, RequestHeaderInput}; +use revolt_rocket_okapi::revolt_okapi::openapi3::{Parameter, ParameterValue}; use rocket::http::Status; use rocket::request::{FromRequest, Outcome}; -use rocket_okapi::gen::OpenApiGenerator; -use rocket_okapi::okapi::openapi3::{Parameter, ParameterValue}; -use rocket_okapi::request::{OpenApiFromRequest, RequestHeaderInput}; use schemars::schema::{InstanceType, SchemaObject, SingleOrVec}; use serde::{Deserialize, Serialize}; use validator::Validate; @@ -47,7 +47,7 @@ impl<'r> OpenApiFromRequest<'r> for IdempotencyKey { _gen: &mut OpenApiGenerator, _name: String, _required: bool, - ) -> rocket_okapi::Result { + ) -> revolt_rocket_okapi::Result { Ok(RequestHeaderInput::Parameter(Parameter { name: "Idempotency-Key".to_string(), description: Some("Unique key to prevent duplicate requests".to_string()), diff --git a/crates/quark/src/web/ratelimiter.rs b/crates/quark/src/web/ratelimiter.rs index d77701db..853d9aa8 100644 --- a/crates/quark/src/web/ratelimiter.rs +++ b/crates/quark/src/web/ratelimiter.rs @@ -16,8 +16,8 @@ use rocket::request::{FromRequest, Outcome}; use rocket::serde::json::Json; use rocket::{Data, Request, Response}; -use rocket_okapi::gen::OpenApiGenerator; -use rocket_okapi::request::{OpenApiFromRequest, RequestHeaderInput}; +use revolt_rocket_okapi::gen::OpenApiGenerator; +use revolt_rocket_okapi::request::{OpenApiFromRequest, RequestHeaderInput}; use serde::Serialize; @@ -241,7 +241,7 @@ impl<'r> OpenApiFromRequest<'r> for Ratelimiter { _gen: &mut OpenApiGenerator, _name: String, _required: bool, - ) -> rocket_okapi::Result { + ) -> revolt_rocket_okapi::Result { Ok(RequestHeaderInput::None) } } diff --git a/crates/quark/src/web/swagger.rs b/crates/quark/src/web/swagger.rs index d84bb643..fcfe3a91 100644 --- a/crates/quark/src/web/swagger.rs +++ b/crates/quark/src/web/swagger.rs @@ -1,7 +1,7 @@ use rocket::Route; pub fn routes() -> Vec { - rocket_okapi::swagger_ui::make_swagger_ui(&rocket_okapi::swagger_ui::SwaggerUIConfig { + revolt_rocket_okapi::swagger_ui::make_swagger_ui(&revolt_rocket_okapi::swagger_ui::SwaggerUIConfig { url: "../openapi.json".to_owned(), ..Default::default() }) From cf9c0bc5e15abf7ba06c71fbfe97f5a2aea574c1 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Wed, 18 Jan 2023 19:06:05 +0000 Subject: [PATCH 2/7] chore: bump rauth --- Cargo.lock | 64 ++++++----------------------------------- crates/delta/Cargo.toml | 2 +- crates/quark/Cargo.toml | 2 +- 3 files changed, 11 insertions(+), 57 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 63bd840a..09263c63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2069,17 +2069,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "okapi" -version = "0.7.0-rc.1" -source = "git+https://github.com/insertish/okapi?rev=a1048d0c8cd771e424ec97d33d825c32e06aa120#a1048d0c8cd771e424ec97d33d825c32e06aa120" -dependencies = [ - "log", - "schemars", - "serde", - "serde_json", -] - [[package]] name = "once_cell" version = "1.13.0" @@ -2592,7 +2581,7 @@ dependencies = [ [[package]] name = "rauth" version = "1.0.0" -source = "git+https://github.com/insertish/rauth?rev=cbdec69c684a4854fbedba9ed1f0e7ee466bf3f7#cbdec69c684a4854fbedba9ed1f0e7ee466bf3f7" +source = "git+https://github.com/insertish/rauth?rev=195f1703cc4c57be01a39f465296cab4e22524b3#195f1703cc4c57be01a39f465296cab4e22524b3" dependencies = [ "async-std", "async-trait", @@ -2607,12 +2596,12 @@ dependencies = [ "log", "mongodb", "nanoid", - "okapi", "rand 0.8.5", "regex", "reqwest", + "revolt_okapi", + "revolt_rocket_okapi", "rocket", - "rocket_okapi", "rust-argon2", "schemars", "serde", @@ -2844,7 +2833,7 @@ dependencies = [ "revolt-quark", "revolt_rocket_okapi", "rocket", - "rocket_empty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rocket_empty", "rocket_rauth", "schemars", "serde", @@ -2891,7 +2880,7 @@ dependencies = [ "revolt_rocket_okapi", "rocket", "rocket_cors", - "rocket_empty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rocket_empty", "rocket_http", "schemars", "sentry", @@ -3062,14 +3051,6 @@ dependencies = [ "rocket", ] -[[package]] -name = "rocket_empty" -version = "0.1.1" -source = "git+https://github.com/insertish/rocket_empty?branch=master#7488be6a5d2a70744fe81b9dcc60df5866b4c8ba" -dependencies = [ - "rocket", -] - [[package]] name = "rocket_http" version = "0.5.0-rc.2" @@ -3097,44 +3078,17 @@ dependencies = [ "uncased", ] -[[package]] -name = "rocket_okapi" -version = "0.8.0-rc.1" -source = "git+https://github.com/insertish/okapi?rev=a1048d0c8cd771e424ec97d33d825c32e06aa120#a1048d0c8cd771e424ec97d33d825c32e06aa120" -dependencies = [ - "either", - "log", - "okapi", - "rocket", - "rocket_okapi_codegen", - "schemars", - "serde", - "serde_json", -] - -[[package]] -name = "rocket_okapi_codegen" -version = "0.8.0-rc.1" -source = "git+https://github.com/insertish/okapi?rev=a1048d0c8cd771e424ec97d33d825c32e06aa120#a1048d0c8cd771e424ec97d33d825c32e06aa120" -dependencies = [ - "darling", - "proc-macro2", - "quote 1.0.18", - "rocket_http", - "syn 1.0.96", -] - [[package]] name = "rocket_rauth" version = "1.0.0" -source = "git+https://github.com/insertish/rauth?rev=cbdec69c684a4854fbedba9ed1f0e7ee466bf3f7#cbdec69c684a4854fbedba9ed1f0e7ee466bf3f7" +source = "git+https://github.com/insertish/rauth?rev=195f1703cc4c57be01a39f465296cab4e22524b3#195f1703cc4c57be01a39f465296cab4e22524b3" dependencies = [ "iso8601-timestamp", - "okapi", "rauth", + "revolt_okapi", + "revolt_rocket_okapi", "rocket", - "rocket_empty 0.1.1 (git+https://github.com/insertish/rocket_empty?branch=master)", - "rocket_okapi", + "rocket_empty", "schemars", "serde", ] diff --git a/crates/delta/Cargo.toml b/crates/delta/Cargo.toml index 39d2814b..056fcb9d 100644 --- a/crates/delta/Cargo.toml +++ b/crates/delta/Cargo.toml @@ -52,7 +52,7 @@ mobc-redis = { version = "0.7.0", default-features = false, features = ["async-s # web rocket = { version = "0.5.0-rc.2", default-features = false, features = ["json"] } rocket_empty = { version = "0.1.1", features = ["schema"] } -rocket_rauth = { git = "https://github.com/insertish/rauth", rev = "cbdec69c684a4854fbedba9ed1f0e7ee466bf3f7" } +rocket_rauth = { git = "https://github.com/insertish/rauth", rev = "195f1703cc4c57be01a39f465296cab4e22524b3" } # spec generation schemars = "0.8.8" diff --git a/crates/quark/Cargo.toml b/crates/quark/Cargo.toml index 4c85f53f..51b5666c 100644 --- a/crates/quark/Cargo.toml +++ b/crates/quark/Cargo.toml @@ -84,7 +84,7 @@ rocket_empty = { version = "0.1.1", optional = true, features = [ "schema" ] } rocket_cors = { optional = true, git = "https://github.com/lawliet89/rocket_cors", rev = "c17e8145baa4790319fdb6a473e465b960f55e7c" } # rAuth -rauth = { git = "https://github.com/insertish/rauth", rev = "cbdec69c684a4854fbedba9ed1f0e7ee466bf3f7", features = [ "async-std-runtime" ] } +rauth = { git = "https://github.com/insertish/rauth", rev = "195f1703cc4c57be01a39f465296cab4e22524b3", features = [ "async-std-runtime" ] } # Sentry sentry = "0.25.0" From fed1da72fdfe3c4a9865820f5362eb9f0e3f0fd7 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Fri, 20 Jan 2023 15:43:45 +0000 Subject: [PATCH 3/7] feat: support rauth events feat: add platform user wipe event --- Cargo.lock | 14 +++++++------- crates/bonfire/Cargo.toml | 2 +- crates/delta/Cargo.toml | 4 ++-- crates/delta/src/main.rs | 26 ++++++++++++++++++++++++-- crates/quark/Cargo.toml | 4 ++-- crates/quark/src/events/client.rs | 15 +++++++++++++++ crates/quark/src/events/impl.rs | 5 +++++ crates/quark/src/models/users/user.rs | 2 ++ 8 files changed, 58 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 09263c63..628e06cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2580,8 +2580,8 @@ dependencies = [ [[package]] name = "rauth" -version = "1.0.0" -source = "git+https://github.com/insertish/rauth?rev=195f1703cc4c57be01a39f465296cab4e22524b3#195f1703cc4c57be01a39f465296cab4e22524b3" +version = "1.0.2" +source = "git+https://github.com/insertish/rauth?tag=1.0.2#d466718bb4f1c8ca03f4a17265a646a52e07dff5" dependencies = [ "async-std", "async-trait", @@ -2790,7 +2790,7 @@ dependencies = [ [[package]] name = "revolt-bonfire" -version = "0.5.5" +version = "0.5.6" dependencies = [ "async-std", "async-tungstenite", @@ -2806,7 +2806,7 @@ dependencies = [ [[package]] name = "revolt-delta" -version = "0.5.5" +version = "0.5.6" dependencies = [ "async-channel", "async-std", @@ -2846,7 +2846,7 @@ dependencies = [ [[package]] name = "revolt-quark" -version = "0.1.0" +version = "0.5.6" dependencies = [ "async-recursion", "async-std", @@ -3080,8 +3080,8 @@ dependencies = [ [[package]] name = "rocket_rauth" -version = "1.0.0" -source = "git+https://github.com/insertish/rauth?rev=195f1703cc4c57be01a39f465296cab4e22524b3#195f1703cc4c57be01a39f465296cab4e22524b3" +version = "1.0.2" +source = "git+https://github.com/insertish/rauth?tag=1.0.2#d466718bb4f1c8ca03f4a17265a646a52e07dff5" dependencies = [ "iso8601-timestamp", "rauth", diff --git a/crates/bonfire/Cargo.toml b/crates/bonfire/Cargo.toml index ba684e55..bb7a05fd 100644 --- a/crates/bonfire/Cargo.toml +++ b/crates/bonfire/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "revolt-bonfire" -version = "0.5.5" +version = "0.5.6" license = "AGPL-3.0-or-later" edition = "2021" diff --git a/crates/delta/Cargo.toml b/crates/delta/Cargo.toml index 056fcb9d..5dcdc6e0 100644 --- a/crates/delta/Cargo.toml +++ b/crates/delta/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "revolt-delta" -version = "0.5.5" +version = "0.5.6" license = "AGPL-3.0-or-later" authors = ["Paul Makles "] edition = "2018" @@ -52,7 +52,7 @@ mobc-redis = { version = "0.7.0", default-features = false, features = ["async-s # web rocket = { version = "0.5.0-rc.2", default-features = false, features = ["json"] } rocket_empty = { version = "0.1.1", features = ["schema"] } -rocket_rauth = { git = "https://github.com/insertish/rauth", rev = "195f1703cc4c57be01a39f465296cab4e22524b3" } +rocket_rauth = { git = "https://github.com/insertish/rauth", tag = "1.0.2" } # spec generation schemars = "0.8.8" diff --git a/crates/delta/src/main.rs b/crates/delta/src/main.rs index 728bdcf6..4a7ab96d 100644 --- a/crates/delta/src/main.rs +++ b/crates/delta/src/main.rs @@ -10,7 +10,9 @@ extern crate lazy_static; pub mod routes; pub mod util; -use revolt_quark::rauth::RAuth; +use async_std::channel::unbounded; +use revolt_quark::events::client::EventV1; +use revolt_quark::rauth::{RAuth, RAuthEvent}; use revolt_quark::DatabaseInfo; #[launch] @@ -25,13 +27,33 @@ async fn rocket() -> _ { let db = DatabaseInfo::Auto.connect().await.unwrap(); db.migrate_database().await.unwrap(); + // Setup rAuth event channel + let (sender, receiver) = unbounded(); + // Setup rAuth let rauth = RAuth { database: db.clone().into(), config: revolt_quark::util::rauth::config(), + event_channel: Some(sender), }; - // Launch background task workers. + // Launch a listener for rAuth events + async_std::task::spawn(async move { + while let Ok(event) = receiver.recv().await { + match &event { + RAuthEvent::CreateSession { .. } | RAuthEvent::CreateAccount { .. } => { + EventV1::Auth(event).global().await + } + RAuthEvent::DeleteSession { user_id, .. } + | RAuthEvent::DeleteAllSessions { user_id, .. } => { + let id = user_id.to_string(); + EventV1::Auth(event).private(id).await + } + } + } + }); + + // Launch background task workers async_std::task::spawn(revolt_quark::tasks::start_workers(db.clone())); // Configure CORS diff --git a/crates/quark/Cargo.toml b/crates/quark/Cargo.toml index 51b5666c..6f67c6d9 100644 --- a/crates/quark/Cargo.toml +++ b/crates/quark/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "revolt-quark" -version = "0.1.0" +version = "0.5.6" license = "AGPL-3.0-or-later" edition = "2021" @@ -84,7 +84,7 @@ rocket_empty = { version = "0.1.1", optional = true, features = [ "schema" ] } rocket_cors = { optional = true, git = "https://github.com/lawliet89/rocket_cors", rev = "c17e8145baa4790319fdb6a473e465b960f55e7c" } # rAuth -rauth = { git = "https://github.com/insertish/rauth", rev = "195f1703cc4c57be01a39f465296cab4e22524b3", features = [ "async-std-runtime" ] } +rauth = { git = "https://github.com/insertish/rauth", tag = "1.0.2", features = [ "async-std-runtime" ] } # Sentry sentry = "0.25.0" diff --git a/crates/quark/src/events/client.rs b/crates/quark/src/events/client.rs index 28f7eb6a..f9275e9d 100644 --- a/crates/quark/src/events/client.rs +++ b/crates/quark/src/events/client.rs @@ -1,3 +1,4 @@ +use rauth::RAuthEvent; use serde::{Deserialize, Serialize}; use crate::models::channel::{FieldsChannel, PartialChannel}; @@ -195,9 +196,23 @@ pub enum EventV1 { /// Settings updated remotely UserSettingsUpdate { id: String, update: UserSettings }, + /// User has been platform banned or deleted their account + /// + /// Clients should remove the following associated data: + /// - Messages + /// - DM Channels + /// - Relationships + /// - Server Memberships + /// + /// User flags are specified to explain why a wipe is occurring though not all reasons will necessarily ever appear. + UserPlatformWipe { user_id: String, flags: i32 }, + /// New emoji EmojiCreate(Emoji), /// Delete emoji EmojiDelete { id: String }, + + /// Auth events + Auth(RAuthEvent), } diff --git a/crates/quark/src/events/impl.rs b/crates/quark/src/events/impl.rs index 6da72a77..d4b36c19 100644 --- a/crates/quark/src/events/impl.rs +++ b/crates/quark/src/events/impl.rs @@ -559,4 +559,9 @@ impl EventV1 { pub async fn private(self, id: String) { self.p(format!("{}!", id)).await; } + + /// Publish internal global event + pub async fn global(self) { + self.p("global".to_string()).await; + } } diff --git a/crates/quark/src/models/users/user.rs b/crates/quark/src/models/users/user.rs index 185bf286..1ea03fd9 100644 --- a/crates/quark/src/models/users/user.rs +++ b/crates/quark/src/models/users/user.rs @@ -105,6 +105,8 @@ pub enum Flags { Deleted = 2, /// User was banned off the platform Banned = 4, + /// User was marked as spam and removed from platform + Spam = 8, } /// Bot information for if the user is a bot From f5c95f9d126185530b0954e0e3ceb84c21ed7cd3 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Fri, 20 Jan 2023 15:57:58 +0000 Subject: [PATCH 4/7] chore: bump rauth for lockout reset on pwd reset --- Cargo.lock | 8 ++++---- crates/delta/Cargo.toml | 2 +- crates/quark/Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 628e06cb..19dc7f4a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2580,8 +2580,8 @@ dependencies = [ [[package]] name = "rauth" -version = "1.0.2" -source = "git+https://github.com/insertish/rauth?tag=1.0.2#d466718bb4f1c8ca03f4a17265a646a52e07dff5" +version = "1.0.3" +source = "git+https://github.com/insertish/rauth?tag=1.0.3#a62eae5076d94730d06e76d438cbca0d70161856" dependencies = [ "async-std", "async-trait", @@ -3080,8 +3080,8 @@ dependencies = [ [[package]] name = "rocket_rauth" -version = "1.0.2" -source = "git+https://github.com/insertish/rauth?tag=1.0.2#d466718bb4f1c8ca03f4a17265a646a52e07dff5" +version = "1.0.3" +source = "git+https://github.com/insertish/rauth?tag=1.0.3#a62eae5076d94730d06e76d438cbca0d70161856" dependencies = [ "iso8601-timestamp", "rauth", diff --git a/crates/delta/Cargo.toml b/crates/delta/Cargo.toml index 5dcdc6e0..527bae57 100644 --- a/crates/delta/Cargo.toml +++ b/crates/delta/Cargo.toml @@ -52,7 +52,7 @@ mobc-redis = { version = "0.7.0", default-features = false, features = ["async-s # web rocket = { version = "0.5.0-rc.2", default-features = false, features = ["json"] } rocket_empty = { version = "0.1.1", features = ["schema"] } -rocket_rauth = { git = "https://github.com/insertish/rauth", tag = "1.0.2" } +rocket_rauth = { git = "https://github.com/insertish/rauth", tag = "1.0.3" } # spec generation schemars = "0.8.8" diff --git a/crates/quark/Cargo.toml b/crates/quark/Cargo.toml index 6f67c6d9..f06a4d9f 100644 --- a/crates/quark/Cargo.toml +++ b/crates/quark/Cargo.toml @@ -84,7 +84,7 @@ rocket_empty = { version = "0.1.1", optional = true, features = [ "schema" ] } rocket_cors = { optional = true, git = "https://github.com/lawliet89/rocket_cors", rev = "c17e8145baa4790319fdb6a473e465b960f55e7c" } # rAuth -rauth = { git = "https://github.com/insertish/rauth", tag = "1.0.2", features = [ "async-std-runtime" ] } +rauth = { git = "https://github.com/insertish/rauth", tag = "1.0.3", features = [ "async-std-runtime" ] } # Sentry sentry = "0.25.0" From c0ef3d295ac70e305b7c4935ebfa0a584702f060 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Fri, 20 Jan 2023 17:14:25 +0000 Subject: [PATCH 5/7] fix: fallback if vergen cannot generate data --- crates/delta/build.rs | 2 +- crates/delta/src/routes/root.rs | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/delta/build.rs b/crates/delta/build.rs index e71dcd55..981237b4 100644 --- a/crates/delta/build.rs +++ b/crates/delta/build.rs @@ -12,5 +12,5 @@ fn main() { } } - vergen(Config::default()).unwrap(); + vergen(Config::default()).ok(); } diff --git a/crates/delta/src/routes/root.rs b/crates/delta/src/routes/root.rs index e44ae638..59bd8dc9 100644 --- a/crates/delta/src/routes/root.rs +++ b/crates/delta/src/routes/root.rs @@ -119,11 +119,12 @@ pub async fn root() -> Result> { app: APP_URL.to_string(), vapid: VAPID_PUBLIC_KEY.to_string(), build: BuildInformation { - commit_sha: env!("VERGEN_GIT_SHA").to_string(), - commit_timestamp: env!("VERGEN_GIT_COMMIT_TIMESTAMP").to_string(), - semver: env!("VERGEN_GIT_SEMVER").to_string(), - origin_url: env!("GIT_ORIGIN_URL", "").to_string(), - timestamp: env!("VERGEN_BUILD_TIMESTAMP").to_string(), + commit_sha: env!("VERGEN_GIT_SHA", "").to_string(), + commit_timestamp: env!("VERGEN_GIT_COMMIT_TIMESTAMP", "") + .to_string(), + semver: env!("VERGEN_GIT_SEMVER", "").to_string(), + origin_url: env!("GIT_ORIGIN_URL", "").to_string(), + timestamp: env!("VERGEN_BUILD_TIMESTAMP", "").to_string(), }, })) } From 7a6bd70dcd8bfee1d361e545f072bc093bc6a9b2 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Fri, 20 Jan 2023 17:47:26 +0000 Subject: [PATCH 6/7] feat: add route to fetch user flags chore: bump rauth to change disabled account behaviour --- crates/delta/Cargo.toml | 2 +- .../src/routes/users/fetch_user_flags.rs | 26 +++++++++++++++++++ crates/delta/src/routes/users/mod.rs | 2 ++ crates/quark/Cargo.toml | 2 +- 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 crates/delta/src/routes/users/fetch_user_flags.rs diff --git a/crates/delta/Cargo.toml b/crates/delta/Cargo.toml index 527bae57..f3d3ffa3 100644 --- a/crates/delta/Cargo.toml +++ b/crates/delta/Cargo.toml @@ -52,7 +52,7 @@ mobc-redis = { version = "0.7.0", default-features = false, features = ["async-s # web rocket = { version = "0.5.0-rc.2", default-features = false, features = ["json"] } rocket_empty = { version = "0.1.1", features = ["schema"] } -rocket_rauth = { git = "https://github.com/insertish/rauth", tag = "1.0.3" } +rocket_rauth = { git = "https://github.com/insertish/rauth", tag = "1.0.4" } # spec generation schemars = "0.8.8" diff --git a/crates/delta/src/routes/users/fetch_user_flags.rs b/crates/delta/src/routes/users/fetch_user_flags.rs new file mode 100644 index 00000000..4025b649 --- /dev/null +++ b/crates/delta/src/routes/users/fetch_user_flags.rs @@ -0,0 +1,26 @@ +use revolt_quark::{Database, Ref, Result}; + +use rocket::{serde::json::Json, State}; +use serde::Serialize; + +/// # Flag Response +#[derive(Serialize, JsonSchema)] +pub struct FlagResponse { + /// Flags + flags: i32, +} + +/// # Fetch User Flags +/// +/// Retrieve a user's flags. +#[openapi(tag = "User Information")] +#[get("//flags")] +pub async fn fetch_user_flags(db: &State, target: Ref) -> Result> { + let flags = if let Ok(target) = target.as_user(db).await { + target.flags.unwrap_or_default() + } else { + 0 + }; + + Ok(Json(FlagResponse { flags })) +} diff --git a/crates/delta/src/routes/users/mod.rs b/crates/delta/src/routes/users/mod.rs index 2908148d..28e8ee0b 100644 --- a/crates/delta/src/routes/users/mod.rs +++ b/crates/delta/src/routes/users/mod.rs @@ -9,6 +9,7 @@ mod fetch_dms; mod fetch_profile; mod fetch_self; mod fetch_user; +mod fetch_user_flags; mod find_mutual; mod get_default_avatar; mod open_dm; @@ -21,6 +22,7 @@ pub fn routes() -> (Vec, OpenApi) { // User Information fetch_self::req, fetch_user::req, + fetch_user_flags::fetch_user_flags, edit_user::req, change_username::req, get_default_avatar::req, diff --git a/crates/quark/Cargo.toml b/crates/quark/Cargo.toml index f06a4d9f..e29eeff0 100644 --- a/crates/quark/Cargo.toml +++ b/crates/quark/Cargo.toml @@ -84,7 +84,7 @@ rocket_empty = { version = "0.1.1", optional = true, features = [ "schema" ] } rocket_cors = { optional = true, git = "https://github.com/lawliet89/rocket_cors", rev = "c17e8145baa4790319fdb6a473e465b960f55e7c" } # rAuth -rauth = { git = "https://github.com/insertish/rauth", tag = "1.0.3", features = [ "async-std-runtime" ] } +rauth = { git = "https://github.com/insertish/rauth", tag = "1.0.4", features = [ "async-std-runtime" ] } # Sentry sentry = "0.25.0" From e0b918771d9537ceeca05603fda69996b07de39e Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Fri, 20 Jan 2023 18:06:44 +0000 Subject: [PATCH 7/7] chore: ensure restrict_reactions is used in conjunction with reactions list --- Cargo.lock | 8 ++++---- .../delta/src/routes/channels/message_send.rs | 20 +++++++++++++++++++ crates/quark/src/models/channels/message.rs | 2 ++ crates/quark/src/util/result.rs | 16 ++++++++------- 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 19dc7f4a..9919d355 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2580,8 +2580,8 @@ dependencies = [ [[package]] name = "rauth" -version = "1.0.3" -source = "git+https://github.com/insertish/rauth?tag=1.0.3#a62eae5076d94730d06e76d438cbca0d70161856" +version = "1.0.4" +source = "git+https://github.com/insertish/rauth?tag=1.0.4#2d3bc59623672e3ff57c49a90c4d3cd20780dbba" dependencies = [ "async-std", "async-trait", @@ -3080,8 +3080,8 @@ dependencies = [ [[package]] name = "rocket_rauth" -version = "1.0.3" -source = "git+https://github.com/insertish/rauth?tag=1.0.3#a62eae5076d94730d06e76d438cbca0d70161856" +version = "1.0.4" +source = "git+https://github.com/insertish/rauth?tag=1.0.4#2d3bc59623672e3ff57c49a90c4d3cd20780dbba" dependencies = [ "iso8601-timestamp", "rauth", diff --git a/crates/delta/src/routes/channels/message_send.rs b/crates/delta/src/routes/channels/message_send.rs index e7dceb4b..59aa03df 100644 --- a/crates/delta/src/routes/channels/message_send.rs +++ b/crates/delta/src/routes/channels/message_send.rs @@ -65,16 +65,20 @@ pub async fn message_send( data.validate() .map_err(|error| Error::FailedValidation { error })?; + // Validate Message is within reasonable length limits Message::validate_sum(&data.content, &data.embeds)?; + // Ensure the request is unique idempotency.consume_nonce(data.nonce).await?; + // Ensure we have permissions to send a message let channel = target.as_channel(db).await?; let mut permissions = perms(&user).channel(&channel); permissions .throw_permission_and_view_channel(db, Permission::SendMessage) .await?; + // Check the message is not empty if (data.content.as_ref().map_or(true, |v| v.is_empty())) && (data.attachments.as_ref().map_or(true, |v| v.is_empty())) && (data.embeds.as_ref().map_or(true, |v| v.is_empty())) @@ -82,6 +86,22 @@ pub async fn message_send( return Err(Error::EmptyMessage); } + // Ensure restrict_reactions is not specified without reactions list + if let Some(interactions) = &data.interactions { + if interactions.restrict_reactions { + let disallowed = if let Some(list) = &interactions.reactions { + list.len() == 0 + } else { + true + }; + + if disallowed { + return Err(Error::InvalidProperty); + } + } + } + + // Start constructing the message let message_id = Ulid::new().to_string(); let mut message = Message { id: message_id.clone(), diff --git a/crates/quark/src/models/channels/message.rs b/crates/quark/src/models/channels/message.rs index ee9e61cf..2eb91733 100644 --- a/crates/quark/src/models/channels/message.rs +++ b/crates/quark/src/models/channels/message.rs @@ -98,6 +98,8 @@ pub struct Interactions { #[serde(skip_serializing_if = "Option::is_none", default)] pub reactions: Option>, /// Whether reactions should be restricted to the given list + /// + /// Can only be set to true if reactions list is of at least length 1 #[serde(skip_serializing_if = "if_false", default)] pub restrict_reactions: bool, } diff --git a/crates/quark/src/util/result.rs b/crates/quark/src/util/result.rs index 995ad6e2..628c8303 100644 --- a/crates/quark/src/util/result.rs +++ b/crates/quark/src/util/result.rs @@ -20,10 +20,10 @@ pub enum Error { /// This error was not labeled :( LabelMe, - // ? Onboarding related errors. + // ? Onboarding related errors AlreadyOnboarded, - // ? User related errors. + // ? User related errors UsernameTaken, InvalidUsername, UnknownUser, @@ -33,7 +33,7 @@ pub enum Error { BlockedByOther, NotFriends, - // ? Channel related errors. + // ? Channel related errors UnknownChannel, UnknownAttachment, UnknownMessage, @@ -50,7 +50,7 @@ pub enum Error { AlreadyInGroup, NotInGroup, - // ? Server related errors. + // ? Server related errors UnknownServer, InvalidRole, Banned, @@ -59,12 +59,12 @@ pub enum Error { }, TooManyEmoji, - // ? Bot related errors. + // ? Bot related errors ReachedMaximumBots, IsBot, BotIsPrivate, - // ? Permission errors. + // ? Permission errors MissingPermission { permission: Permission, }, @@ -75,7 +75,7 @@ pub enum Error { CannotGiveMissingPermissions, NotOwner, - // ? General errors. + // ? General errors DatabaseError { operation: &'static str, with: &'static str, @@ -83,6 +83,7 @@ pub enum Error { InternalError, InvalidOperation, InvalidCredentials, + InvalidProperty, InvalidSession, DuplicateNonce, VosoUnavailable, @@ -175,6 +176,7 @@ impl<'r> Responder<'r, 'static> for Error { Error::InternalError => Status::InternalServerError, Error::InvalidOperation => Status::BadRequest, Error::InvalidCredentials => Status::Unauthorized, + Error::InvalidProperty => Status::BadRequest, Error::InvalidSession => Status::Unauthorized, Error::DuplicateNonce => Status::Conflict, Error::VosoUnavailable => Status::BadRequest,