forked from jmug/stoatchat
fix: openapi using old naming (#777)
* fix: openapi using old naming Signed-off-by: IAmTomahawkx <iamtomahawkx@gmail.com> * fix: remove january openapi security header Signed-off-by: IAmTomahawkx <iamtomahawkx@gmail.com> * fix(docs): more Revolt usage Signed-off-by: IAmTomahawkx <iamtomahawkx@gmail.com> --------- Signed-off-by: IAmTomahawkx <iamtomahawkx@gmail.com>
This commit is contained in:
@@ -64,47 +64,6 @@ pub fn mount(config: Settings, mut rocket: Rocket<Build>) -> Rocket<Build> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.features.webhooks_enabled {
|
|
||||||
mount_endpoints_and_merged_docs! {
|
|
||||||
rocket, "/0.8".to_owned(), settings,
|
|
||||||
"/" => (vec![], custom_openapi_spec()),
|
|
||||||
"" => openapi_get_routes_spec![root::root],
|
|
||||||
"/users" => users::routes(),
|
|
||||||
"/bots" => bots::routes(),
|
|
||||||
"/channels" => channels::routes(),
|
|
||||||
"/servers" => servers::routes(),
|
|
||||||
"/invites" => invites::routes(),
|
|
||||||
"/custom" => customisation::routes(),
|
|
||||||
"/safety" => safety::routes(),
|
|
||||||
"/auth/account" => rocket_authifier::routes::account::routes(),
|
|
||||||
"/auth/session" => rocket_authifier::routes::session::routes(),
|
|
||||||
"/auth/mfa" => rocket_authifier::routes::mfa::routes(),
|
|
||||||
"/onboard" => onboard::routes(),
|
|
||||||
"/push" => push::routes(),
|
|
||||||
"/sync" => sync::routes(),
|
|
||||||
"/webhooks" => webhooks::routes()
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
mount_endpoints_and_merged_docs! {
|
|
||||||
rocket, "/0.8".to_owned(), settings,
|
|
||||||
"/" => (vec![], custom_openapi_spec()),
|
|
||||||
"" => openapi_get_routes_spec![root::root],
|
|
||||||
"/users" => users::routes(),
|
|
||||||
"/bots" => bots::routes(),
|
|
||||||
"/channels" => channels::routes(),
|
|
||||||
"/servers" => servers::routes(),
|
|
||||||
"/invites" => invites::routes(),
|
|
||||||
"/custom" => customisation::routes(),
|
|
||||||
"/safety" => safety::routes(),
|
|
||||||
"/auth/account" => rocket_authifier::routes::account::routes(),
|
|
||||||
"/auth/session" => rocket_authifier::routes::session::routes(),
|
|
||||||
"/auth/mfa" => rocket_authifier::routes::mfa::routes(),
|
|
||||||
"/onboard" => onboard::routes(),
|
|
||||||
"/push" => push::routes(),
|
|
||||||
"/sync" => sync::routes()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
rocket
|
rocket
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,8 +74,8 @@ fn custom_openapi_spec() -> OpenApi {
|
|||||||
extensions.insert(
|
extensions.insert(
|
||||||
"x-logo".to_owned(),
|
"x-logo".to_owned(),
|
||||||
json!({
|
json!({
|
||||||
"url": "https://revolt.chat/header.png",
|
"url": "https://stoat.chat/header.png",
|
||||||
"altText": "Revolt Header"
|
"altText": "Stoat Header"
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -124,7 +83,7 @@ fn custom_openapi_spec() -> OpenApi {
|
|||||||
"x-tagGroups".to_owned(),
|
"x-tagGroups".to_owned(),
|
||||||
json!([
|
json!([
|
||||||
{
|
{
|
||||||
"name": "Revolt",
|
"name": "Stoat",
|
||||||
"tags": [
|
"tags": [
|
||||||
"Core"
|
"Core"
|
||||||
]
|
]
|
||||||
@@ -205,18 +164,21 @@ fn custom_openapi_spec() -> OpenApi {
|
|||||||
OpenApi {
|
OpenApi {
|
||||||
openapi: OpenApi::default_version(),
|
openapi: OpenApi::default_version(),
|
||||||
info: Info {
|
info: Info {
|
||||||
title: "Revolt API".to_owned(),
|
title: "Stoat API".to_owned(),
|
||||||
description: Some("Open source user-first chat platform.".to_owned()),
|
description: Some("Open source user-first chat platform.".to_owned()),
|
||||||
terms_of_service: Some("https://revolt.chat/terms".to_owned()),
|
terms_of_service: Some("https://stoat.chat/terms".to_owned()),
|
||||||
contact: Some(Contact {
|
contact: Some(Contact {
|
||||||
name: Some("Revolt Support".to_owned()),
|
name: Some("Stoat".to_owned()),
|
||||||
url: Some("https://revolt.chat".to_owned()),
|
url: Some("https://stoat.chat".to_owned()),
|
||||||
email: Some("contact@revolt.chat".to_owned()),
|
email: Some("contact@stoat.chat".to_owned()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
license: Some(License {
|
license: Some(License {
|
||||||
name: "AGPLv3".to_owned(),
|
name: "AGPLv3".to_owned(),
|
||||||
url: Some("https://github.com/stoatchat/stoatchat/blob/main/crates/delta/LICENSE".to_owned()),
|
url: Some(
|
||||||
|
"https://github.com/stoatchat/stoatchat/blob/main/crates/delta/LICENSE"
|
||||||
|
.to_owned(),
|
||||||
|
),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
version: env!("CARGO_PKG_VERSION").to_string(),
|
version: env!("CARGO_PKG_VERSION").to_string(),
|
||||||
@@ -224,29 +186,19 @@ fn custom_openapi_spec() -> OpenApi {
|
|||||||
},
|
},
|
||||||
servers: vec![
|
servers: vec![
|
||||||
Server {
|
Server {
|
||||||
url: "https://api.revolt.chat".to_owned(),
|
url: "https://api.stoat.chat".to_owned(),
|
||||||
description: Some("Revolt Production".to_owned()),
|
description: Some("Stoat Production".to_owned()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
Server {
|
Server {
|
||||||
url: "https://revolt.chat/api".to_owned(),
|
url: "https://beta.stoat.chat/api".to_owned(),
|
||||||
description: Some("Revolt Staging".to_owned()),
|
description: Some("Stoat Beta".to_owned()),
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
Server {
|
|
||||||
url: "http://local.revolt.chat:14702".to_owned(),
|
|
||||||
description: Some("Local Revolt Environment".to_owned()),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
Server {
|
|
||||||
url: "http://local.revolt.chat:14702/0.8".to_owned(),
|
|
||||||
description: Some("Local Revolt Environment (v0.8)".to_owned()),
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
external_docs: Some(ExternalDocs {
|
external_docs: Some(ExternalDocs {
|
||||||
url: "https://developers.revolt.chat".to_owned(),
|
url: "https://developers.stoat.chat".to_owned(),
|
||||||
description: Some("Revolt Developer Documentation".to_owned()),
|
description: Some("Stoat Developer Documentation".to_owned()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
extensions,
|
extensions,
|
||||||
@@ -254,19 +206,19 @@ fn custom_openapi_spec() -> OpenApi {
|
|||||||
Tag {
|
Tag {
|
||||||
name: "Core".to_owned(),
|
name: "Core".to_owned(),
|
||||||
description: Some(
|
description: Some(
|
||||||
"Use in your applications to determine information about the Revolt node"
|
"Use in your applications to determine information about the Stoat node"
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
),
|
),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
Tag {
|
Tag {
|
||||||
name: "User Information".to_owned(),
|
name: "User Information".to_owned(),
|
||||||
description: Some("Query and fetch users on Revolt".to_owned()),
|
description: Some("Query and fetch users on Stoat".to_owned()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
Tag {
|
Tag {
|
||||||
name: "Direct Messaging".to_owned(),
|
name: "Direct Messaging".to_owned(),
|
||||||
description: Some("Direct message other users on Revolt".to_owned()),
|
description: Some("Direct message other users on Stoat".to_owned()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
Tag {
|
Tag {
|
||||||
@@ -283,7 +235,7 @@ fn custom_openapi_spec() -> OpenApi {
|
|||||||
},
|
},
|
||||||
Tag {
|
Tag {
|
||||||
name: "Channel Information".to_owned(),
|
name: "Channel Information".to_owned(),
|
||||||
description: Some("Query and fetch channels on Revolt".to_owned()),
|
description: Some("Query and fetch channels on Stoat".to_owned()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
Tag {
|
Tag {
|
||||||
@@ -313,7 +265,7 @@ fn custom_openapi_spec() -> OpenApi {
|
|||||||
},
|
},
|
||||||
Tag {
|
Tag {
|
||||||
name: "Server Information".to_owned(),
|
name: "Server Information".to_owned(),
|
||||||
description: Some("Query and fetch servers on Revolt".to_owned()),
|
description: Some("Query and fetch servers on Stoat".to_owned()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
Tag {
|
Tag {
|
||||||
@@ -349,7 +301,7 @@ fn custom_openapi_spec() -> OpenApi {
|
|||||||
Tag {
|
Tag {
|
||||||
name: "Onboarding".to_owned(),
|
name: "Onboarding".to_owned(),
|
||||||
description: Some(
|
description: Some(
|
||||||
"After signing up to Revolt, users must pick a unique username".to_owned(),
|
"After signing up to Stoat, users must pick a unique username".to_owned(),
|
||||||
),
|
),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
@@ -361,7 +313,7 @@ fn custom_openapi_spec() -> OpenApi {
|
|||||||
Tag {
|
Tag {
|
||||||
name: "Web Push".to_owned(),
|
name: "Web Push".to_owned(),
|
||||||
description: Some(
|
description: Some(
|
||||||
"Subscribe to and receive Revolt push notifications while offline".to_owned(),
|
"Subscribe to and receive Stoat push notifications while offline".to_owned(),
|
||||||
),
|
),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -21,32 +21,26 @@ async fn main() -> Result<(), std::io::Error> {
|
|||||||
// Configure API schema
|
// Configure API schema
|
||||||
#[derive(OpenApi)]
|
#[derive(OpenApi)]
|
||||||
#[openapi(
|
#[openapi(
|
||||||
modifiers(&SecurityAddon),
|
paths(api::root, api::proxy, api::embed),
|
||||||
paths(
|
components(schemas(
|
||||||
api::root,
|
api::RootResponse,
|
||||||
api::proxy,
|
revolt_result::Error,
|
||||||
api::embed
|
revolt_result::ErrorType,
|
||||||
),
|
revolt_models::v0::ImageSize,
|
||||||
components(
|
revolt_models::v0::Image,
|
||||||
schemas(
|
revolt_models::v0::Video,
|
||||||
api::RootResponse,
|
revolt_models::v0::TwitchType,
|
||||||
revolt_result::Error,
|
revolt_models::v0::LightspeedType,
|
||||||
revolt_result::ErrorType,
|
revolt_models::v0::BandcampType,
|
||||||
revolt_models::v0::ImageSize,
|
revolt_models::v0::Special,
|
||||||
revolt_models::v0::Image,
|
revolt_models::v0::WebsiteMetadata,
|
||||||
revolt_models::v0::Video,
|
revolt_models::v0::Text,
|
||||||
revolt_models::v0::TwitchType,
|
revolt_models::v0::Embed
|
||||||
revolt_models::v0::LightspeedType,
|
))
|
||||||
revolt_models::v0::BandcampType,
|
|
||||||
revolt_models::v0::Special,
|
|
||||||
revolt_models::v0::WebsiteMetadata,
|
|
||||||
revolt_models::v0::Text,
|
|
||||||
revolt_models::v0::Embed
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)]
|
)]
|
||||||
struct ApiDoc;
|
struct ApiDoc;
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
struct SecurityAddon;
|
struct SecurityAddon;
|
||||||
|
|
||||||
impl Modify for SecurityAddon {
|
impl Modify for SecurityAddon {
|
||||||
|
|||||||
Reference in New Issue
Block a user