forked from administration/panel
parent
5b6decf034
commit
72b7e39937
|
@ -0,0 +1,6 @@
|
||||||
|
import { authOptions } from "@/lib/auth";
|
||||||
|
import NextAuth from "next-auth";
|
||||||
|
|
||||||
|
const handler = NextAuth(authOptions);
|
||||||
|
|
||||||
|
export { handler as GET, handler as POST };
|
|
@ -2,6 +2,7 @@ import { Toaster } from "@/components/ui/toaster";
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import { Inter } from "next/font/google";
|
import { Inter } from "next/font/google";
|
||||||
|
import { Provider } from "@/lib/Provider";
|
||||||
|
|
||||||
const inter = Inter({ subsets: ["latin"] });
|
const inter = Inter({ subsets: ["latin"] });
|
||||||
|
|
||||||
|
@ -16,11 +17,13 @@ export default function RootLayout({
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
|
<Provider>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body className={inter.className}>
|
<body className={inter.className}>
|
||||||
{children}
|
{children}
|
||||||
<Toaster />
|
<Toaster />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
</Provider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
11
app/page.tsx
11
app/page.tsx
|
@ -1,6 +1,5 @@
|
||||||
import { Button } from "@/components/ui/button";
|
import { LoginButton } from "@/components/pages/home/LoginButton";
|
||||||
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" });
|
||||||
|
|
||||||
|
@ -10,13 +9,7 @@ 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>
|
||||||
<Link href={"/panel"}>
|
<LoginButton />
|
||||||
<Button variant="outline">login with revolt sso</Button>
|
|
||||||
</Link>
|
|
||||||
<img
|
|
||||||
src={`https://api.gifbox.me/file/posts/w7iUJfiyKA_zGkHN7Rr625WpaTHYgm4v.webp`}
|
|
||||||
height={320}
|
|
||||||
/>
|
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { JsonCard } from "@/components/cards/JsonCard";
|
||||||
import { UserCard } from "@/components/cards/UserCard";
|
import { UserCard } from "@/components/cards/UserCard";
|
||||||
import { EmailClassificationCard } from "@/components/cards/authifier/EmailClassificationCard";
|
import { EmailClassificationCard } from "@/components/cards/authifier/EmailClassificationCard";
|
||||||
import { NavigationToolbar } from "@/components/common/NavigationToolbar";
|
import { NavigationToolbar } from "@/components/common/NavigationToolbar";
|
||||||
import { AccountActions } from "@/components/inspector/AccountActions";
|
import { AccountActions } from "@/components/pages/inspector/AccountActions";
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { JsonCard } from "@/components/cards/JsonCard";
|
||||||
import { ServerCard } from "@/components/cards/ServerCard";
|
import { ServerCard } from "@/components/cards/ServerCard";
|
||||||
import { UserCard } from "@/components/cards/UserCard";
|
import { UserCard } from "@/components/cards/UserCard";
|
||||||
import { NavigationToolbar } from "@/components/common/NavigationToolbar";
|
import { NavigationToolbar } from "@/components/common/NavigationToolbar";
|
||||||
import { RecentMessages } from "@/components/inspector/RecentMessages";
|
import { RecentMessages } from "@/components/pages/inspector/RecentMessages";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import { fetchChannelById, fetchServerById, fetchUsersById } from "@/lib/db";
|
import { fetchChannelById, fetchServerById, fetchUsersById } from "@/lib/db";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
|
@ -2,8 +2,8 @@ import { JsonCard } from "@/components/cards/JsonCard";
|
||||||
import { ServerCard } from "@/components/cards/ServerCard";
|
import { ServerCard } from "@/components/cards/ServerCard";
|
||||||
import { UserCard } from "@/components/cards/UserCard";
|
import { UserCard } from "@/components/cards/UserCard";
|
||||||
import { NavigationToolbar } from "@/components/common/NavigationToolbar";
|
import { NavigationToolbar } from "@/components/common/NavigationToolbar";
|
||||||
import { RecentMessages } from "@/components/inspector/RecentMessages";
|
import { RecentMessages } from "@/components/pages/inspector/RecentMessages";
|
||||||
import { ServerActions } from "@/components/inspector/ServerActions";
|
import { ServerActions } from "@/components/pages/inspector/ServerActions";
|
||||||
import { Card, CardHeader } from "@/components/ui/card";
|
import { Card, CardHeader } from "@/components/ui/card";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import { fetchServerById, fetchUserById } from "@/lib/db";
|
import { fetchServerById, fetchUserById } from "@/lib/db";
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { JsonCard } from "@/components/cards/JsonCard";
|
import { JsonCard } from "@/components/cards/JsonCard";
|
||||||
import { UserCard } from "@/components/cards/UserCard";
|
import { UserCard } from "@/components/cards/UserCard";
|
||||||
import { NavigationToolbar } from "@/components/common/NavigationToolbar";
|
import { NavigationToolbar } from "@/components/common/NavigationToolbar";
|
||||||
import { RecentMessages } from "@/components/inspector/RecentMessages";
|
import { RecentMessages } from "@/components/pages/inspector/RecentMessages";
|
||||||
import { RelevantModerationNotices } from "@/components/inspector/RelevantModerationNotices";
|
import { RelevantModerationNotices } from "@/components/pages/inspector/RelevantModerationNotices";
|
||||||
import { RelevantObjects } from "@/components/inspector/RelevantObjects";
|
import { RelevantObjects } from "@/components/pages/inspector/RelevantObjects";
|
||||||
import { RelevantReports } from "@/components/inspector/RelevantReports";
|
import { RelevantReports } from "@/components/pages/inspector/RelevantReports";
|
||||||
import { UserActions } from "@/components/inspector/UserActions";
|
import { UserActions } from "@/components/pages/inspector/UserActions";
|
||||||
import { Card, CardHeader } from "@/components/ui/card";
|
import { Card, CardHeader } from "@/components/ui/card";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import { PLATFORM_MOD_ID } from "@/lib/constants";
|
import { PLATFORM_MOD_ID } from "@/lib/constants";
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { ServerCard } from "@/components/cards/ServerCard";
|
||||||
import { UserCard } from "@/components/cards/UserCard";
|
import { UserCard } from "@/components/cards/UserCard";
|
||||||
import { CardLink } from "@/components/common/CardLink";
|
import { CardLink } from "@/components/common/CardLink";
|
||||||
import { NavigationToolbar } from "@/components/common/NavigationToolbar";
|
import { NavigationToolbar } from "@/components/common/NavigationToolbar";
|
||||||
import { ReportActions } from "@/components/inspector/ReportActions";
|
import { ReportActions } from "@/components/pages/inspector/ReportActions";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import {
|
import {
|
||||||
fetchReportById,
|
fetchReportById,
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { useSession } from "next-auth/react";
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
|
export function LoginButton() {
|
||||||
|
const { data: session } = useSession();
|
||||||
|
|
||||||
|
if (session || true) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Link href={"/panel"}>
|
||||||
|
<Button variant="outline">continue</Button>
|
||||||
|
</Link>
|
||||||
|
<img
|
||||||
|
src={`https://api.gifbox.me/file/posts/QF8HezSH-AtTM9hT4pKISu-foBzdRC4e.webp`}
|
||||||
|
height={320}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Link href={"/panel"}>
|
||||||
|
<Button variant="outline">login with revolt sso</Button>
|
||||||
|
</Link>
|
||||||
|
<img
|
||||||
|
src={`https://api.gifbox.me/file/posts/w7iUJfiyKA_zGkHN7Rr625WpaTHYgm4v.webp`}
|
||||||
|
height={320}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Button } from "../ui/button";
|
import { Button } from "../../ui/button";
|
||||||
import { useToast } from "../ui/use-toast";
|
import { useToast } from "../../ui/use-toast";
|
||||||
import type { Account } from "@/lib/db";
|
import type { Account } from "@/lib/db";
|
||||||
import { User } from "revolt-api";
|
import { User } from "revolt-api";
|
||||||
import {
|
import {
|
||||||
|
@ -23,7 +23,7 @@ import {
|
||||||
AlertDialogHeader,
|
AlertDialogHeader,
|
||||||
AlertDialogTitle,
|
AlertDialogTitle,
|
||||||
AlertDialogTrigger,
|
AlertDialogTrigger,
|
||||||
} from "../ui/alert-dialog";
|
} from "../../ui/alert-dialog";
|
||||||
dayjs.extend(relativeTime);
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
export function AccountActions({
|
export function AccountActions({
|
|
@ -6,9 +6,9 @@ import {
|
||||||
CardDescription,
|
CardDescription,
|
||||||
CardHeader,
|
CardHeader,
|
||||||
CardTitle,
|
CardTitle,
|
||||||
} from "../ui/card";
|
} from "../../ui/card";
|
||||||
import { fetchMessages, fetchUsersById } from "@/lib/db";
|
import { fetchMessages, fetchUsersById } from "@/lib/db";
|
||||||
import { CompactMessage } from "../cards/CompactMessage";
|
import { CompactMessage } from "../../cards/CompactMessage";
|
||||||
|
|
||||||
export async function RecentMessages({
|
export async function RecentMessages({
|
||||||
query,
|
query,
|
|
@ -1,10 +1,10 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { AccountStrike, Message } from "revolt-api";
|
import { AccountStrike, Message } from "revolt-api";
|
||||||
import { ListCompactor } from "../common/ListCompactor";
|
import { ListCompactor } from "../../common/ListCompactor";
|
||||||
import { CompactMessage } from "../cards/CompactMessage";
|
import { CompactMessage } from "../../cards/CompactMessage";
|
||||||
import { useRef, useState } from "react";
|
import { useRef, useState } from "react";
|
||||||
import { Button } from "../ui/button";
|
import { Button } from "../../ui/button";
|
||||||
import {
|
import {
|
||||||
AlertDialog,
|
AlertDialog,
|
||||||
AlertDialogAction,
|
AlertDialogAction,
|
||||||
|
@ -14,10 +14,10 @@ import {
|
||||||
AlertDialogHeader,
|
AlertDialogHeader,
|
||||||
AlertDialogTitle,
|
AlertDialogTitle,
|
||||||
AlertDialogTrigger,
|
AlertDialogTrigger,
|
||||||
} from "../ui/alert-dialog";
|
} from "../../ui/alert-dialog";
|
||||||
import { Input } from "../ui/input";
|
import { Input } from "../../ui/input";
|
||||||
import { createStrike } from "@/lib/actions";
|
import { createStrike } from "@/lib/actions";
|
||||||
import { useToast } from "../ui/use-toast";
|
import { useToast } from "../../ui/use-toast";
|
||||||
import {
|
import {
|
||||||
Table,
|
Table,
|
||||||
TableBody,
|
TableBody,
|
||||||
|
@ -25,7 +25,7 @@ import {
|
||||||
TableHead,
|
TableHead,
|
||||||
TableHeader,
|
TableHeader,
|
||||||
TableRow,
|
TableRow,
|
||||||
} from "../ui/table";
|
} from "../../ui/table";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { decodeTime } from "ulid";
|
import { decodeTime } from "ulid";
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Server, User } from "revolt-api";
|
import { Server, User } from "revolt-api";
|
||||||
import { ListCompactor } from "../common/ListCompactor";
|
import { ListCompactor } from "../../common/ListCompactor";
|
||||||
import { UserCard } from "../cards/UserCard";
|
import { UserCard } from "../../cards/UserCard";
|
||||||
import { ServerCard } from "../cards/ServerCard";
|
import { ServerCard } from "../../cards/ServerCard";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
||||||
export function RelevantObjects({
|
export function RelevantObjects({
|
|
@ -1,9 +1,9 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Report } from "revolt-api";
|
import { Report } from "revolt-api";
|
||||||
import { ListCompactor } from "../common/ListCompactor";
|
import { ListCompactor } from "../../common/ListCompactor";
|
||||||
import { ReportCard } from "../cards/ReportCard";
|
import { ReportCard } from "../../cards/ReportCard";
|
||||||
import { CardLink } from "../common/CardLink";
|
import { CardLink } from "../../common/CardLink";
|
||||||
|
|
||||||
export function RelevantReports({
|
export function RelevantReports({
|
||||||
byUser,
|
byUser,
|
|
@ -1,8 +1,8 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Report } from "revolt-api";
|
import { Report } from "revolt-api";
|
||||||
import { Textarea } from "../ui/textarea";
|
import { Textarea } from "../../ui/textarea";
|
||||||
import { Button } from "../ui/button";
|
import { Button } from "../../ui/button";
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
|
@ -10,9 +10,9 @@ import {
|
||||||
DropdownMenuLabel,
|
DropdownMenuLabel,
|
||||||
DropdownMenuSeparator,
|
DropdownMenuSeparator,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from "../ui/dropdown-menu";
|
} from "../../ui/dropdown-menu";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useToast } from "../ui/use-toast";
|
import { useToast } from "../../ui/use-toast";
|
||||||
import {
|
import {
|
||||||
rejectReport,
|
rejectReport,
|
||||||
reopenReport,
|
reopenReport,
|
||||||
|
@ -30,8 +30,8 @@ import {
|
||||||
AlertDialogHeader,
|
AlertDialogHeader,
|
||||||
AlertDialogTitle,
|
AlertDialogTitle,
|
||||||
AlertDialogTrigger,
|
AlertDialogTrigger,
|
||||||
} from "../ui/alert-dialog";
|
} from "../../ui/alert-dialog";
|
||||||
import { ReportCard } from "../cards/ReportCard";
|
import { ReportCard } from "../../cards/ReportCard";
|
||||||
|
|
||||||
const template: Record<string, (ref: string) => string> = {
|
const template: Record<string, (ref: string) => string> = {
|
||||||
resolved: (ref) =>
|
resolved: (ref) =>
|
|
@ -1,7 +1,7 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Server } from "revolt-api";
|
import { Server } from "revolt-api";
|
||||||
import { Button } from "../ui/button";
|
import { Button } from "../../ui/button";
|
||||||
import {
|
import {
|
||||||
Command,
|
Command,
|
||||||
CommandEmpty,
|
CommandEmpty,
|
||||||
|
@ -18,7 +18,7 @@ import { Check, ChevronsUpDown } from "lucide-react";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { updateServerDiscoverability, updateServerFlags } from "@/lib/actions";
|
import { updateServerDiscoverability, updateServerFlags } from "@/lib/actions";
|
||||||
import { useToast } from "../ui/use-toast";
|
import { useToast } from "../../ui/use-toast";
|
||||||
|
|
||||||
export function ServerActions({ server }: { server: Server }) {
|
export function ServerActions({ server }: { server: Server }) {
|
||||||
const [selectBadges, setSelectBadges] = useState(false);
|
const [selectBadges, setSelectBadges] = useState(false);
|
|
@ -1,13 +1,13 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { Button, buttonVariants } from "../ui/button";
|
import { Button, buttonVariants } from "../../ui/button";
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from "../ui/dropdown-menu";
|
} from "../../ui/dropdown-menu";
|
||||||
import {
|
import {
|
||||||
AlertDialog,
|
AlertDialog,
|
||||||
AlertDialogAction,
|
AlertDialogAction,
|
||||||
|
@ -18,8 +18,8 @@ import {
|
||||||
AlertDialogHeader,
|
AlertDialogHeader,
|
||||||
AlertDialogTitle,
|
AlertDialogTitle,
|
||||||
AlertDialogTrigger,
|
AlertDialogTrigger,
|
||||||
} from "../ui/alert-dialog";
|
} from "../../ui/alert-dialog";
|
||||||
import { Input } from "../ui/input";
|
import { Input } from "../../ui/input";
|
||||||
import {
|
import {
|
||||||
banUser,
|
banUser,
|
||||||
closeReportsByUser,
|
closeReportsByUser,
|
||||||
|
@ -30,9 +30,9 @@ import {
|
||||||
updateUserBadges,
|
updateUserBadges,
|
||||||
} from "@/lib/actions";
|
} from "@/lib/actions";
|
||||||
import { useRef, useState } from "react";
|
import { useRef, useState } from "react";
|
||||||
import { useToast } from "../ui/use-toast";
|
import { useToast } from "../../ui/use-toast";
|
||||||
import { Bot, User } from "revolt-api";
|
import { Bot, User } from "revolt-api";
|
||||||
import { Card, CardHeader } from "../ui/card";
|
import { Card, CardHeader } from "../../ui/card";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { decodeTime } from "ulid";
|
import { decodeTime } from "ulid";
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
import type { AuthOptions } from "next-auth";
|
||||||
|
import AuthentikProvider from "next-auth/providers/authentik";
|
||||||
|
|
||||||
|
export const authOptions: AuthOptions = {
|
||||||
|
providers: [
|
||||||
|
AuthentikProvider({
|
||||||
|
clientId: process.env.AUTHENTIK_ID!,
|
||||||
|
clientSecret: process.env.AUTHENTIK_SECRET!,
|
||||||
|
issuer:
|
||||||
|
process.env.AUTHENTIK_ISSUER ??
|
||||||
|
"https://sso.revolt.chat/application/o/admin-panel",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
};
|
Loading…
Reference in New Issue