mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
chore: bump axum version
This commit is contained in:
parent
f9a6c2cefe
commit
50900ee640
4 changed files with 72 additions and 67 deletions
39
Cargo.lock
generated
39
Cargo.lock
generated
|
|
@ -81,7 +81,7 @@ name = "api"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"axum 0.7.9",
|
"axum 0.8.4",
|
||||||
"fred",
|
"fred",
|
||||||
"hyper 1.6.0",
|
"hyper 1.6.0",
|
||||||
"hyper-util",
|
"hyper-util",
|
||||||
|
|
@ -173,7 +173,7 @@ name = "avatars"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"axum 0.7.9",
|
"axum 0.8.4",
|
||||||
"data-encoding",
|
"data-encoding",
|
||||||
"form_urlencoded",
|
"form_urlencoded",
|
||||||
"futures",
|
"futures",
|
||||||
|
|
@ -256,7 +256,7 @@ dependencies = [
|
||||||
"http-body 0.4.6",
|
"http-body 0.4.6",
|
||||||
"hyper 0.14.32",
|
"hyper 0.14.32",
|
||||||
"itoa",
|
"itoa",
|
||||||
"matchit",
|
"matchit 0.7.3",
|
||||||
"memchr",
|
"memchr",
|
||||||
"mime",
|
"mime",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
|
|
@ -275,13 +275,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "axum"
|
name = "axum"
|
||||||
version = "0.7.9"
|
version = "0.8.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f"
|
checksum = "021e862c184ae977658b36c4500f7feac3221ca5da43e3f25bd04ab6c79a29b5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"axum-core 0.5.2",
|
||||||
"axum-core 0.4.5",
|
|
||||||
"bytes",
|
"bytes",
|
||||||
|
"form_urlencoded",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"http 1.3.1",
|
"http 1.3.1",
|
||||||
"http-body 1.0.1",
|
"http-body 1.0.1",
|
||||||
|
|
@ -289,7 +289,7 @@ dependencies = [
|
||||||
"hyper 1.6.0",
|
"hyper 1.6.0",
|
||||||
"hyper-util",
|
"hyper-util",
|
||||||
"itoa",
|
"itoa",
|
||||||
"matchit",
|
"matchit 0.8.4",
|
||||||
"memchr",
|
"memchr",
|
||||||
"mime",
|
"mime",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
|
|
@ -326,13 +326,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "axum-core"
|
name = "axum-core"
|
||||||
version = "0.4.5"
|
version = "0.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199"
|
checksum = "68464cd0412f486726fb3373129ef5d2993f90c34bc2bc1c1e9943b2f4fc7ca6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-util",
|
"futures-core",
|
||||||
"http 1.3.1",
|
"http 1.3.1",
|
||||||
"http-body 1.0.1",
|
"http-body 1.0.1",
|
||||||
"http-body-util",
|
"http-body-util",
|
||||||
|
|
@ -859,7 +858,7 @@ name = "dispatch"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"axum 0.7.9",
|
"axum 0.8.4",
|
||||||
"hickory-client",
|
"hickory-client",
|
||||||
"libpk",
|
"libpk",
|
||||||
"reqwest 0.12.15",
|
"reqwest 0.12.15",
|
||||||
|
|
@ -1211,7 +1210,7 @@ name = "gateway"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"axum 0.7.9",
|
"axum 0.8.4",
|
||||||
"bytes",
|
"bytes",
|
||||||
"chrono",
|
"chrono",
|
||||||
"fred",
|
"fred",
|
||||||
|
|
@ -1237,7 +1236,7 @@ name = "gdpr_worker"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"axum 0.7.9",
|
"axum 0.8.4",
|
||||||
"futures",
|
"futures",
|
||||||
"libpk",
|
"libpk",
|
||||||
"sqlx",
|
"sqlx",
|
||||||
|
|
@ -1992,7 +1991,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
|
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"windows-targets 0.48.5",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -2104,6 +2103,12 @@ version = "0.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
|
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "matchit"
|
||||||
|
version = "0.8.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "maybe-async"
|
name = "maybe-async"
|
||||||
version = "0.2.10"
|
version = "0.2.10"
|
||||||
|
|
@ -3115,7 +3120,7 @@ dependencies = [
|
||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys 0.4.15",
|
"linux-raw-sys 0.4.15",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ resolver = "2"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
axum = "0.7.5"
|
axum = "0.8.4"
|
||||||
axum-macros = "0.4.1"
|
axum-macros = "0.4.1"
|
||||||
bytes = "1.6.0"
|
bytes = "1.6.0"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
|
|
|
||||||
|
|
@ -59,52 +59,52 @@ async fn rproxy(
|
||||||
fn router(ctx: ApiContext) -> Router {
|
fn router(ctx: ApiContext) -> Router {
|
||||||
// processed upside down (???) so we have to put middleware at the end
|
// processed upside down (???) so we have to put middleware at the end
|
||||||
Router::new()
|
Router::new()
|
||||||
.route("/v2/systems/:system_id", get(rproxy))
|
.route("/v2/systems/{system_id}", get(rproxy))
|
||||||
.route("/v2/systems/:system_id", patch(rproxy))
|
.route("/v2/systems/{system_id}", patch(rproxy))
|
||||||
.route("/v2/systems/:system_id/settings", get(rproxy))
|
.route("/v2/systems/{system_id}/settings", get(rproxy))
|
||||||
.route("/v2/systems/:system_id/settings", patch(rproxy))
|
.route("/v2/systems/{system_id}/settings", patch(rproxy))
|
||||||
|
|
||||||
.route("/v2/systems/:system_id/members", get(rproxy))
|
.route("/v2/systems/{system_id}/members", get(rproxy))
|
||||||
.route("/v2/members", post(rproxy))
|
.route("/v2/members", post(rproxy))
|
||||||
.route("/v2/members/:member_id", get(rproxy))
|
.route("/v2/members/{member_id}", get(rproxy))
|
||||||
.route("/v2/members/:member_id", patch(rproxy))
|
.route("/v2/members/{member_id}", patch(rproxy))
|
||||||
.route("/v2/members/:member_id", delete(rproxy))
|
.route("/v2/members/{member_id}", delete(rproxy))
|
||||||
|
|
||||||
.route("/v2/systems/:system_id/groups", get(rproxy))
|
.route("/v2/systems/{system_id}/groups", get(rproxy))
|
||||||
.route("/v2/groups", post(rproxy))
|
.route("/v2/groups", post(rproxy))
|
||||||
.route("/v2/groups/:group_id", get(rproxy))
|
.route("/v2/groups/{group_id}", get(rproxy))
|
||||||
.route("/v2/groups/:group_id", patch(rproxy))
|
.route("/v2/groups/{group_id}", patch(rproxy))
|
||||||
.route("/v2/groups/:group_id", delete(rproxy))
|
.route("/v2/groups/{group_id}", delete(rproxy))
|
||||||
|
|
||||||
.route("/v2/groups/:group_id/members", get(rproxy))
|
.route("/v2/groups/{group_id}/members", get(rproxy))
|
||||||
.route("/v2/groups/:group_id/members/add", post(rproxy))
|
.route("/v2/groups/{group_id}/members/add", post(rproxy))
|
||||||
.route("/v2/groups/:group_id/members/remove", post(rproxy))
|
.route("/v2/groups/{group_id}/members/remove", post(rproxy))
|
||||||
.route("/v2/groups/:group_id/members/overwrite", post(rproxy))
|
.route("/v2/groups/{group_id}/members/overwrite", post(rproxy))
|
||||||
|
|
||||||
.route("/v2/members/:member_id/groups", get(rproxy))
|
.route("/v2/members/{member_id}/groups", get(rproxy))
|
||||||
.route("/v2/members/:member_id/groups/add", post(rproxy))
|
.route("/v2/members/{member_id}/groups/add", post(rproxy))
|
||||||
.route("/v2/members/:member_id/groups/remove", post(rproxy))
|
.route("/v2/members/{member_id}/groups/remove", post(rproxy))
|
||||||
.route("/v2/members/:member_id/groups/overwrite", post(rproxy))
|
.route("/v2/members/{member_id}/groups/overwrite", post(rproxy))
|
||||||
|
|
||||||
.route("/v2/systems/:system_id/switches", get(rproxy))
|
.route("/v2/systems/{system_id}/switches", get(rproxy))
|
||||||
.route("/v2/systems/:system_id/switches", post(rproxy))
|
.route("/v2/systems/{system_id}/switches", post(rproxy))
|
||||||
.route("/v2/systems/:system_id/fronters", get(rproxy))
|
.route("/v2/systems/{system_id}/fronters", get(rproxy))
|
||||||
|
|
||||||
.route("/v2/systems/:system_id/switches/:switch_id", get(rproxy))
|
.route("/v2/systems/{system_id}/switches/{switch_id}", get(rproxy))
|
||||||
.route("/v2/systems/:system_id/switches/:switch_id", patch(rproxy))
|
.route("/v2/systems/{system_id}/switches/{switch_id}", patch(rproxy))
|
||||||
.route("/v2/systems/:system_id/switches/:switch_id/members", patch(rproxy))
|
.route("/v2/systems/{system_id}/switches/{switch_id}/members", patch(rproxy))
|
||||||
.route("/v2/systems/:system_id/switches/:switch_id", delete(rproxy))
|
.route("/v2/systems/{system_id}/switches/{switch_id}", delete(rproxy))
|
||||||
|
|
||||||
.route("/v2/systems/:system_id/guilds/:guild_id", get(rproxy))
|
.route("/v2/systems/{system_id}/guilds/{guild_id}", get(rproxy))
|
||||||
.route("/v2/systems/:system_id/guilds/:guild_id", patch(rproxy))
|
.route("/v2/systems/{system_id}/guilds/{guild_id}", patch(rproxy))
|
||||||
|
|
||||||
.route("/v2/members/:member_id/guilds/:guild_id", get(rproxy))
|
.route("/v2/members/{member_id}/guilds/{guild_id}", get(rproxy))
|
||||||
.route("/v2/members/:member_id/guilds/:guild_id", patch(rproxy))
|
.route("/v2/members/{member_id}/guilds/{guild_id}", patch(rproxy))
|
||||||
|
|
||||||
.route("/v2/systems/:system_id/autoproxy", get(rproxy))
|
.route("/v2/systems/{system_id}/autoproxy", get(rproxy))
|
||||||
.route("/v2/systems/:system_id/autoproxy", patch(rproxy))
|
.route("/v2/systems/{system_id}/autoproxy", patch(rproxy))
|
||||||
|
|
||||||
.route("/v2/messages/:message_id", get(rproxy))
|
.route("/v2/messages/{message_id}", get(rproxy))
|
||||||
|
|
||||||
.route("/private/bulk_privacy/member", post(rproxy))
|
.route("/private/bulk_privacy/member", post(rproxy))
|
||||||
.route("/private/bulk_privacy/group", post(rproxy))
|
.route("/private/bulk_privacy/group", post(rproxy))
|
||||||
|
|
@ -113,9 +113,9 @@ fn router(ctx: ApiContext) -> Router {
|
||||||
.route("/private/discord/shard_state", get(endpoints::private::discord_state))
|
.route("/private/discord/shard_state", get(endpoints::private::discord_state))
|
||||||
.route("/private/stats", get(endpoints::private::meta))
|
.route("/private/stats", get(endpoints::private::meta))
|
||||||
|
|
||||||
.route("/v2/systems/:system_id/oembed.json", get(rproxy))
|
.route("/v2/systems/{system_id}/oembed.json", get(rproxy))
|
||||||
.route("/v2/members/:member_id/oembed.json", get(rproxy))
|
.route("/v2/members/{member_id}/oembed.json", get(rproxy))
|
||||||
.route("/v2/groups/:group_id/oembed.json", get(rproxy))
|
.route("/v2/groups/{group_id}/oembed.json", get(rproxy))
|
||||||
|
|
||||||
.layer(middleware::ratelimit::ratelimiter(middleware::ratelimit::do_request_ratelimited)) // this sucks
|
.layer(middleware::ratelimit::ratelimiter(middleware::ratelimit::do_request_ratelimited)) // this sucks
|
||||||
.layer(axum::middleware::from_fn_with_state(ctx.clone(), middleware::authnz))
|
.layer(axum::middleware::from_fn_with_state(ctx.clone(), middleware::authnz))
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ pub async fn run_server(cache: Arc<DiscordCache>, runtime_config: Arc<RuntimeCon
|
||||||
|
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
.route(
|
.route(
|
||||||
"/guilds/:guild_id",
|
"/guilds/{guild_id}",
|
||||||
get(|State(cache): State<Arc<DiscordCache>>, Path(guild_id): Path<u64>| async move {
|
get(|State(cache): State<Arc<DiscordCache>>, Path(guild_id): Path<u64>| async move {
|
||||||
match cache.guild(Id::new(guild_id)) {
|
match cache.guild(Id::new(guild_id)) {
|
||||||
Some(guild) => status_code(StatusCode::FOUND, to_string(&guild).unwrap()),
|
Some(guild) => status_code(StatusCode::FOUND, to_string(&guild).unwrap()),
|
||||||
|
|
@ -42,7 +42,7 @@ pub async fn run_server(cache: Arc<DiscordCache>, runtime_config: Arc<RuntimeCon
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.route(
|
.route(
|
||||||
"/guilds/:guild_id/members/@me",
|
"/guilds/{guild_id}/members/@me",
|
||||||
get(|State(cache): State<Arc<DiscordCache>>, Path(guild_id): Path<u64>| async move {
|
get(|State(cache): State<Arc<DiscordCache>>, Path(guild_id): Path<u64>| async move {
|
||||||
match cache.0.member(Id::new(guild_id), libpk::config.discord.as_ref().expect("missing discord config").client_id) {
|
match cache.0.member(Id::new(guild_id), libpk::config.discord.as_ref().expect("missing discord config").client_id) {
|
||||||
Some(member) => status_code(StatusCode::FOUND, to_string(member.value()).unwrap()),
|
Some(member) => status_code(StatusCode::FOUND, to_string(member.value()).unwrap()),
|
||||||
|
|
@ -51,7 +51,7 @@ pub async fn run_server(cache: Arc<DiscordCache>, runtime_config: Arc<RuntimeCon
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.route(
|
.route(
|
||||||
"/guilds/:guild_id/permissions/@me",
|
"/guilds/{guild_id}/permissions/@me",
|
||||||
get(|State(cache): State<Arc<DiscordCache>>, Path(guild_id): Path<u64>| async move {
|
get(|State(cache): State<Arc<DiscordCache>>, Path(guild_id): Path<u64>| async move {
|
||||||
match cache.guild_permissions(Id::new(guild_id), libpk::config.discord.as_ref().expect("missing discord config").client_id).await {
|
match cache.guild_permissions(Id::new(guild_id), libpk::config.discord.as_ref().expect("missing discord config").client_id).await {
|
||||||
Ok(val) => {
|
Ok(val) => {
|
||||||
|
|
@ -65,7 +65,7 @@ pub async fn run_server(cache: Arc<DiscordCache>, runtime_config: Arc<RuntimeCon
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.route(
|
.route(
|
||||||
"/guilds/:guild_id/permissions/:user_id",
|
"/guilds/{guild_id}/permissions/{user_id}",
|
||||||
get(|State(cache): State<Arc<DiscordCache>>, Path((guild_id, user_id)): Path<(u64, u64)>| async move {
|
get(|State(cache): State<Arc<DiscordCache>>, Path((guild_id, user_id)): Path<(u64, u64)>| async move {
|
||||||
match cache.guild_permissions(Id::new(guild_id), Id::new(user_id)).await {
|
match cache.guild_permissions(Id::new(guild_id), Id::new(user_id)).await {
|
||||||
Ok(val) => status_code(StatusCode::FOUND, to_string(&val.bits()).unwrap()),
|
Ok(val) => status_code(StatusCode::FOUND, to_string(&val.bits()).unwrap()),
|
||||||
|
|
@ -78,7 +78,7 @@ pub async fn run_server(cache: Arc<DiscordCache>, runtime_config: Arc<RuntimeCon
|
||||||
)
|
)
|
||||||
|
|
||||||
.route(
|
.route(
|
||||||
"/guilds/:guild_id/channels",
|
"/guilds/{guild_id}/channels",
|
||||||
get(|State(cache): State<Arc<DiscordCache>>, Path(guild_id): Path<u64>| async move {
|
get(|State(cache): State<Arc<DiscordCache>>, Path(guild_id): Path<u64>| async move {
|
||||||
let channel_ids = match cache.0.guild_channels(Id::new(guild_id)) {
|
let channel_ids = match cache.0.guild_channels(Id::new(guild_id)) {
|
||||||
Some(channels) => channels.to_owned(),
|
Some(channels) => channels.to_owned(),
|
||||||
|
|
@ -104,7 +104,7 @@ pub async fn run_server(cache: Arc<DiscordCache>, runtime_config: Arc<RuntimeCon
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.route(
|
.route(
|
||||||
"/guilds/:guild_id/channels/:channel_id",
|
"/guilds/{guild_id}/channels/{channel_id}",
|
||||||
get(|State(cache): State<Arc<DiscordCache>>, Path((guild_id, channel_id)): Path<(u64, u64)>| async move {
|
get(|State(cache): State<Arc<DiscordCache>>, Path((guild_id, channel_id)): Path<(u64, u64)>| async move {
|
||||||
if guild_id == 0 {
|
if guild_id == 0 {
|
||||||
return status_code(StatusCode::FOUND, to_string(&dm_channel(Id::new(channel_id))).unwrap());
|
return status_code(StatusCode::FOUND, to_string(&dm_channel(Id::new(channel_id))).unwrap());
|
||||||
|
|
@ -116,7 +116,7 @@ pub async fn run_server(cache: Arc<DiscordCache>, runtime_config: Arc<RuntimeCon
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.route(
|
.route(
|
||||||
"/guilds/:guild_id/channels/:channel_id/permissions/@me",
|
"/guilds/{guild_id}/channels/{channel_id}/permissions/@me",
|
||||||
get(|State(cache): State<Arc<DiscordCache>>, Path((guild_id, channel_id)): Path<(u64, u64)>| async move {
|
get(|State(cache): State<Arc<DiscordCache>>, Path((guild_id, channel_id)): Path<(u64, u64)>| async move {
|
||||||
if guild_id == 0 {
|
if guild_id == 0 {
|
||||||
return status_code(StatusCode::FOUND, to_string(&*DM_PERMISSIONS).unwrap());
|
return status_code(StatusCode::FOUND, to_string(&*DM_PERMISSIONS).unwrap());
|
||||||
|
|
@ -131,11 +131,11 @@ pub async fn run_server(cache: Arc<DiscordCache>, runtime_config: Arc<RuntimeCon
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.route(
|
.route(
|
||||||
"/guilds/:guild_id/channels/:channel_id/permissions/:user_id",
|
"/guilds/{guild_id}/channels/{channel_id}/permissions/{user_id}",
|
||||||
get(|| async { "todo" }),
|
get(|| async { "todo" }),
|
||||||
)
|
)
|
||||||
.route(
|
.route(
|
||||||
"/guilds/:guild_id/channels/:channel_id/last_message",
|
"/guilds/{guild_id}/channels/{channel_id}/last_message",
|
||||||
get(|State(cache): State<Arc<DiscordCache>>, Path((_guild_id, channel_id)): Path<(u64, Id<ChannelMarker>)>| async move {
|
get(|State(cache): State<Arc<DiscordCache>>, Path((_guild_id, channel_id)): Path<(u64, Id<ChannelMarker>)>| async move {
|
||||||
let lm = cache.get_last_message(channel_id).await;
|
let lm = cache.get_last_message(channel_id).await;
|
||||||
status_code(StatusCode::FOUND, to_string(&lm).unwrap())
|
status_code(StatusCode::FOUND, to_string(&lm).unwrap())
|
||||||
|
|
@ -143,7 +143,7 @@ pub async fn run_server(cache: Arc<DiscordCache>, runtime_config: Arc<RuntimeCon
|
||||||
)
|
)
|
||||||
|
|
||||||
.route(
|
.route(
|
||||||
"/guilds/:guild_id/roles",
|
"/guilds/{guild_id}/roles",
|
||||||
get(|State(cache): State<Arc<DiscordCache>>, Path(guild_id): Path<u64>| async move {
|
get(|State(cache): State<Arc<DiscordCache>>, Path(guild_id): Path<u64>| async move {
|
||||||
let role_ids = match cache.0.guild_roles(Id::new(guild_id)) {
|
let role_ids = match cache.0.guild_roles(Id::new(guild_id)) {
|
||||||
Some(roles) => roles.to_owned(),
|
Some(roles) => roles.to_owned(),
|
||||||
|
|
@ -186,12 +186,12 @@ pub async fn run_server(cache: Arc<DiscordCache>, runtime_config: Arc<RuntimeCon
|
||||||
.route("/runtime_config", get(|| async move {
|
.route("/runtime_config", get(|| async move {
|
||||||
status_code(StatusCode::FOUND, to_string(&runtime_config.get_all().await).unwrap())
|
status_code(StatusCode::FOUND, to_string(&runtime_config.get_all().await).unwrap())
|
||||||
}))
|
}))
|
||||||
.route("/runtime_config/:key", post(|Path(key): Path<String>, body: String| async move {
|
.route("/runtime_config/{key}", post(|Path(key): Path<String>, body: String| async move {
|
||||||
let runtime_config = runtime_config_for_post;
|
let runtime_config = runtime_config_for_post;
|
||||||
runtime_config.set(key, body).await.expect("failed to update runtime config");
|
runtime_config.set(key, body).await.expect("failed to update runtime config");
|
||||||
status_code(StatusCode::FOUND, to_string(&runtime_config.get_all().await).unwrap())
|
status_code(StatusCode::FOUND, to_string(&runtime_config.get_all().await).unwrap())
|
||||||
}))
|
}))
|
||||||
.route("/runtime_config/:key", delete(|Path(key): Path<String>| async move {
|
.route("/runtime_config/{key}", delete(|Path(key): Path<String>| async move {
|
||||||
let runtime_config = runtime_config_for_delete;
|
let runtime_config = runtime_config_for_delete;
|
||||||
runtime_config.delete(key).await.expect("failed to update runtime config");
|
runtime_config.delete(key).await.expect("failed to update runtime config");
|
||||||
status_code(StatusCode::FOUND, to_string(&runtime_config.get_all().await).unwrap())
|
status_code(StatusCode::FOUND, to_string(&runtime_config.get_all().await).unwrap())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue