New formatting
This commit is contained in:
@ -7,7 +7,7 @@ export async function onRequest(context: RequestContext) {
|
||||
});
|
||||
|
||||
const deliveryDate = new Date(
|
||||
Date.now() + 86400000 + Math.round(Math.random() * 172800000)
|
||||
Date.now() + 86400000 + Math.round(Math.random() * 172800000),
|
||||
)
|
||||
.toUTCString()
|
||||
.replace("GMT", "+0000");
|
||||
|
@ -15,7 +15,7 @@ export async function onRequestPost(context: RequestContext) {
|
||||
authorization: `Basic ${btoa("api:" + context.env.MAILGUN_API_KEY)}`,
|
||||
},
|
||||
method: "POST",
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
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})`,
|
||||
},
|
||||
method: "DELETE",
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
await fetch(context.env.APPEALS_WEBHOOK, {
|
||||
|
@ -11,7 +11,7 @@ export async function onRequestPost(context: RequestContext) {
|
||||
|
||||
await context.env.DATA.put(
|
||||
`appealban_${context.data.targetId}`,
|
||||
JSON.stringify({ moderator: currentUser.id })
|
||||
JSON.stringify({ moderator: currentUser.id }),
|
||||
);
|
||||
await fetch(context.env.APPEALS_WEBHOOK, {
|
||||
body: JSON.stringify({
|
||||
|
@ -15,7 +15,7 @@ export async function onRequestPost(context: RequestContext) {
|
||||
authorization: `Basic ${btoa("api:" + context.env.MAILGUN_API_KEY)}`,
|
||||
},
|
||||
method: "POST",
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
if (!emailReq.ok) {
|
||||
|
@ -19,7 +19,7 @@ export async function onRequestPost(context: RequestContext) {
|
||||
"content-type": "application/json",
|
||||
},
|
||||
status: 400,
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const { current_user: currentUser } = context.data;
|
||||
@ -36,13 +36,13 @@ export async function onRequestPost(context: RequestContext) {
|
||||
prefix: `appeal_${currentUser.id}`,
|
||||
});
|
||||
const existingBlockedAppeal = await context.env.DATA.get(
|
||||
`blockedappeal_${currentUser.id}`
|
||||
`blockedappeal_${currentUser.id}`,
|
||||
);
|
||||
|
||||
if (
|
||||
existingBlockedAppeal ||
|
||||
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"}', {
|
||||
@ -82,7 +82,7 @@ export async function onRequestPost(context: RequestContext) {
|
||||
}),
|
||||
{
|
||||
expirationTtl: 94608000,
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
await fetch(context.env.APPEALS_WEBHOOK, {
|
||||
|
@ -14,7 +14,7 @@ export async function onRequestGet(context: RequestContext) {
|
||||
`https://discord.com/oauth2/authorize?client_id=${
|
||||
env.DISCORD_ID
|
||||
}&redirect_uri=${encodeURIComponent(
|
||||
`${protocol}//${host}/api/auth/session`
|
||||
)}&response_type=code&scope=identify%20email%20guilds.members.read&state=${state}`
|
||||
`${protocol}//${host}/api/auth/session`,
|
||||
)}&response_type=code&scope=identify%20email%20guilds.members.read&state=${state}`,
|
||||
);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import tokenPrefixes from "../../../data/token_prefixes.json";
|
||||
async function generateTokenHash(token: string): Promise<string> {
|
||||
const hash = await crypto.subtle.digest(
|
||||
"SHA-512",
|
||||
new TextEncoder().encode(token)
|
||||
new TextEncoder().encode(token),
|
||||
);
|
||||
return btoa(String.fromCharCode(...new Uint8Array(hash)))
|
||||
.replace(/\+/g, "-")
|
||||
@ -62,7 +62,7 @@ export async function onRequestGet(context: RequestContext) {
|
||||
}).toString(),
|
||||
headers: {
|
||||
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",
|
||||
},
|
||||
@ -114,7 +114,7 @@ export async function onRequestGet(context: RequestContext) {
|
||||
headers: {
|
||||
authorization: `Bearer ${tokenData.access_token}`,
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const memberData: { [k: string]: any } = await serverMemberReq.json();
|
||||
@ -133,7 +133,7 @@ export async function onRequestGet(context: RequestContext) {
|
||||
selectedTokenStart +
|
||||
`${crypto.randomUUID()}${crypto.randomUUID()}${crypto.randomUUID()}${crypto.randomUUID()}`.replaceAll(
|
||||
"-",
|
||||
""
|
||||
"",
|
||||
);
|
||||
|
||||
const tokenHash = await generateTokenHash(authToken);
|
||||
|
@ -13,7 +13,7 @@ export async function onRequestPost(context: RequestContext) {
|
||||
});
|
||||
|
||||
const appeal = await context.env.DATA.get(
|
||||
`gameappeal_${context.params.id as string}`
|
||||
`gameappeal_${context.params.id as string}`,
|
||||
);
|
||||
|
||||
if (!appeal)
|
||||
@ -45,7 +45,7 @@ export async function onRequestPost(context: RequestContext) {
|
||||
await insertLogs(
|
||||
{ [data.roblox_id]: 4 },
|
||||
context.params.id as string,
|
||||
context
|
||||
context,
|
||||
);
|
||||
await setBanList(context, banList);
|
||||
|
||||
|
@ -17,7 +17,7 @@ export async function onRequestPost(context: RequestContext) {
|
||||
await context.env.DATA.put(
|
||||
`gameappealblock_${appealData.roblox_id}`,
|
||||
`${Date.now() + 2592000000}`,
|
||||
{ expirationTtl: 2592000000 }
|
||||
{ expirationTtl: 2592000000 },
|
||||
);
|
||||
|
||||
return new Response(null, {
|
||||
|
@ -11,7 +11,7 @@ export async function onRequestGet(context: RequestContext) {
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
if (!robloxUserReq.ok) {
|
||||
@ -41,13 +41,13 @@ export async function onRequestGet(context: RequestContext) {
|
||||
a.entity.properties.executed_at.integerValue >
|
||||
b.entity.properties.executed_at.integerValue
|
||||
? 1
|
||||
: -1
|
||||
)
|
||||
: -1,
|
||||
),
|
||||
),
|
||||
{
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ export async function onRequestPost(context: RequestContext) {
|
||||
|
||||
if (
|
||||
!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"}', {
|
||||
|
@ -19,7 +19,7 @@ export async function onRequestPost(context: RequestContext) {
|
||||
|
||||
if (
|
||||
["165594923586945025", "289372404541554689", "396347223736057866"].includes(
|
||||
user
|
||||
user,
|
||||
)
|
||||
)
|
||||
return new Response(null, {
|
||||
|
@ -14,7 +14,7 @@ export async function onRequestPost(context: RequestContext) {
|
||||
if (
|
||||
!context.data.current_user?.permissions ||
|
||||
![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"}', {
|
||||
@ -88,7 +88,7 @@ export async function onRequestPost(context: RequestContext) {
|
||||
});
|
||||
|
||||
const attachmentKey = `${Date.now()}${Math.round(
|
||||
Math.random() * 10000000
|
||||
Math.random() * 10000000,
|
||||
).toString()}/${file.name}`;
|
||||
|
||||
urlPromises.push(
|
||||
@ -96,8 +96,8 @@ export async function onRequestPost(context: RequestContext) {
|
||||
context.env,
|
||||
attachmentKey,
|
||||
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,
|
||||
});
|
||||
|
||||
const infractionId = `${body.get("user")}${Date.now()}${
|
||||
context.request.headers.get("cf-ray")?.split("-")[0]
|
||||
}`;
|
||||
const infractionId = `${body.get(
|
||||
"user",
|
||||
)}${Date.now()}${context.request.headers.get("cf-ray")?.split("-")[0]}`;
|
||||
const uploadReqs = [];
|
||||
|
||||
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, {
|
||||
body: files[i],
|
||||
method: "PUT",
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ export async function onRequestPost(context: RequestContext) {
|
||||
JSON.stringify({
|
||||
created_at: Date.now(),
|
||||
moderator: context.data.current_user.id,
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
return new Response(null, {
|
||||
|
@ -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
|
||||
*/
|
||||
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))
|
||||
.all();
|
||||
|
@ -8,18 +8,18 @@ export async function onRequestGet(context: RequestContext) {
|
||||
new TextEncoder().encode(atob(context.env.URL_SIGNING_KEY)),
|
||||
{ hash: "SHA-1", name: "HMAC" },
|
||||
false,
|
||||
["sign"]
|
||||
["sign"],
|
||||
);
|
||||
const signature = await crypto.subtle.sign(
|
||||
"HMAC",
|
||||
signingKey,
|
||||
new TextEncoder().encode(unsignedURL)
|
||||
new TextEncoder().encode(unsignedURL),
|
||||
);
|
||||
|
||||
return Response.redirect(
|
||||
`${unsignedURL}&Signature=${btoa(new TextDecoder().decode(signature))
|
||||
.replaceAll("+", "-")
|
||||
.replaceAll("/", "_")
|
||||
.replaceAll("=", "")}`
|
||||
.replaceAll("=", "")}`,
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user