Add map community reactions, comments, and moderation
Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 3m22s
Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 3m22s
This commit is contained in:
18
lib/api.ts
18
lib/api.ts
@@ -22,6 +22,8 @@ import { requestOrigin, verifyOrigin } from "./request-origin";
|
||||
import { browserAccount } from "./request-security";
|
||||
import { jsonBody } from "./json-body";
|
||||
import { accountApi } from "./account-api";
|
||||
import { accountProfile } from "./profile";
|
||||
import { communityApi } from "./community-api";
|
||||
import { multiplayerApi } from "./multiplayer-api";
|
||||
import { bugReportApi } from "./bug-report-api";
|
||||
import { moderatorUsersApi } from "./moderator-users-api";
|
||||
@@ -137,6 +139,22 @@ export async function handle(request: NextRequest, path: string[]) {
|
||||
return await accountApi(request, path, { jsonBody, limit });
|
||||
// Check signed-in identities before any guest-cookie fallback (games/rooms).
|
||||
if (path[0] !== "health") await user();
|
||||
if (
|
||||
path[0] === "maps" ||
|
||||
path[0] === "community" ||
|
||||
(path[0] === "moderation" && path[1] === "community-reports")
|
||||
)
|
||||
return await communityApi(request, path, {
|
||||
db: admin(),
|
||||
getUser: user,
|
||||
jsonBody,
|
||||
limit,
|
||||
getProfile: async () => {
|
||||
const account = await user();
|
||||
if (!account) throw new ServiceError("Sign in to continue", 401);
|
||||
return accountProfile(account);
|
||||
},
|
||||
});
|
||||
if (path[0] === "rooms")
|
||||
return await multiplayerApi(request, path, { jsonBody, limit });
|
||||
if (path[0] === "bug-reports")
|
||||
|
||||
Reference in New Issue
Block a user