Skip to content
Snippets Groups Projects
Verified Commit 188fe30d authored by insert's avatar insert
Browse files

Add OPTIONS preflight.

parent 2095a298
No related merge requests found
......@@ -216,11 +216,6 @@ pub struct Login {
password: String,
}
#[options("/login")]
pub fn login_preflight() -> Response {
Response::Result(super::Status::Ok)
}
/// login to a Revolt account
/// (1) find user by email
/// (2) verify password
......@@ -295,3 +290,9 @@ pub fn token(info: Json<Token>) -> Response {
}))
}
}
#[options("/create")] pub fn create_preflight() -> Response { Response::Result(super::Status::Ok) }
#[options("/verify/<_code>")] pub fn verify_email_preflight(_code: String) -> Response { Response::Result(super::Status::Ok) }
#[options("/resend")] pub fn resend_email_preflight() -> Response { Response::Result(super::Status::Ok) }
#[options("/login")] pub fn login_preflight() -> Response { Response::Result(super::Status::Ok) }
#[options("/token")] pub fn token_preflight() -> Response { Response::Result(super::Status::Ok) }
......@@ -686,3 +686,9 @@ pub fn delete_message(user: UserRef, target: ChannelRef, message: Message) -> Op
)),
}
}
#[options("/create")] pub fn create_group_preflight() -> Response { Response::Result(super::Status::Ok) }
#[options("/<_target>")] pub fn channel_preflight(_target: String) -> Response { Response::Result(super::Status::Ok) }
#[options("/<_target>/recipients/<_member>")] pub fn member_preflight(_target: String, _member: String) -> Response { Response::Result(super::Status::Ok) }
#[options("/<_target>/messages")] pub fn messages_preflight(_target: String) -> Response { Response::Result(super::Status::Ok) }
#[options("/<_target>/messages/<_message>")] pub fn message_preflight(_target: String, _message: String) -> Response { Response::Result(super::Status::Ok) }
......@@ -838,3 +838,14 @@ pub fn unban_member(user: UserRef, target: GuildRef, other: String) -> Option<Re
))
}
}
#[options("/<_target>")] pub fn guild_preflight(_target: String) -> Response { Response::Result(super::Status::Ok) }
#[options("/<_target>/channels")] pub fn create_channel_preflight(_target: String) -> Response { Response::Result(super::Status::Ok) }
#[options("/<_target>/channels/<_channel>/invite")] pub fn create_invite_preflight(_target: String, _channel: String) -> Response { Response::Result(super::Status::Ok) }
#[options("/<_target>/invites/<_code>")] pub fn remove_invite_preflight(_target: String, _code: String) -> Response { Response::Result(super::Status::Ok) }
#[options("/<_target>/invites")] pub fn fetch_invites_preflight(_target: String) -> Response { Response::Result(super::Status::Ok) }
#[options("/join/<_code>", rank = 1)] pub fn invite_preflight(_code: String) -> Response { Response::Result(super::Status::Ok) }
#[options("/create")] pub fn create_guild_preflight() -> Response { Response::Result(super::Status::Ok) }
#[options("/<_target>/members")] pub fn fetch_members_preflight(_target: String) -> Response { Response::Result(super::Status::Ok) }
#[options("/<_target>/members/<_other>")] pub fn fetch_member_preflight(_target: String, _other: String) -> Response { Response::Result(super::Status::Ok) }
#[options("/<_target>/members/<_other>/ban")] pub fn ban_member_preflight(_target: String, _other: String) -> Response { Response::Result(super::Status::Ok) }
......@@ -71,7 +71,11 @@ pub fn mount(rocket: Rocket) -> Rocket {
account::login,
account::token,
account::create_preflight,
account::verify_email_preflight,
account::resend_email_preflight,
account::login_preflight,
account::token_preflight,
],
)
.mount(
......@@ -87,7 +91,14 @@ pub fn mount(rocket: Rocket) -> Rocket {
user::add_friend,
user::remove_friend,
user::block_user,
user::unblock_user
user::unblock_user,
user::user_preflight,
user::lookup_preflight,
user::dms_preflight,
user::dm_preflight,
user::friend_preflight,
user::block_user_preflight,
],
)
.mount(
......@@ -102,7 +113,13 @@ pub fn mount(rocket: Rocket) -> Rocket {
channel::get_message,
channel::send_message,
channel::edit_message,
channel::delete_message
channel::delete_message,
channel::create_group_preflight,
channel::channel_preflight,
channel::member_preflight,
channel::messages_preflight,
channel::message_preflight,
],
)
.mount(
......@@ -122,7 +139,18 @@ pub fn mount(rocket: Rocket) -> Rocket {
guild::fetch_member,
guild::kick_member,
guild::ban_member,
guild::unban_member
guild::unban_member,
guild::guild_preflight,
guild::create_channel_preflight,
guild::create_invite_preflight,
guild::remove_invite_preflight,
guild::fetch_invites_preflight,
guild::invite_preflight,
guild::create_guild_preflight,
guild::fetch_members_preflight,
guild::fetch_member_preflight,
guild::ban_member_preflight,
],
)
}
......@@ -705,3 +705,10 @@ pub fn unblock_user(user: UserRef, target: UserRef) -> Response {
| Relationship::NONE => Response::BadRequest(json!({ "error": "This has no effect." })),
}
}
#[options("/<_target>")] pub fn user_preflight(_target: String) -> Response { Response::Result(super::Status::Ok) }
#[options("/lookup")] pub fn lookup_preflight() -> Response { Response::Result(super::Status::Ok) }
#[options("/@me/dms")] pub fn dms_preflight() -> Response { Response::Result(super::Status::Ok) }
#[options("/<_target>/dm")] pub fn dm_preflight(_target: String) -> Response { Response::Result(super::Status::Ok) }
#[options("/<_target>/friend")] pub fn friend_preflight(_target: String) -> Response { Response::Result(super::Status::Ok) }
#[options("/<_target>/block")] pub fn block_user_preflight(_target: String) -> Response { Response::Result(super::Status::Ok) }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment