forked from administration/panel
chore: add temporary workaround for lack of JWTs
parent
7144d889e8
commit
095ea105db
|
@ -1,6 +1,7 @@
|
||||||
import { getServerSession } from "next-auth";
|
import { getServerSession } from "next-auth";
|
||||||
|
|
||||||
type Permission =
|
type Permission =
|
||||||
|
| "TEMP"
|
||||||
| "authifier"
|
| "authifier"
|
||||||
| `accounts${
|
| `accounts${
|
||||||
| ""
|
| ""
|
||||||
|
|
|
@ -151,7 +151,7 @@ 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";
|
await checkPermission("TEMP");
|
||||||
|
|
||||||
return await mongo()
|
return await mongo()
|
||||||
.db("revolt")
|
.db("revolt")
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { createClient } from "redis";
|
||||||
import { Channel, Message } from "revolt-api";
|
import { Channel, Message } from "revolt-api";
|
||||||
import type { ProtocolV1 } from "revolt.js/lib/events/v1";
|
import type { ProtocolV1 } from "revolt.js/lib/events/v1";
|
||||||
import mongo from "./db";
|
import mongo from "./db";
|
||||||
|
import { checkPermission } from "./accessPermissions";
|
||||||
|
|
||||||
let client: ReturnType<typeof createClient>;
|
let client: ReturnType<typeof createClient>;
|
||||||
|
|
||||||
|
@ -25,13 +26,12 @@ export async function publishMessage(
|
||||||
topic: string,
|
topic: string,
|
||||||
message: ProtocolV1["server"]
|
message: ProtocolV1["server"]
|
||||||
) {
|
) {
|
||||||
if (Math.random() > -1) throw "TODO: ACL";
|
await checkPermission("TEMP");
|
||||||
|
|
||||||
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";
|
await checkPermission("TEMP");
|
||||||
|
|
||||||
if (!ephermal) {
|
if (!ephermal) {
|
||||||
await mongo()
|
await mongo()
|
||||||
|
|
Loading…
Reference in New Issue