refactor: tweak

This commit is contained in:
Acid Chicken (硫酸鶏) 2024-05-30 18:49:24 +09:00
parent 475ba6baba
commit c521b2482a
No known key found for this signature in database
GPG Key ID: 3E87B98A3F6BAB99

View File

@ -1,7 +1,7 @@
function parseRFC9110ListsLax(value: string | null): string[] { function parseRFC9110ListsLax(value: string | null): string[] {
return ( return (
value value
?.split(/(?<=^[^"]*|^(?:[^"]*"[^"]*"[^"]*)*),/) ?.split(/(?<=^[^"]*(?:(?:"[^"]*){2})*),/)
.map((value) => value.trim()) .map((value) => value.trim())
.filter((value) => value) ?? [] .filter((value) => value) ?? []
) )
@ -20,13 +20,13 @@ export function requestInit(request: Request) {
"200-299": 86400, "200-299": 86400,
"400-599": 60, "400-599": 60,
}, },
} satisfies RequestInitCfProperties, },
headers: { headers: {
Accept: "text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8", Accept: "text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8",
"CDN-Loop": cdnLoop.concat(url.hostname).join(", "), "CDN-Loop": cdnLoop.concat(url.hostname).join(", "),
"User-Agent": "Mozilla/5.0 (compatible; Summerflare; +https://github.com/misskey-dev/summerflare)", "User-Agent": "Mozilla/5.0 (compatible; Summerflare; +https://github.com/misskey-dev/summerflare)",
}, },
} } satisfies RequestInit
} }
if (import.meta.vitest) { if (import.meta.vitest) {