frontend deployment changes & stop prerendering (#7227)

* feat: frontend docker image

* build: tweak gc, disable prerendering

* feat: pass along UA

* fix: fallback to process.env

* build: remove this pr branch test

* fix: don't pin docker image ver
This commit is contained in:
Michael H.
2026-08-20 17:07:07 +00:00
committed by GitHub
parent f39a602be3
commit bee0c14b31
13 changed files with 221 additions and 80 deletions
+10 -11
View File
@@ -5,17 +5,10 @@ import {
type NuxtClientConfig,
NuxtModrinthClient,
} from '@modrinth/api-client'
import type { H3Event } from 'h3'
import { getRequestHeader, type H3Event } from 'h3'
async function getRateLimitKeyFromSecretsStore(): Promise<string | undefined> {
try {
const mod = 'cloudflare:workers'
const { env } = await import(/* @vite-ignore */ mod)
return await env.RATE_LIMIT_IGNORE_KEY?.get()
} catch {
return undefined
}
}
import { readEnv } from '~/helpers/env'
import { getFrontendUserAgent, VISITOR_USER_AGENT_HEADER } from '~/helpers/user-agent'
export interface ServerModrinthClientOptions {
event?: H3Event
@@ -28,6 +21,10 @@ export function useServerModrinthClient(options?: ServerModrinthClientOptions):
const sharedInstancesBaseUrl =
config.sharedInstancesBaseUrl || config.public.sharedInstancesBaseUrl
const visitorUserAgent = options?.event
? getRequestHeader(options.event, 'user-agent')
: undefined
const features = []
if (options?.authToken) {
@@ -42,7 +39,9 @@ export function useServerModrinthClient(options?: ServerModrinthClientOptions):
const clientConfig: NuxtClientConfig = {
labrinthBaseUrl: apiBaseUrl,
sharedInstancesBaseUrl,
rateLimitKey: config.rateLimitKey || getRateLimitKeyFromSecretsStore,
userAgent: getFrontendUserAgent(config.public.hash),
headers: visitorUserAgent ? { [VISITOR_USER_AGENT_HEADER]: visitorUserAgent } : undefined,
rateLimitKey: config.rateLimitKey || (() => readEnv('RATE_LIMIT_IGNORE_KEY')),
features,
}