New formatting

This commit is contained in:
regalijan 2023-10-19 16:50:21 -04:00
parent 0b5e82bfcc
commit 026d1ca06d
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520
30 changed files with 76 additions and 76 deletions

View File

@ -15,5 +15,5 @@ export interface ClientStyleContextData {
} }
export const ClientStyleContext = createContext<ClientStyleContextData | null>( export const ClientStyleContext = createContext<ClientStyleContextData | null>(
null null,
); );

View File

@ -34,5 +34,5 @@ hydrateRoot(
<ClientCacheProvider> <ClientCacheProvider>
<RemixBrowser /> <RemixBrowser />
</ClientCacheProvider> </ClientCacheProvider>
</StrictMode> </StrictMode>,
); );

View File

@ -10,7 +10,7 @@ export default function handleRequest(
request: Request, request: Request,
responseStatusCode: number, responseStatusCode: number,
responseHeaders: Headers, responseHeaders: Headers,
remixContext: EntryContext remixContext: EntryContext,
) { ) {
const cache = createEmotionCache(); const cache = createEmotionCache();
const { extractCriticalToChunks } = createEmotionServer(cache); const { extractCriticalToChunks } = createEmotionServer(cache);
@ -19,7 +19,7 @@ export default function handleRequest(
<CacheProvider value={cache}> <CacheProvider value={cache}>
<RemixServer context={remixContext} url={request.url} /> <RemixServer context={remixContext} url={request.url} />
</CacheProvider> </CacheProvider>
</ServerStyleContext.Provider> </ServerStyleContext.Provider>,
); );
const chunks = extractCriticalToChunks(html); const chunks = extractCriticalToChunks(html);
@ -29,7 +29,7 @@ export default function handleRequest(
<CacheProvider value={cache}> <CacheProvider value={cache}>
<RemixServer context={remixContext} url={request.url} /> <RemixServer context={remixContext} url={request.url} />
</CacheProvider> </CacheProvider>
</ServerStyleContext.Provider> </ServerStyleContext.Provider>,
); );
responseHeaders.set("content-type", "text/html;charset=utf-8"); responseHeaders.set("content-type", "text/html;charset=utf-8");

View File

@ -46,7 +46,7 @@ export function ErrorBoundary() {
<Link color="#646cff" onClick={() => location.reload()}> <Link color="#646cff" onClick={() => location.reload()}>
Refresh Refresh
</Link> </Link>
</Container> </Container>,
); );
const { status } = error; const { status } = error;
@ -74,7 +74,7 @@ export function ErrorBoundary() {
<Link color="#646cff" onClick={() => history.go(-1)}> <Link color="#646cff" onClick={() => history.go(-1)}>
Go back Go back
</Link> </Link>
</Container> </Container>,
); );
default: default:
@ -90,7 +90,7 @@ export function ErrorBoundary() {
<Link color="#646cff" onClick={() => location.reload()}> <Link color="#646cff" onClick={() => location.reload()}>
Reload Reload
</Link> </Link>
</Container> </Container>,
); );
} }
} }
@ -124,7 +124,7 @@ export function meta() {
function getMarkup( function getMarkup(
loaderData: { [k: string]: any }, loaderData: { [k: string]: any },
child: ReactNode child: ReactNode,
): JSX.Element { ): JSX.Element {
const Document = withEmotionCache( const Document = withEmotionCache(
({ children }: { children: ReactNode }, emotionCache) => { ({ children }: { children: ReactNode }, emotionCache) => {
@ -149,7 +149,7 @@ function getMarkup(
colorModeManager={cookieStorageManagerSSR( colorModeManager={cookieStorageManagerSSR(
typeof document === "undefined" typeof document === "undefined"
? `chakra-ui-color-mode=${loaderData.theme}` ? `chakra-ui-color-mode=${loaderData.theme}`
: document.cookie : document.cookie,
)} )}
theme={theme} theme={theme}
> >
@ -199,7 +199,7 @@ function getMarkup(
</body> </body>
</html> </html>
); );
} },
); );
return <Document>{child}</Document>; return <Document>{child}</Document>;

View File

@ -44,7 +44,7 @@ export async function loader({ context }: { context: RequestContext }) {
await dataKV.list({ await dataKV.list({
prefix: `appeal_${currentUser.id}`, prefix: `appeal_${currentUser.id}`,
}) })
).keys.length ).keys.length,
), ),
can_toggle: can_toggle:
currentUser.permissions & (1 << 0) || currentUser.permissions & (1 << 11), currentUser.permissions & (1 << 0) || currentUser.permissions & (1 << 11),

