Compare commits
4 Commits
7c7701f406
...
41f361fcf1
| Author | SHA1 | Date | |
|---|---|---|---|
|
41f361fcf1
|
|||
|
513234bbe6
|
|||
|
5ba59ff596
|
|||
|
bcd07299c5
|
@@ -84,6 +84,10 @@ export default function (props: GameAppealProps & { port?: MessagePort }) {
|
|||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardBody>
|
<CardBody>
|
||||||
<Stack divider={<StackDivider />}>
|
<Stack divider={<StackDivider />}>
|
||||||
|
<Box>
|
||||||
|
<Heading size="xs">Appeal Type</Heading>
|
||||||
|
<Text>{props.type}</Text>
|
||||||
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Heading size="xs">Response: Explanation of Ban</Heading>
|
<Heading size="xs">Response: Explanation of Ban</Heading>
|
||||||
<Text>{props.what_happened}</Text>
|
<Text>{props.what_happened}</Text>
|
||||||
|
|||||||
@@ -16,29 +16,49 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
if (!appeal) return jsonError("Appeal not found", 400);
|
if (!appeal) return jsonError("Appeal not found", 400);
|
||||||
|
|
||||||
const banList = (await getBanList(context)) as {
|
const banList = (await getBanList(context)) as {
|
||||||
[k: string]: { BanType: number; Unbanned?: boolean; UnbanReduct?: number };
|
[k: string]: {
|
||||||
|
BanType: number;
|
||||||
|
hidden_from_leaderboards?: boolean;
|
||||||
|
serverconfigurator_blacklist?: boolean;
|
||||||
|
Unbanned?: boolean;
|
||||||
|
UnbanReduct?: number;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
await context.env.D1.prepare("DELETE FROM game_appeals WHERE id = ?;")
|
await context.env.D1.prepare("DELETE FROM game_appeals WHERE id = ?;")
|
||||||
.bind(context.params.id)
|
.bind(context.params.id)
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
if (!banList[appeal.roblox_id])
|
if (!banList[appeal.roblox_id]?.BanType)
|
||||||
return new Response(null, {
|
return new Response(null, {
|
||||||
status: 204,
|
status: 204,
|
||||||
});
|
});
|
||||||
|
|
||||||
banList[appeal.roblox_id] = {
|
if (banList[appeal.roblox_id].BanType === 2) {
|
||||||
BanType: 0,
|
banList[appeal.roblox_id] = {
|
||||||
Unbanned: true,
|
BanType: 0,
|
||||||
UnbanReduct: statsReduction,
|
Unbanned: true,
|
||||||
};
|
UnbanReduct: statsReduction,
|
||||||
|
};
|
||||||
|
} else if (appeal.type === "server configurator") {
|
||||||
|
banList[appeal.roblox_id] = {
|
||||||
|
...banList[appeal.roblox_id],
|
||||||
|
serverconfigurator_blacklist: false,
|
||||||
|
};
|
||||||
|
} else if (appeal.type === "blacklist") {
|
||||||
|
banList[appeal.roblox_id] = {
|
||||||
|
...banList[appeal.roblox_id],
|
||||||
|
hidden_from_leaderboards: false,
|
||||||
|
Unbanned: true,
|
||||||
|
UnbanReduct: statsReduction,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
await context.env.D1.prepare(
|
await context.env.D1.prepare(
|
||||||
"INSERT INTO game_mod_logs (action, evidence, executed_at, executor, id, target) VALUES (?, ?, ?, ?, ?, ?);",
|
"INSERT INTO game_mod_logs (action, evidence, executed_at, executor, id, target) VALUES (?, ?, ?, ?, ?, ?);",
|
||||||
)
|
)
|
||||||
.bind(
|
.bind(
|
||||||
"accept_appeal",
|
`accept appeal | ${banList[appeal.roblox_id]?.BanType === 2 ? "ban" : appeal.type}`,
|
||||||
`https://carcrushers.cc/mod-queue?id=${context.params.id}&type=gma`,
|
`https://carcrushers.cc/mod-queue?id=${context.params.id}&type=gma`,
|
||||||
Date.now(),
|
Date.now(),
|
||||||
context.data.current_user.id,
|
context.data.current_user.id,
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ import precheck from "./precheck.js";
|
|||||||
|
|
||||||
export async function onRequestPost(context: RequestContext) {
|
export async function onRequestPost(context: RequestContext) {
|
||||||
if (
|
if (
|
||||||
context.request.headers.get("rbx-auth") !==
|
context.request.headers.get("rbx-auth") !== context.env.ROBLOX_APPEALS_TOKEN
|
||||||
context.env.ROBLOX_APPEALS_TOKEN
|
|
||||||
)
|
)
|
||||||
return jsonError("Unauthorized", 401);
|
return jsonError("Unauthorized", 401);
|
||||||
|
|
||||||
@@ -16,7 +15,7 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
|
|
||||||
if (precheckData.error) return jsonError(precheckData.error, 500);
|
if (precheckData.error) return jsonError(precheckData.error, 500);
|
||||||
|
|
||||||
const { can_appeal, reason } = precheckData;
|
const { can_appeal, reason, types } = precheckData;
|
||||||
|
|
||||||
return jsonResponse(JSON.stringify({ can_appeal, reason }));
|
return jsonResponse(JSON.stringify({ can_appeal, reason, types }));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,16 @@ import { getBanList } from "../../roblox-open-cloud.js";
|
|||||||
export default async function (
|
export default async function (
|
||||||
context: RequestContext,
|
context: RequestContext,
|
||||||
user: number,
|
user: number,
|
||||||
): Promise<{ can_appeal?: boolean; error?: string; reason?: string }> {
|
): Promise<{
|
||||||
|
can_appeal?: boolean;
|
||||||
|
error?: string;
|
||||||
|
reason?: string;
|
||||||
|
types?: string[];
|
||||||
|
}> {
|
||||||
if (
|
if (
|
||||||
await context.env.D1.prepare("SELECT * FROM game_appeals WHERE roblox_id = ?;")
|
await context.env.D1.prepare(
|
||||||
|
"SELECT * FROM game_appeals WHERE roblox_id = ?;",
|
||||||
|
)
|
||||||
.bind(user)
|
.bind(user)
|
||||||
.first()
|
.first()
|
||||||
)
|
)
|
||||||
@@ -18,7 +25,11 @@ export default async function (
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
banList = (await getBanList(context)) as {
|
banList = (await getBanList(context)) as {
|
||||||
[k: number]: { BanType: number };
|
[k: number]: {
|
||||||
|
BanType: number;
|
||||||
|
hidden_from_leaderboards?: boolean;
|
||||||
|
serverconfigurator_blacklist?: boolean;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} catch {
|
} catch {
|
||||||
return {
|
return {
|
||||||
@@ -42,24 +53,20 @@ export default async function (
|
|||||||
).toLocaleString()} to submit another appeal`,
|
).toLocaleString()} to submit another appeal`,
|
||||||
};
|
};
|
||||||
|
|
||||||
let userLogs;
|
const userLogs = await context.env.D1.prepare(
|
||||||
|
"SELECT executed_at FROM game_mod_logs WHERE target = ? ORDER BY executed_at DESC;",
|
||||||
|
)
|
||||||
|
.bind(user)
|
||||||
|
.all();
|
||||||
|
|
||||||
try {
|
if (userLogs.error)
|
||||||
userLogs = await context.env.D1.prepare(
|
|
||||||
"SELECT executed_at FROM game_mod_logs WHERE target = ? ORDER BY executed_at DESC;",
|
|
||||||
)
|
|
||||||
.bind(user)
|
|
||||||
.all();
|
|
||||||
|
|
||||||
if (userLogs.error) throw new Error("Query failed");
|
|
||||||
} catch {
|
|
||||||
return {
|
return {
|
||||||
error: "Could not determine your eligibility",
|
error: "Could not determine your eligibility",
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
// Legacy bans
|
// Legacy bans
|
||||||
if (!userLogs.results.length) return { can_appeal: true, reason: "" };
|
if (!userLogs.results.length)
|
||||||
|
return { can_appeal: true, reason: "", types: ["ban"] };
|
||||||
|
|
||||||
const allowedTime = (userLogs.results[0].executed_at as number) + 2592000000;
|
const allowedTime = (userLogs.results[0].executed_at as number) + 2592000000;
|
||||||
|
|
||||||
@@ -71,5 +78,12 @@ export default async function (
|
|||||||
).toLocaleString()} to submit an appeal`,
|
).toLocaleString()} to submit an appeal`,
|
||||||
};
|
};
|
||||||
|
|
||||||
return { can_appeal: true, reason: "" };
|
const types: string[] = [];
|
||||||
|
|
||||||
|
if (banList[user].BanType) types.push("ban");
|
||||||
|
if (banList[user].hidden_from_leaderboards) types.push("leaderboard");
|
||||||
|
if (banList[user].serverconfigurator_blacklist)
|
||||||
|
types.push("server_configurator");
|
||||||
|
|
||||||
|
return { can_appeal: true, reason: "", types };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,13 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
if (authHeader !== context.env.ROBLOX_APPEALS_TOKEN)
|
if (authHeader !== context.env.ROBLOX_APPEALS_TOKEN)
|
||||||
return jsonError("Unauthorized", 401);
|
return jsonError("Unauthorized", 401);
|
||||||
|
|
||||||
const { id, reasonForUnban, username, whatHappened } = context.data.body;
|
const { id, reasonForUnban, type, username, whatHappened } =
|
||||||
|
context.data.body;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
typeof id !== "number" ||
|
typeof id !== "number" ||
|
||||||
typeof reasonForUnban !== "string" ||
|
typeof reasonForUnban !== "string" ||
|
||||||
|
!["ban", "leaderboard", "server_configurator"].includes(type) ||
|
||||||
typeof username !== "string" ||
|
typeof username !== "string" ||
|
||||||
typeof whatHappened !== "string"
|
typeof whatHappened !== "string"
|
||||||
)
|
)
|
||||||
@@ -48,9 +50,17 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
}${Date.now()}`;
|
}${Date.now()}`;
|
||||||
|
|
||||||
await context.env.D1.prepare(
|
await context.env.D1.prepare(
|
||||||
"INSERT INTO game_appeals (created_at, id, reason_for_unban, roblox_id, roblox_username, what_happened) VALUES (?, ?, ?, ?, ?, ?);",
|
"INSERT INTO game_appeals (created_at, id, reason_for_unban, roblox_id, roblox_username, type, what_happened) VALUES (?, ?, ?, ?, ?, ?, ?);",
|
||||||
)
|
)
|
||||||
.bind(Date.now(), appealId, reasonForUnban, id, username, whatHappened)
|
.bind(
|
||||||
|
Date.now(),
|
||||||
|
appealId,
|
||||||
|
reasonForUnban,
|
||||||
|
id,
|
||||||
|
username,
|
||||||
|
type,
|
||||||
|
whatHappened,
|
||||||
|
)
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
await fetch(context.env.REPORTS_WEBHOOK, {
|
await fetch(context.env.REPORTS_WEBHOOK, {
|
||||||
|
|||||||
@@ -34,7 +34,11 @@ export async function onRequestGet(context: RequestContext) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
banList = (await getBanList(context)) as {
|
banList = (await getBanList(context)) as {
|
||||||
[k: number]: { BanType: number };
|
[k: number]: {
|
||||||
|
BanType: number;
|
||||||
|
hidden_from_leaderboards?: boolean;
|
||||||
|
serverconfigurator_blacklist?: boolean;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
@@ -47,8 +51,17 @@ export async function onRequestGet(context: RequestContext) {
|
|||||||
const banData = banList[users[0].id];
|
const banData = banList[users[0].id];
|
||||||
|
|
||||||
if (!banData?.BanType) current_status = "Not Moderated";
|
if (!banData?.BanType) current_status = "Not Moderated";
|
||||||
else if (banData.BanType === 1) current_status = "Hidden from Leaderboards";
|
else if (banData.BanType === 1) {
|
||||||
else if (banData.BanType === 2) current_status = "Banned";
|
if (
|
||||||
|
banData.hidden_from_leaderboards &&
|
||||||
|
banData.serverconfigurator_blacklist
|
||||||
|
)
|
||||||
|
current_status = "Hidden / Server Config Blocked";
|
||||||
|
else if (banData.hidden_from_leaderboards)
|
||||||
|
current_status = "Hidden From Leaderboards";
|
||||||
|
else if (banData.serverconfigurator_blacklist)
|
||||||
|
current_status = "Server Config Blocked";
|
||||||
|
} else if (banData.BanType === 2) current_status = "Banned";
|
||||||
|
|
||||||
const response = {
|
const response = {
|
||||||
history: (
|
history: (
|
||||||
|
|||||||
3
index.d.ts
vendored
3
index.d.ts
vendored
@@ -15,7 +15,7 @@ declare global {
|
|||||||
event_id: string;
|
event_id: string;
|
||||||
event_type: string;
|
event_type: string;
|
||||||
token: string;
|
token: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
type RequestContext = EventContext<Env, string, { [k: string]: any }>;
|
type RequestContext = EventContext<Env, string, { [k: string]: any }>;
|
||||||
|
|
||||||
@@ -39,6 +39,7 @@ declare global {
|
|||||||
reason_for_unban: string;
|
reason_for_unban: string;
|
||||||
roblox_id: number;
|
roblox_id: number;
|
||||||
roblox_username: string;
|
roblox_username: string;
|
||||||
|
type: string;
|
||||||
what_happened: string;
|
what_happened: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user