Implement Labrinth Canary API flag (#5531)

This commit is contained in:
aecsocket
2026-03-11 15:28:09 +00:00
committed by GitHub
parent 086508be23
commit 3b21944a75
7 changed files with 71 additions and 1 deletions

View File

@@ -2,7 +2,9 @@ import {
type AbstractFeature,
type AuthConfig,
AuthFeature,
CanaryCookieFeature,
CircuitBreakerFeature,
LABRINTH_CANARY_COOKIE,
NodeAuthFeature,
nodeAuthState,
NuxtCircuitBreakerStorage,
@@ -28,7 +30,11 @@ export function createModrinthClient(
auth: Ref<{ token: string | undefined }>,
config: { apiBaseUrl: string; archonBaseUrl: string; rateLimitKey?: string },
): NuxtModrinthClient {
const flags = useFeatureFlags()
const optionalFeatures = [
new CanaryCookieFeature({
getCookie: () => (flags.value.labrinthApiCanary ? LABRINTH_CANARY_COOKIE : undefined),
}) as AbstractFeature,
import.meta.dev ? (new VerboseLoggingFeature() as AbstractFeature) : undefined,
].filter(Boolean) as AbstractFeature[]