forked from administration/panel
chore: block all actions
parent
b1670419b1
commit
5b6decf034
|
@ -1,5 +1,6 @@
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Comic_Neue } from "next/font/google";
|
import { Comic_Neue } from "next/font/google";
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
const comicNeue = Comic_Neue({ subsets: ["latin"], weight: "700" });
|
const comicNeue = Comic_Neue({ subsets: ["latin"], weight: "700" });
|
||||||
|
|
||||||
|
@ -9,7 +10,9 @@ export default function Home() {
|
||||||
className={`${comicNeue.className} flex flex-col justify-center items-center gap-4 h-[100vh]`}
|
className={`${comicNeue.className} flex flex-col justify-center items-center gap-4 h-[100vh]`}
|
||||||
>
|
>
|
||||||
<h1 className="text-5xl">revolt admin panel</h1>
|
<h1 className="text-5xl">revolt admin panel</h1>
|
||||||
<Button variant="outline">login with revolt sso</Button>
|
<Link href={"/panel"}>
|
||||||
|
<Button variant="outline">login with revolt sso</Button>
|
||||||
|
</Link>
|
||||||
<img
|
<img
|
||||||
src={`https://api.gifbox.me/file/posts/w7iUJfiyKA_zGkHN7Rr625WpaTHYgm4v.webp`}
|
src={`https://api.gifbox.me/file/posts/w7iUJfiyKA_zGkHN7Rr625WpaTHYgm4v.webp`}
|
||||||
height={320}
|
height={320}
|
||||||
|
|
|
@ -20,30 +20,30 @@ export function NavigationLinks() {
|
||||||
>
|
>
|
||||||
<Home className="h-4 w-4" />
|
<Home className="h-4 w-4" />
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
{/*<Link
|
||||||
className={buttonVariants({ variant: "outline", size: "icon" })}
|
className={buttonVariants({ variant: "outline", size: "icon" })}
|
||||||
href="/panel/search"
|
href="/panel/search"
|
||||||
>
|
>
|
||||||
<Search className="h-4 w-4" />
|
<Search className="h-4 w-4" />
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
<Link
|
||||||
className={buttonVariants({ variant: "outline", size: "icon" })}
|
className={buttonVariants({ variant: "outline", size: "icon" })}
|
||||||
href="/panel/inspect"
|
href="/panel/inspect"
|
||||||
>
|
>
|
||||||
<Eye className="h-4 w-4" />
|
<Eye className="h-4 w-4" />
|
||||||
</Link>
|
</Link>*/}
|
||||||
<Link
|
<Link
|
||||||
className={buttonVariants({ variant: "outline", size: "icon" })}
|
className={buttonVariants({ variant: "outline", size: "icon" })}
|
||||||
href="/panel/reports"
|
href="/panel/reports"
|
||||||
>
|
>
|
||||||
<Siren className="h-4 w-4" />
|
<Siren className="h-4 w-4" />
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
{/*<Link
|
||||||
className={buttonVariants({ variant: "outline", size: "icon" })}
|
className={buttonVariants({ variant: "outline", size: "icon" })}
|
||||||
href="/panel/discover"
|
href="/panel/discover"
|
||||||
>
|
>
|
||||||
<Globe2 className="h-4 w-4" />
|
<Globe2 className="h-4 w-4" />
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
<Link
|
||||||
className={buttonVariants({ variant: "outline", size: "icon" })}
|
className={buttonVariants({ variant: "outline", size: "icon" })}
|
||||||
href="/panel/audit"
|
href="/panel/audit"
|
||||||
|
@ -56,7 +56,7 @@ export function NavigationLinks() {
|
||||||
// href="https://monitor.revolt.chat/d/fb0383b2-86c8-4c9c-b401-0af8ce9869af/global-stats?orgId=1"
|
// href="https://monitor.revolt.chat/d/fb0383b2-86c8-4c9c-b401-0af8ce9869af/global-stats?orgId=1"
|
||||||
>
|
>
|
||||||
<TrendingUp className="h-4 w-4" />
|
<TrendingUp className="h-4 w-4" />
|
||||||
</Link>
|
</Link>*/}
|
||||||
<Link
|
<Link
|
||||||
className={buttonVariants({ variant: "outline", size: "icon" })}
|
className={buttonVariants({ variant: "outline", size: "icon" })}
|
||||||
href="/panel/sparkle"
|
href="/panel/sparkle"
|
||||||
|
|
|
@ -28,6 +28,8 @@ import {
|
||||||
} from "revolt-api";
|
} from "revolt-api";
|
||||||
|
|
||||||
export async function sendAlert(userId: string, content: string) {
|
export async function sendAlert(userId: string, content: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
const messageId = ulid();
|
const messageId = ulid();
|
||||||
|
|
||||||
let dm = await findDM(PLATFORM_MOD_ID, userId);
|
let dm = await findDM(PLATFORM_MOD_ID, userId);
|
||||||
|
@ -47,6 +49,8 @@ export async function createStrike(
|
||||||
givenReason: string,
|
givenReason: string,
|
||||||
additionalContext: string
|
additionalContext: string
|
||||||
) {
|
) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
const strike: AccountStrike & { moderator_id: string } = {
|
const strike: AccountStrike & { moderator_id: string } = {
|
||||||
_id: ulid(),
|
_id: ulid(),
|
||||||
user_id: userId,
|
user_id: userId,
|
||||||
|
@ -72,6 +76,8 @@ Further violations will result in suspension or a permanent ban depending on sev
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateReportNotes(reportId: string, notes: string) {
|
export async function updateReportNotes(reportId: string, notes: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Report>("safety_reports")
|
.collection<Report>("safety_reports")
|
||||||
|
@ -86,6 +92,8 @@ export async function updateReportNotes(reportId: string, notes: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function resolveReport(reportId: string) {
|
export async function resolveReport(reportId: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
const $set = {
|
const $set = {
|
||||||
status: "Resolved",
|
status: "Resolved",
|
||||||
closed_at: new Date().toISOString(),
|
closed_at: new Date().toISOString(),
|
||||||
|
@ -102,6 +110,8 @@ export async function resolveReport(reportId: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function rejectReport(reportId: string, reason: string) {
|
export async function rejectReport(reportId: string, reason: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
const $set = {
|
const $set = {
|
||||||
status: "Rejected",
|
status: "Rejected",
|
||||||
rejection_reason: reason,
|
rejection_reason: reason,
|
||||||
|
@ -119,6 +129,8 @@ export async function rejectReport(reportId: string, reason: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function reopenReport(reportId: string) {
|
export async function reopenReport(reportId: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
const $set = {
|
const $set = {
|
||||||
status: "Created",
|
status: "Created",
|
||||||
} as Report;
|
} as Report;
|
||||||
|
@ -140,6 +152,8 @@ export async function reopenReport(reportId: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function closeReportsByUser(userId: string) {
|
export async function closeReportsByUser(userId: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Report>("safety_reports")
|
.collection<Report>("safety_reports")
|
||||||
|
@ -160,6 +174,8 @@ export async function closeReportsByUser(userId: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function disableAccount(userId: string) {
|
export async function disableAccount(userId: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
await mongo()
|
await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<AccountInfo>("accounts")
|
.collection<AccountInfo>("accounts")
|
||||||
|
@ -171,6 +187,8 @@ export async function disableAccount(userId: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function suspendUser(userId: string) {
|
export async function suspendUser(userId: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
await disableAccount(userId);
|
await disableAccount(userId);
|
||||||
|
|
||||||
await mongo()
|
await mongo()
|
||||||
|
@ -201,6 +219,8 @@ export async function suspendUser(userId: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateUserBadges(userId: string, badges: number) {
|
export async function updateUserBadges(userId: string, badges: number) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
await mongo().db("revolt").collection<User>("users").updateOne(
|
await mongo().db("revolt").collection<User>("users").updateOne(
|
||||||
{
|
{
|
||||||
_id: userId,
|
_id: userId,
|
||||||
|
@ -226,6 +246,8 @@ export async function updateUserBadges(userId: string, badges: number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function wipeUser(userId: string, flags = 4) {
|
export async function wipeUser(userId: string, flags = 4) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
// retrieve messages, dm channels, relationships, server memberships
|
// retrieve messages, dm channels, relationships, server memberships
|
||||||
const backup = {
|
const backup = {
|
||||||
_event: "wipe",
|
_event: "wipe",
|
||||||
|
@ -321,10 +343,14 @@ export async function wipeUser(userId: string, flags = 4) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function banUser(userId: string) {
|
export async function banUser(userId: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await wipeUser(userId, 4);
|
return await wipeUser(userId, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function unsuspendUser(userId: string) {
|
export async function unsuspendUser(userId: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
await restoreAccount(userId);
|
await restoreAccount(userId);
|
||||||
|
|
||||||
await mongo()
|
await mongo()
|
||||||
|
@ -343,6 +369,8 @@ export async function unsuspendUser(userId: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateServerFlags(serverId: string, flags: number) {
|
export async function updateServerFlags(serverId: string, flags: number) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
await mongo().db("revolt").collection<Server>("servers").updateOne(
|
await mongo().db("revolt").collection<Server>("servers").updateOne(
|
||||||
{
|
{
|
||||||
_id: serverId,
|
_id: serverId,
|
||||||
|
@ -368,6 +396,8 @@ export async function updateServerDiscoverability(
|
||||||
serverId: string,
|
serverId: string,
|
||||||
state: boolean
|
state: boolean
|
||||||
) {
|
) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
await mongo()
|
await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Server>("servers")
|
.collection<Server>("servers")
|
||||||
|
@ -385,6 +415,8 @@ export async function updateServerDiscoverability(
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateBotDiscoverability(botId: string, state: boolean) {
|
export async function updateBotDiscoverability(botId: string, state: boolean) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
await mongo()
|
await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Bot>("bots")
|
.collection<Bot>("bots")
|
||||||
|
@ -402,6 +434,8 @@ export async function updateBotDiscoverability(botId: string, state: boolean) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function restoreAccount(accountId: string) {
|
export async function restoreAccount(accountId: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
await mongo()
|
await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Account>("accounts")
|
.collection<Account>("accounts")
|
||||||
|
@ -418,6 +452,8 @@ export async function restoreAccount(accountId: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function queueAccountDeletion(accountId: string) {
|
export async function queueAccountDeletion(accountId: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
const twoWeeksFuture = new Date();
|
const twoWeeksFuture = new Date();
|
||||||
twoWeeksFuture.setDate(twoWeeksFuture.getDate() + 14);
|
twoWeeksFuture.setDate(twoWeeksFuture.getDate() + 14);
|
||||||
|
|
||||||
|
@ -443,6 +479,8 @@ export async function queueAccountDeletion(accountId: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function cancelAccountDeletion(accountId: string) {
|
export async function cancelAccountDeletion(accountId: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
await mongo()
|
await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Account>("accounts")
|
.collection<Account>("accounts")
|
||||||
|
|
44
lib/db.ts
44
lib/db.ts
|
@ -28,6 +28,8 @@ function mongo() {
|
||||||
export default mongo;
|
export default mongo;
|
||||||
|
|
||||||
export async function fetchBotById(id: string) {
|
export async function fetchBotById(id: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Bot>("bots")
|
.collection<Bot>("bots")
|
||||||
|
@ -76,6 +78,8 @@ export type Account = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function fetchAccountById(id: string) {
|
export async function fetchAccountById(id: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Account>("accounts")
|
.collection<Account>("accounts")
|
||||||
|
@ -91,6 +95,8 @@ export async function fetchAccountById(id: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchSessionsByAccount(accountId: string) {
|
export async function fetchSessionsByAccount(accountId: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<SessionInfo>("sessions")
|
.collection<SessionInfo>("sessions")
|
||||||
|
@ -109,6 +115,8 @@ export async function fetchSessionsByAccount(accountId: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchUserById(id: string) {
|
export async function fetchUserById(id: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<User>("users")
|
.collection<User>("users")
|
||||||
|
@ -116,6 +124,8 @@ export async function fetchUserById(id: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchUsersById(ids: string[]) {
|
export async function fetchUsersById(ids: string[]) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<User>("users")
|
.collection<User>("users")
|
||||||
|
@ -124,6 +134,8 @@ export async function fetchUsersById(ids: string[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchChannelById(id: string) {
|
export async function fetchChannelById(id: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Channel>("channels")
|
.collection<Channel>("channels")
|
||||||
|
@ -131,6 +143,8 @@ export async function fetchChannelById(id: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchChannels(query: Filter<Channel>) {
|
export async function fetchChannels(query: Filter<Channel>) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Channel>("channels")
|
.collection<Channel>("channels")
|
||||||
|
@ -142,6 +156,8 @@ export async function updateLastMessageId(
|
||||||
channelId: string,
|
channelId: string,
|
||||||
messageId: string
|
messageId: string
|
||||||
) {
|
) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Channel>("channels")
|
.collection<Channel>("channels")
|
||||||
|
@ -149,6 +165,8 @@ export async function updateLastMessageId(
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function findDM(user_a: string, user_b: string) {
|
export async function findDM(user_a: string, user_b: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Channel & { channel_type: "DirectMessage" }>("channels")
|
.collection<Channel & { channel_type: "DirectMessage" }>("channels")
|
||||||
|
@ -165,6 +183,8 @@ export async function createDM(
|
||||||
userB: string,
|
userB: string,
|
||||||
lastMessageId?: string
|
lastMessageId?: string
|
||||||
) {
|
) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
const newChannel: Channel & { channel_type: "DirectMessage" } = {
|
const newChannel: Channel & { channel_type: "DirectMessage" } = {
|
||||||
_id: ulid(),
|
_id: ulid(),
|
||||||
channel_type: "DirectMessage",
|
channel_type: "DirectMessage",
|
||||||
|
@ -191,6 +211,8 @@ export async function createDM(
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchServerById(id: string) {
|
export async function fetchServerById(id: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Server>("servers")
|
.collection<Server>("servers")
|
||||||
|
@ -198,6 +220,8 @@ export async function fetchServerById(id: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchServers(query: Filter<Server>) {
|
export async function fetchServers(query: Filter<Server>) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Server>("servers")
|
.collection<Server>("servers")
|
||||||
|
@ -206,6 +230,8 @@ export async function fetchServers(query: Filter<Server>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchMessageById(id: string) {
|
export async function fetchMessageById(id: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Message>("messages")
|
.collection<Message>("messages")
|
||||||
|
@ -213,6 +239,8 @@ export async function fetchMessageById(id: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchMessages(query: Filter<Message>, limit = 50) {
|
export async function fetchMessages(query: Filter<Message>, limit = 50) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Message>("messages")
|
.collection<Message>("messages")
|
||||||
|
@ -223,6 +251,8 @@ export async function fetchMessages(query: Filter<Message>, limit = 50) {
|
||||||
export async function fetchReports(
|
export async function fetchReports(
|
||||||
query: Filter<Report> = { status: "Created" }
|
query: Filter<Report> = { status: "Created" }
|
||||||
) {
|
) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Report>("safety_reports")
|
.collection<Report>("safety_reports")
|
||||||
|
@ -235,6 +265,8 @@ export async function fetchReports(
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchReportById(id: string) {
|
export async function fetchReportById(id: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Report>("safety_reports")
|
.collection<Report>("safety_reports")
|
||||||
|
@ -242,6 +274,8 @@ export async function fetchReportById(id: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchMembershipsByUser(userId: string) {
|
export async function fetchMembershipsByUser(userId: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<{ _id: { user: string; server: string } }>("server_members")
|
.collection<{ _id: { user: string; server: string } }>("server_members")
|
||||||
|
@ -252,6 +286,8 @@ export async function fetchMembershipsByUser(userId: string) {
|
||||||
export async function fetchSnapshots(
|
export async function fetchSnapshots(
|
||||||
query: Filter<{ _id: string; report_id: string; content: SnapshotContent }>
|
query: Filter<{ _id: string; report_id: string; content: SnapshotContent }>
|
||||||
) {
|
) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<{ _id: string; report_id: string; content: SnapshotContent }>(
|
.collection<{ _id: string; report_id: string; content: SnapshotContent }>(
|
||||||
|
@ -262,6 +298,8 @@ export async function fetchSnapshots(
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchSnapshotsByReport(reportId: string) {
|
export async function fetchSnapshotsByReport(reportId: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<{ content: SnapshotContent }>("safety_snapshots")
|
.collection<{ content: SnapshotContent }>("safety_snapshots")
|
||||||
|
@ -271,6 +309,8 @@ export async function fetchSnapshotsByReport(reportId: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchStrikesByUser(userId: string) {
|
export async function fetchStrikesByUser(userId: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<AccountStrike>("safety_strikes")
|
.collection<AccountStrike>("safety_strikes")
|
||||||
|
@ -286,6 +326,8 @@ export async function fetchStrikesByUser(userId: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchBotsByUser(userId: string) {
|
export async function fetchBotsByUser(userId: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
.collection<Bot>("bots")
|
.collection<Bot>("bots")
|
||||||
|
@ -299,6 +341,8 @@ export type EmailClassification = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function fetchAuthifierEmailClassification(provider: string) {
|
export async function fetchAuthifierEmailClassification(provider: string) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("authifier")
|
.db("authifier")
|
||||||
.collection<EmailClassification>("email_classification")
|
.collection<EmailClassification>("email_classification")
|
||||||
|
|
|
@ -25,10 +25,14 @@ export async function publishMessage(
|
||||||
topic: string,
|
topic: string,
|
||||||
message: ProtocolV1["server"]
|
message: ProtocolV1["server"]
|
||||||
) {
|
) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
return await (await redis()).publish(topic, JSON.stringify(message));
|
return await (await redis()).publish(topic, JSON.stringify(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function sendChatMessage(message: Message, ephermal = false) {
|
export async function sendChatMessage(message: Message, ephermal = false) {
|
||||||
|
if (Math.random() > -1) throw "TODO: ACL";
|
||||||
|
|
||||||
if (!ephermal) {
|
if (!ephermal) {
|
||||||
await mongo()
|
await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
|
|
Loading…
Reference in New Issue