View File

@ -23,7 +23,7 @@ import { useEffect, useState } from "react";
export default function (props: AppealCardProps) { export default function (props: AppealCardProps) {
const [dateString, setDateString] = useState( const [dateString, setDateString] = useState(
new Date(props.created_at).toUTCString() new Date(props.created_at).toUTCString(),
); );
const [action, setAction] = useState(""); const [action, setAction] = useState("");
const [feedback, setFeedback] = useState(""); const [feedback, setFeedback] = useState("");

View File

@ -49,7 +49,7 @@ export default function ({
state: { [k: string]: string | string[] }, state: { [k: string]: string | string[] },
setState: Dispatch<SetStateAction<{}>>, setState: Dispatch<SetStateAction<{}>>,
id: string, id: string,
value: string value: string,
) { ) {
const newState = { ...state }; const newState = { ...state };
newState[id] = value; newState[id] = value;
@ -60,7 +60,7 @@ export default function ({
function renderCheckboxOptions( function renderCheckboxOptions(
c: component, c: component,
state: { [k: string]: string | string[] }, state: { [k: string]: string | string[] },
setState: Dispatch<SetStateAction<{}>> setState: Dispatch<SetStateAction<{}>>,
) { ) {
if (!c.options) throw new Error("Options for checkbox are undefined"); if (!c.options) throw new Error("Options for checkbox are undefined");
@ -88,7 +88,7 @@ export default function ({
? groupValues.push(e.target.value) ? groupValues.push(e.target.value)
: groupValues.splice( : groupValues.splice(
groupValues.findIndex((v) => v === e.target.value), groupValues.findIndex((v) => v === e.target.value),
1 1,
); );
newState[c.id] = groupValues; newState[c.id] = groupValues;
@ -97,7 +97,7 @@ export default function ({
value={option.value} value={option.value}
> >
{option.value} {option.value}
</Checkbox> </Checkbox>,
); );
} }
@ -111,7 +111,7 @@ export default function ({
function renderRadioElements( function renderRadioElements(
c: component, c: component,
state: { [k: string]: string | string[] }, state: { [k: string]: string | string[] },
setState: Dispatch<SetStateAction<{}>> setState: Dispatch<SetStateAction<{}>>,
) { ) {
if (!c.options) throw new Error("Options for radio buttons are undefined!"); if (!c.options) throw new Error("Options for radio buttons are undefined!");
const buttons = []; const buttons = [];
@ -120,7 +120,7 @@ export default function ({
buttons.push( buttons.push(
<Radio checked={option.default} value={option.value}> <Radio checked={option.default} value={option.value}>
{option.value} {option.value}
</Radio> </Radio>,
); );
} }
@ -142,7 +142,7 @@ export default function ({
function renderSelectElements( function renderSelectElements(
c: component, c: component,
state: { [k: string]: string | string[] }, state: { [k: string]: string | string[] },
setState: Dispatch<SetStateAction<{}>> setState: Dispatch<SetStateAction<{}>>,
) { ) {
if (!c.options) throw new Error("Options for select are undefined!"); if (!c.options) throw new Error("Options for select are undefined!");
@ -170,14 +170,14 @@ export default function ({
function generateReactComponents( function generateReactComponents(
components: component[], components: component[],
state: { [k: string]: string | string[] }, state: { [k: string]: string | string[] },
setState: Dispatch<SetStateAction<{}>> setState: Dispatch<SetStateAction<{}>>,
): JSX.Element[] { ): JSX.Element[] {
const fragmentsList = []; const fragmentsList = [];
for (const component of components) { for (const component of components) {
fragmentsList.push( fragmentsList.push(
<Heading size="md">{component.title}</Heading>, <Heading size="md">{component.title}</Heading>,
<br /> <br />,
); );
switch (component.type) { switch (component.type) {
@ -204,7 +204,7 @@ export default function ({
value={component.value} value={component.value}
/> />
<FormErrorMessage>Field is required</FormErrorMessage> <FormErrorMessage>Field is required</FormErrorMessage>
</FormControl> </FormControl>,
); );
break; break;
@ -212,7 +212,7 @@ export default function ({
fragmentsList.push( fragmentsList.push(
<NumberInput <NumberInput
isInvalid={isNumberElemInvalid( isInvalid={isNumberElemInvalid(
document.getElementById(component.id) as HTMLInputElement document.getElementById(component.id) as HTMLInputElement,
)} )}
isReadOnly={read_only} isReadOnly={read_only}
> >
@ -227,7 +227,7 @@ export default function ({
<NumberIncrementStepper /> <NumberIncrementStepper />
<NumberDecrementStepper /> <NumberDecrementStepper />
</NumberInputStepper> </NumberInputStepper>
</NumberInput> </NumberInput>,
); );
break; break;
@ -256,7 +256,7 @@ export default function ({
style={{ display: page ? "none" : undefined }} style={{ display: page ? "none" : undefined }}
> >
{generateReactComponents(componentList, responses, setResponses)} {generateReactComponents(componentList, responses, setResponses)}
</div> </div>,
); );
} }

View File

@ -22,7 +22,7 @@ import {
export default function (props: GameAppealProps) { export default function (props: GameAppealProps) {
async function performAction(action: "accept" | "deny"): Promise<void> { async function performAction(action: "accept" | "deny"): Promise<void> {
const statsReduction = parseInt( const statsReduction = parseInt(
(document.getElementById("reductPercentage") as HTMLInputElement).value (document.getElementById("reductPercentage") as HTMLInputElement).value,
); );
const actionResponse = await fetch(`/api/game-appeals/${props.roblox_id}`, { const actionResponse = await fetch(`/api/game-appeals/${props.roblox_id}`, {
@ -49,7 +49,7 @@ export default function (props: GameAppealProps) {
duration: 10000, duration: 10000,
status: "error", status: "error",
title: "An error occurred...", title: "An error occurred...",
} },
); );
} }

View File

@ -112,6 +112,9 @@ export default function (props: {
<Link href="/support" size="lg"> <Link href="/support" size="lg">
Support Support
</Link> </Link>
<Link href="https://ccdiscussion.com" size="lg">
Community
</Link>
<Link <Link
display={hasMod() ? undefined : "none"} display={hasMod() ? undefined : "none"}
href="/mod-queue" href="/mod-queue"

View File

@ -18,7 +18,7 @@ export default function (props: { isOpen: boolean; onClose: () => void }) {
if (!props.isOpen) return; if (!props.isOpen) return;
const evidenceElement = document.getElementById( const evidenceElement = document.getElementById(
"evidence" "evidence",
) as HTMLInputElement; ) as HTMLInputElement;
if (!evidenceElement.files && e.clipboardData?.files) { if (!evidenceElement.files && e.clipboardData?.files) {

View File

@ -55,7 +55,7 @@ function createConstructStyleTagsFromChunks(cache, nonceString) {
item.key, item.key,
item.ids.join(" "), item.ids.join(" "),
item.css, item.css,
nonceString nonceString,
); );
}); });
@ -73,7 +73,7 @@ export function createEmotionServer(cache) {
extractCriticalToChunks: createExtractCriticalToChunks(cache), extractCriticalToChunks: createExtractCriticalToChunks(cache),
constructStyleTagsFromChunks: createConstructStyleTagsFromChunks( constructStyleTagsFromChunks: createConstructStyleTagsFromChunks(
cache, cache,
nonceString nonceString,
), ),
}; };
} }

View File

@ -106,10 +106,7 @@ async function setHeaders(context: RequestContext) {
"Content-Security-Policy", "Content-Security-Policy",
"connect-src: https://o1071757.ingest.sentry.io https://storage.googleapis.com self; default-src: self; frame-src: https://challenges.cloudflare.com; img-src: https://cdn.discordapp.com https://mediaproxy.carcrushers.cc self; media-src: https://mediaproxy.carcrushers.cc; report-uri: https://o1071757.ingest.sentry.io/api/6069431/security/?sentry_key=3d2b34700e6942f9b739cd8b2001f70f; script=src: https://challenges.cloudflare.com self", "connect-src: https://o1071757.ingest.sentry.io https://storage.googleapis.com self; default-src: self; frame-src: https://challenges.cloudflare.com; img-src: https://cdn.discordapp.com https://mediaproxy.carcrushers.cc self; media-src: https://mediaproxy.carcrushers.cc; report-uri: https://o1071757.ingest.sentry.io/api/6069431/security/?sentry_key=3d2b34700e6942f9b739cd8b2001f70f; script=src: https://challenges.cloudflare.com self",
); );
response.headers.set( response.headers.set("Permissions-Policy", "clipboard-write=(self)");
"Permissions-Policy",
"clipboard-write=(self)",
);
response.headers.set("Referrer-Policy", "same-origin"); response.headers.set("Referrer-Policy", "same-origin");
response.headers.set( response.headers.set(
"RTV", "RTV",

View File

@ -7,7 +7,7 @@ export async function onRequest(context: RequestContext) {
}); });
const deliveryDate = new Date( const deliveryDate = new Date(
Date.now() + 86400000 + Math.round(Math.random() * 172800000) Date.now() + 86400000 + Math.round(Math.random() * 172800000),
) )
.toUTCString() .toUTCString()
.replace("GMT", "+0000"); .replace("GMT", "+0000");

View File

@ -15,7 +15,7 @@ export async function onRequestPost(context: RequestContext) {
authorization: `Basic ${btoa("api:" + context.env.MAILGUN_API_KEY)}`, authorization: `Basic ${btoa("api:" + context.env.MAILGUN_API_KEY)}`,
}, },
method: "POST", method: "POST",
} },
); );
if (!emailReq.ok) { if (!emailReq.ok) {
@ -38,7 +38,7 @@ export async function onRequestPost(context: RequestContext) {
"x-audit-log-reason": `Appeal accepted by ${currentUser.username}#${currentUser.discriminator} (${currentUser.id})`, "x-audit-log-reason": `Appeal accepted by ${currentUser.username}#${currentUser.discriminator} (${currentUser.id})`,
}, },
method: "DELETE", method: "DELETE",
} },
); );
await fetch(context.env.APPEALS_WEBHOOK, { await fetch(context.env.APPEALS_WEBHOOK, {

View File

@ -11,7 +11,7 @@ export async function onRequestPost(context: RequestContext) {
await context.env.DATA.put( await context.env.DATA.put(
`appealban_${context.data.targetId}`, `appealban_${context.data.targetId}`,
JSON.stringify({ moderator: currentUser.id }) JSON.stringify({ moderator: currentUser.id }),
); );
await fetch(context.env.APPEALS_WEBHOOK, { await fetch(context.env.APPEALS_WEBHOOK, {
body: JSON.stringify({ body: JSON.stringify({

View File

@ -15,7 +15,7 @@ export async function onRequestPost(context: RequestContext) {
authorization: `Basic ${btoa("api:" + context.env.MAILGUN_API_KEY)}`, authorization: `Basic ${btoa("api:" + context.env.MAILGUN_API_KEY)}`,
}, },
method: "POST", method: "POST",
} },
); );
if (!emailReq.ok) { if (!emailReq.ok) {

View File

@ -19,7 +19,7 @@ export async function onRequestPost(context: RequestContext) {
"content-type": "application/json", "content-type": "application/json",
}, },
status: 400, status: 400,
} },
); );
const { current_user: currentUser } = context.data; const { current_user: currentUser } = context.data;
@ -36,13 +36,13 @@ export async function onRequestPost(context: RequestContext) {
prefix: `appeal_${currentUser.id}`, prefix: `appeal_${currentUser.id}`,
}); });
const existingBlockedAppeal = await context.env.DATA.get( const existingBlockedAppeal = await context.env.DATA.get(
`blockedappeal_${currentUser.id}` `blockedappeal_${currentUser.id}`,
); );
if ( if (
existingBlockedAppeal || existingBlockedAppeal ||
existingAppeals.keys.find( existingAppeals.keys.find(
(appeal) => (appeal.metadata as { [k: string]: any })?.open (appeal) => (appeal.metadata as { [k: string]: any })?.open,
) )
) )
return new Response('{"error":"Appeal already submitted"}', { return new Response('{"error":"Appeal already submitted"}', {
@ -82,7 +82,7 @@ export async function onRequestPost(context: RequestContext) {
}), }),
{ {
expirationTtl: 94608000, expirationTtl: 94608000,
} },
); );
await fetch(context.env.APPEALS_WEBHOOK, { await fetch(context.env.APPEALS_WEBHOOK, {

View File

@ -14,7 +14,7 @@ export async function onRequestGet(context: RequestContext) {
`https://discord.com/oauth2/authorize?client_id=${ `https://discord.com/oauth2/authorize?client_id=${
env.DISCORD_ID env.DISCORD_ID
}&redirect_uri=${encodeURIComponent( }&redirect_uri=${encodeURIComponent(
`${protocol}//${host}/api/auth/session` `${protocol}//${host}/api/auth/session`,
)}&response_type=code&scope=identify%20email%20guilds.members.read&state=${state}` )}&response_type=code&scope=identify%20email%20guilds.members.read&state=${state}`,
); );
} }

View File

@ -4,7 +4,7 @@ import tokenPrefixes from "../../../data/token_prefixes.json";
async function generateTokenHash(token: string): Promise<string> { async function generateTokenHash(token: string): Promise<string> {
const hash = await crypto.subtle.digest( const hash = await crypto.subtle.digest(
"SHA-512", "SHA-512",
new TextEncoder().encode(token) new TextEncoder().encode(token),
); );
return btoa(String.fromCharCode(...new Uint8Array(hash))) return btoa(String.fromCharCode(...new Uint8Array(hash)))
.replace(/\+/g, "-") .replace(/\+/g, "-")
@ -62,7 +62,7 @@ export async function onRequestGet(context: RequestContext) {
}).toString(), }).toString(),
headers: { headers: {
authorization: `Basic ${btoa( authorization: `Basic ${btoa(
context.env.DISCORD_ID + ":" + context.env.DISCORD_SECRET context.env.DISCORD_ID + ":" + context.env.DISCORD_SECRET,
)}`, )}`,
"content-type": "application/x-www-form-urlencoded", "content-type": "application/x-www-form-urlencoded",
}, },
@ -114,7 +114,7 @@ export async function onRequestGet(context: RequestContext) {
headers: { headers: {
authorization: `Bearer ${tokenData.access_token}`, authorization: `Bearer ${tokenData.access_token}`,
}, },
} },
); );
const memberData: { [k: string]: any } = await serverMemberReq.json(); const memberData: { [k: string]: any } = await serverMemberReq.json();
@ -133,7 +133,7 @@ export async function onRequestGet(context: RequestContext) {
selectedTokenStart + selectedTokenStart +
`${crypto.randomUUID()}${crypto.randomUUID()}${crypto.randomUUID()}${crypto.randomUUID()}`.replaceAll( `${crypto.randomUUID()}${crypto.randomUUID()}${crypto.randomUUID()}${crypto.randomUUID()}`.replaceAll(
"-", "-",
"" "",
); );
const tokenHash = await generateTokenHash(authToken); const tokenHash = await generateTokenHash(authToken);

View File

@ -13,7 +13,7 @@ export async function onRequestPost(context: RequestContext) {
}); });
const appeal = await context.env.DATA.get( const appeal = await context.env.DATA.get(
`gameappeal_${context.params.id as string}` `gameappeal_${context.params.id as string}`,
); );
if (!appeal) if (!appeal)
@ -45,7 +45,7 @@ export async function onRequestPost(context: RequestContext) {
await insertLogs( await insertLogs(
{ [data.roblox_id]: 4 }, { [data.roblox_id]: 4 },
context.params.id as string, context.params.id as string,
context context,
); );
await setBanList(context, banList); await setBanList(context, banList);

View File

@ -17,7 +17,7 @@ export async function onRequestPost(context: RequestContext) {
await context.env.DATA.put( await context.env.DATA.put(
`gameappealblock_${appealData.roblox_id}`, `gameappealblock_${appealData.roblox_id}`,
`${Date.now() + 2592000000}`, `${Date.now() + 2592000000}`,
{ expirationTtl: 2592000000 } { expirationTtl: 2592000000 },
); );
return new Response(null, { return new Response(null, {

View File

@ -11,7 +11,7 @@ export async function onRequestGet(context: RequestContext) {
headers: { headers: {
"content-type": "application/json", "content-type": "application/json",
}, },
} },
); );
if (!robloxUserReq.ok) { if (!robloxUserReq.ok) {
@ -41,13 +41,13 @@ export async function onRequestGet(context: RequestContext) {
a.entity.properties.executed_at.integerValue > a.entity.properties.executed_at.integerValue >
b.entity.properties.executed_at.integerValue b.entity.properties.executed_at.integerValue
? 1 ? 1
: -1 : -1,
) ),
), ),
{ {
headers: { headers: {
"content-type": "application/json", "content-type": "application/json",
}, },
} },
); );
} }

View File

@ -6,7 +6,7 @@ export async function onRequestPost(context: RequestContext) {
if ( if (
!ticket_link?.match( !ticket_link?.match(
/^https?:\/\/carcrushers\.modmail\.dev\/logs\/[a-z\d]{12}$/ /^https?:\/\/carcrushers\.modmail\.dev\/logs\/[a-z\d]{12}$/,
) )
) )
return new Response('{"error":"Invalid ticket link provided"}', { return new Response('{"error":"Invalid ticket link provided"}', {

View File

@ -19,7 +19,7 @@ export async function onRequestPost(context: RequestContext) {
if ( if (
["165594923586945025", "289372404541554689", "396347223736057866"].includes( ["165594923586945025", "289372404541554689", "396347223736057866"].includes(
user user,
) )
) )
return new Response(null, { return new Response(null, {

View File

@ -14,7 +14,7 @@ export async function onRequestPost(context: RequestContext) {
if ( if (
!context.data.current_user?.permissions || !context.data.current_user?.permissions ||
![1 << 0, 1 << 2, 1 << 11].find( ![1 << 0, 1 << 2, 1 << 11].find(
(p) => context.data.current_user.permissions & p (p) => context.data.current_user.permissions & p,
) )
) )
return new Response('{"error":"Forbidden"}', { return new Response('{"error":"Forbidden"}', {
@ -88,7 +88,7 @@ export async function onRequestPost(context: RequestContext) {
}); });
const attachmentKey = `${Date.now()}${Math.round( const attachmentKey = `${Date.now()}${Math.round(
Math.random() * 10000000 Math.random() * 10000000,
).toString()}/${file.name}`; ).toString()}/${file.name}`;
urlPromises.push( urlPromises.push(
@ -96,8 +96,8 @@ export async function onRequestPost(context: RequestContext) {
context.env, context.env,
attachmentKey, attachmentKey,
file.size, file.size,
(allowedFileTypes.find((t) => t === file.type) as string).split("/")[1] (allowedFileTypes.find((t) => t === file.type) as string).split("/")[1],
) ),
); );
} }
@ -111,9 +111,9 @@ export async function onRequestPost(context: RequestContext) {
status: 500, status: 500,
}); });
const infractionId = `${body.get("user")}${Date.now()}${ const infractionId = `${body.get(
context.request.headers.get("cf-ray")?.split("-")[0] "user",
}`; )}${Date.now()}${context.request.headers.get("cf-ray")?.split("-")[0]}`;
const uploadReqs = []; const uploadReqs = [];
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
@ -121,7 +121,7 @@ export async function onRequestPost(context: RequestContext) {
fetch(settledURLPromises[i] as unknown as string, { fetch(settledURLPromises[i] as unknown as string, {
body: files[i], body: files[i],
method: "PUT", method: "PUT",
}) }),
); );
} }
@ -130,7 +130,7 @@ export async function onRequestPost(context: RequestContext) {
JSON.stringify({ JSON.stringify({
created_at: Date.now(), created_at: Date.now(),
moderator: context.data.current_user.id, moderator: context.data.current_user.id,
}) }),
); );
return new Response(null, { return new Response(null, {

View File

@ -54,7 +54,7 @@ export async function onRequestGet(context: RequestContext) {
To avoid any potential injection attacks we enforce a list of specific values and permissions for table names To avoid any potential injection attacks we enforce a list of specific values and permissions for table names
*/ */
await context.env.D1.prepare( await context.env.D1.prepare(
`SELECT id FROM ${table} WHERE created_at < ? AND open = ? ORDER BY created_at DESC LIMIT 25;` `SELECT id FROM ${table} WHERE created_at < ? AND open = ? ORDER BY created_at DESC LIMIT 25;`,
) )
.bind(before, Number(!showClosed)) .bind(before, Number(!showClosed))
.all(); .all();

View File

@ -8,18 +8,18 @@ export async function onRequestGet(context: RequestContext) {
new TextEncoder().encode(atob(context.env.URL_SIGNING_KEY)), new TextEncoder().encode(atob(context.env.URL_SIGNING_KEY)),
{ hash: "SHA-1", name: "HMAC" }, { hash: "SHA-1", name: "HMAC" },
false, false,
["sign"] ["sign"],
); );
const signature = await crypto.subtle.sign( const signature = await crypto.subtle.sign(
"HMAC", "HMAC",
signingKey, signingKey,
new TextEncoder().encode(unsignedURL) new TextEncoder().encode(unsignedURL),
); );
return Response.redirect( return Response.redirect(
`${unsignedURL}&Signature=${btoa(new TextDecoder().decode(signature)) `${unsignedURL}&Signature=${btoa(new TextDecoder().decode(signature))
.replaceAll("+", "-") .replaceAll("+", "-")
.replaceAll("/", "_") .replaceAll("/", "_")
.replaceAll("=", "")}` .replaceAll("=", "")}`,
); );
} }

View File

@ -1,7 +1,7 @@
export default async function ( export default async function (
userid: string, userid: string,
roles?: string[], roles?: string[],
context?: RequestContext context?: RequestContext,
): Promise<number> { ): Promise<number> {
let permissions = 0; let permissions = 0;
@ -12,7 +12,7 @@ export default async function (
if (roles?.includes("607697704419852289")) permissions |= 1 << 4; // Events Team Management if (roles?.includes("607697704419852289")) permissions |= 1 << 4; // Events Team Management
if ( if (
["165594923586945025", "289372404541554689", "396347223736057866"].includes( ["165594923586945025", "289372404541554689", "396347223736057866"].includes(
userid userid,
) || ) ||
Boolean(await context?.env.DATA.get(`gamemod_${userid}`)) Boolean(await context?.env.DATA.get(`gamemod_${userid}`))
) )

View File

@ -18,7 +18,7 @@ export async function getBanList(context: RequestContext) {
export async function setBanList( export async function setBanList(
context: RequestContext, context: RequestContext,
data: { [k: string]: { [k: string]: any } } data: { [k: string]: { [k: string]: any } },
) { ) {
const setRequest = await fetch(DATASTORE_URL, { const setRequest = await fetch(DATASTORE_URL, {
body: JSON.stringify(data), body: JSON.stringify(data),

2
index.d.ts vendored
View File

@ -17,7 +17,7 @@ declare global {
interface EmotionServer { interface EmotionServer {
constructStyleTagsFromChunks: ( constructStyleTagsFromChunks: (
criticalData: EmotionCriticalToChunks criticalData: EmotionCriticalToChunks,
) => string; ) => string;
extractCriticalToChunks: (html: string) => EmotionCriticalToChunks; extractCriticalToChunks: (html: string) => EmotionCriticalToChunks;
} }