chore: fmt [no ci]

This commit is contained in:
2026-07-07 22:16:21 +07:00 Unverified
parent 2db9bb10a2
commit 7bfabaa5a1
8 changed files with 147 additions and 127 deletions
+9 -9
View File
@@ -4,12 +4,12 @@ kind: Kustomization
namespace: enka namespace: enka
resources: resources:
- namespace.yaml - namespace.yaml
- deployment.yaml - deployment.yaml
- service.yaml - service.yaml
- ingress.yaml - ingress.yaml
- secret.yaml - secret.yaml
- service-account.yaml - service-account.yaml
- role.yaml - role.yaml
- role-binding.yaml - role-binding.yaml
- token-secret.yaml - token-secret.yaml
+1 -1
View File
@@ -8,6 +8,6 @@ roleRef:
kind: Role kind: Role
name: ci-deployer name: ci-deployer
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: ci-deployer name: ci-deployer
namespace: enka namespace: enka
+5 -5
View File
@@ -4,18 +4,18 @@ metadata:
name: ci-deployer name: ci-deployer
namespace: enka namespace: enka
rules: rules:
- apiGroups: ["apps"] - apiGroups: ["apps"]
resources: ["deployments"] resources: ["deployments"]
verbs: ["get", "list", "watch", "update", "patch"] verbs: ["get", "list", "watch", "update", "patch"]
- apiGroups: [""] - apiGroups: [""]
resources: ["pods"] resources: ["pods"]
verbs: ["get", "list", "watch"] verbs: ["get", "list", "watch"]
- apiGroups: [""] - apiGroups: [""]
resources: ["services"] resources: ["services"]
verbs: ["get", "list", "watch", "create", "update", "patch"] verbs: ["get", "list", "watch", "create", "update", "patch"]
- apiGroups: ["networking.k8s.io"] - apiGroups: ["networking.k8s.io"]
resources: ["ingresses"] resources: ["ingresses"]
verbs: ["get", "list", "watch", "create", "update", "patch"] verbs: ["get", "list", "watch", "create", "update", "patch"]
- apiGroups: ["batch"] - apiGroups: ["batch"]
resources: ["jobs"] resources: ["jobs"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
+10 -4
View File
@@ -484,7 +484,9 @@ export function card(app: App) {
afterResponse: ({ log }) => log`Rendering completed`, afterResponse: ({ log }) => log`Rendering completed`,
}, },
) )
.get("/enka/:username", async ({ params: { username }, query: { lang } }) => { .get(
"/enka/:username",
async ({ params: { username }, query: { lang } }) => {
const errorLoc = cardErrorLocs[lang === "th" ? "th" : "en"]; const errorLoc = cardErrorLocs[lang === "th" ? "th" : "en"];
try { try {
const cacheKey = `enka-redir::${username}`; const cacheKey = `enka-redir::${username}`;
@@ -522,7 +524,9 @@ export function card(app: App) {
); );
const builds = await buildsArr.then((e) => const builds = await buildsArr.then((e) =>
(( ((
pair: [string, { id: number; order: `${number}` }[]] | undefined, pair:
| [string, { id: number; order: `${number}` }[]]
| undefined,
) => ) =>
pair pair
? { ? {
@@ -553,13 +557,15 @@ export function card(app: App) {
return status(404, errorLoc.profileNotFound); return status(404, errorLoc.profileNotFound);
throw err; throw err;
} }
}, { },
{
query: t.Partial( query: t.Partial(
t.Object({ t.Object({
lang: Locale, lang: Locale,
}), }),
), ),
}) },
)
.get( .get(
"/enka/:username/:hash/:char/:build", "/enka/:username/:hash/:char/:build",
async ({ async ({
+1 -2
View File
@@ -243,8 +243,7 @@ export async function ListPage(
cons: cons:
avatarInfoList?.find( avatarInfoList?.find(
(e) => e.avatar.avatarId === a.avatar.avatarId, (e) => e.avatar.avatarId === a.avatar.avatarId,
)!.talentIdList?.length ?? )!.talentIdList?.length ?? a.talentLevel,
a.talentLevel,
})) }))
.map(({ a, c, cons }) => ( .map(({ a, c, cons }) => (
<div tw="relative flex flex-col rounded-[.3em] overflow-hidden shadow-[0_.08em_.35em_rgba(0,0,0,.18)]"> <div tw="relative flex flex-col rounded-[.3em] overflow-hidden shadow-[0_.08em_.35em_rgba(0,0,0,.18)]">
+20 -5
View File
@@ -33,19 +33,31 @@ export function webhookMerger(app: App) {
const oldData = existing.data; const oldData = existing.data;
const flushed = new Set<string>(); const flushed = new Set<string>();
existing.data = merge(oldData, body, undefined, MAX_FIELD_LENGTH, flushed); existing.data = merge(
oldData,
body,
undefined,
MAX_FIELD_LENGTH,
flushed,
);
existing.count++; existing.count++;
if (flushed.size > 0) { if (flushed.size > 0) {
existing.count = 1; existing.count = 1;
forward(id, url, oldData); forward(id, url, oldData);
existing.timer = setTimeout(() => forward(id, url, existing.data), bufferTime); existing.timer = setTimeout(
() => forward(id, url, existing.data),
bufferTime,
);
return status(202); return status(202);
} }
log.debug`collected ${existing}`; log.debug`collected ${existing}`;
existing.timer = setTimeout(() => forward(id, url, existing.data), bufferTime); existing.timer = setTimeout(
() => forward(id, url, existing.data),
bufferTime,
);
return status(202); return status(202);
} }
@@ -77,11 +89,14 @@ async function getRoutes(): Promise<RouteMap> {
function parseRouteMap(raw: string): RouteMap { function parseRouteMap(raw: string): RouteMap {
const parsed = JSON.parse(raw) as unknown; const parsed = JSON.parse(raw) as unknown;
if (!Array.isArray(parsed)) throw new Error("WH_ROUTE_MAP must be a JSON array"); if (!Array.isArray(parsed))
throw new Error("WH_ROUTE_MAP must be a JSON array");
for (const [index, route] of parsed.entries()) { for (const [index, route] of parsed.entries()) {
if (!Array.isArray(route) || route.length !== 3) { if (!Array.isArray(route) || route.length !== 3) {
throw new Error(`WH_ROUTE_MAP route ${index} must be [id, url, bufferTime]`); throw new Error(
`WH_ROUTE_MAP route ${index} must be [id, url, bufferTime]`,
);
} }
const [id, url, bufferTime] = route; const [id, url, bufferTime] = route;