feat(labrinth): route to update subscriptions for archon (#6811)

* feat(labrinth): add /_internal/billing/subscriptions/manager/update_many

* chore: fixes

* chore: clippy

* chore: fixes
This commit is contained in:
François-Xavier Talbot
2026-07-22 16:18:08 +00:00
committed by GitHub
parent 07fd4fae5f
commit 96e2d95d02
8 changed files with 156 additions and 20 deletions
+15
View File
@@ -6,6 +6,7 @@ use crate::env::ENV;
pub const ADMIN_KEY_HEADER: &str = "Modrinth-Admin";
pub const MEDAL_KEY_HEADER: &str = "X-Medal-Access-Key";
pub const EXTERNAL_NOTIFICATION_KEY_HEADER: &str = "External-Notification-Key";
pub const SUBSCRIPTIONS_KEY_HEADER: &str = "Modrinth-Subscriptions-Key";
pub fn admin_key_guard(ctx: &GuardContext) -> bool {
ctx.head()
@@ -30,6 +31,20 @@ pub fn external_notification_key_guard(ctx: &GuardContext) -> bool {
})
}
pub fn subscriptions_key_guard(ctx: &GuardContext) -> bool {
// Ensure the subs key is set and at least 32 characters
if ENV.LABRINTH_SUBSCRIPTIONS_KEY.chars().count() < 32 {
return false;
}
ctx.head()
.headers()
.get(SUBSCRIPTIONS_KEY_HEADER)
.is_some_and(|it| {
it.as_bytes() == ENV.LABRINTH_SUBSCRIPTIONS_KEY.as_bytes()
})
}
pub fn internal_network_guard(ctx: &GuardContext) -> bool {
ctx.head()
.peer_addr