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 type { Metadata } from "next";
|
||||
import { Inter } from "next/font/google";
|
||||
import { Provider } from "@/lib/Provider";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
|
@ -16,11 +17,13 @@ export default function RootLayout({
|
|||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={inter.className}>
|
||||
{children}
|
||||
<Toaster />
|
||||
</body>
|
||||
</html>
|
||||
<Provider>
|
||||
<html lang="en">
|
||||
<body className={inter.className}>
|
||||
{children}
|
||||
<Toaster />
|
||||
</body>
|
||||
</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 Link from "next/link";
|
||||
|
||||
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]`}
|
||||
>
|
||||
<h1 className="text-5xl">revolt admin panel</h1>
|
||||
<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}
|
||||
/>
|
||||
<LoginButton />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import { JsonCard } from "@/components/cards/JsonCard";
|
|||
import { UserCard } from "@/components/cards/UserCard";
|
||||
import { EmailClassificationCard } from "@/components/cards/authifier/EmailClassificationCard";
|
||||
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 { Separator } from "@/components/ui/separator";
|
||||
import {
|
||||
|
|
|
@ -3,7 +3,7 @@ import { JsonCard } from "@/components/cards/JsonCard";
|
|||
import { ServerCard } from "@/components/cards/ServerCard";
|
||||
import { UserCard } from "@/components/cards/UserCard";
|
||||
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 { fetchChannelById, fetchServerById, fetchUsersById } from "@/lib/db";
|
||||
import Link from "next/link";
|
||||
|
|
|
@ -2,8 +2,8 @@ import { JsonCard } from "@/components/cards/JsonCard";
|
|||
import { ServerCard } from "@/components/cards/ServerCard";
|
||||
import { UserCard } from "@/components/cards/UserCard";
|
||||
import { NavigationToolbar } from "@/components/common/NavigationToolbar";
|
||||
import { RecentMessages } from "@/components/inspector/RecentMessages";
|
||||
import { ServerActions } from "@/components/inspector/ServerActions";
|
||||
import { RecentMessages } from "@/components/pages/inspector/RecentMessages";
|
||||
import { ServerActions } from "@/components/pages/inspector/ServerActions";
|
||||
import { Card, CardHeader } from "@/components/ui/card";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { fetchServerById, fetchUserById } from "@/lib/db";
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { JsonCard } from "@/components/cards/JsonCard";
|
||||
import { UserCard } from "@/components/cards/UserCard";
|
||||
import { NavigationToolbar } from "@/components/common/NavigationToolbar";
|
||||
import { RecentMessages } from "@/components/inspector/RecentMessages";
|
||||
import { RelevantModerationNotices } from "@/components/inspector/RelevantModerationNotices";
|
||||
import { RelevantObjects } from "@/components/inspector/RelevantObjects";
|
||||
import { RelevantReports } from "@/components/inspector/RelevantReports";
|
||||
import { UserActions } from "@/components/inspector/UserActions";
|
||||
import { RecentMessages } from "@/components/pages/inspector/RecentMessages";
|
||||
import { RelevantModerationNotices } from "@/components/pages/inspector/RelevantModerationNotices";
|
||||
import { RelevantObjects } from "@/components/pages/inspector/RelevantObjects";
|
||||
import { RelevantReports } from "@/components/pages/inspector/RelevantReports";
|
||||
import { UserActions } from "@/components/pages/inspector/UserActions";
|
||||
import { Card, CardHeader } from "@/components/ui/card";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { PLATFORM_MOD_ID } from "@/lib/constants";
|
||||
|
|
|
@ -5,7 +5,7 @@ import { ServerCard } from "@/components/cards/ServerCard";
|
|||
import { UserCard } from "@/components/cards/UserCard";
|
||||
import { CardLink } from "@/components/common/CardLink";
|
||||
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 {
|
||||
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";
|
||||
|
||||
import { useState } from "react";
|
||||
import { Button } from "../ui/button";
|
||||
import { useToast } from "../ui/use-toast";
|
||||
import { Button } from "../../ui/button";
|
||||
import { useToast } from "../../ui/use-toast";
|
||||
import type { Account } from "@/lib/db";
|
||||
import { User } from "revolt-api";
|
||||
import {
|
||||
|
@ -23,7 +23,7 @@ import {
|
|||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogTrigger,
|
||||
} from "../ui/alert-dialog";
|
||||
} from "../../ui/alert-dialog";
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
export function AccountActions({
|
|
@ -6,9 +6,9 @@ import {
|
|||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "../ui/card";
|
||||
} from "../../ui/card";
|
||||
import { fetchMessages, fetchUsersById } from "@/lib/db";
|
||||
import { CompactMessage } from "../cards/CompactMessage";
|
||||
import { CompactMessage } from "../../cards/CompactMessage";
|
||||
|
||||
export async function RecentMessages({
|
||||
query,
|
|
@ -1,10 +1,10 @@
|
|||
"use client";
|
||||
|
||||
import { AccountStrike, Message } from "revolt-api";
|
||||
import { ListCompactor } from "../common/ListCompactor";
|
||||
import { CompactMessage } from "../cards/CompactMessage";
|
||||
import { ListCompactor } from "../../common/ListCompactor";
|
||||
import { CompactMessage } from "../../cards/CompactMessage";
|
||||
import { useRef, useState } from "react";
|
||||
import { Button } from "../ui/button";
|
||||
import { Button } from "../../ui/button";
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
|
@ -14,10 +14,10 @@ import {
|
|||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogTrigger,
|
||||
} from "../ui/alert-dialog";
|
||||
import { Input } from "../ui/input";
|
||||
} from "../../ui/alert-dialog";
|
||||
import { Input } from "../../ui/input";
|
||||
import { createStrike } from "@/lib/actions";
|
||||
import { useToast } from "../ui/use-toast";
|
||||
import { useToast } from "../../ui/use-toast";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
|
@ -25,7 +25,7 @@ import {
|
|||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "../ui/table";
|
||||
} from "../../ui/table";
|
||||
import dayjs from "dayjs";
|
||||
import { decodeTime } from "ulid";
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
"use client";
|
||||
|
||||
import { Server, User } from "revolt-api";
|
||||
import { ListCompactor } from "../common/ListCompactor";
|
||||
import { UserCard } from "../cards/UserCard";
|
||||
import { ServerCard } from "../cards/ServerCard";
|
||||
import { ListCompactor } from "../../common/ListCompactor";
|
||||
import { UserCard } from "../../cards/UserCard";
|
||||
import { ServerCard } from "../../cards/ServerCard";
|
||||
import Link from "next/link";
|
||||
|
||||
export function RelevantObjects({
|
|
@ -1,9 +1,9 @@
|
|||
"use client";
|
||||
|
||||
import { Report } from "revolt-api";
|
||||
import { ListCompactor } from "../common/ListCompactor";
|
||||
import { ReportCard } from "../cards/ReportCard";
|
||||
import { CardLink } from "../common/CardLink";
|
||||
import { ListCompactor } from "../../common/ListCompactor";
|
||||
import { ReportCard } from "../../cards/ReportCard";
|
||||
import { CardLink } from "../../common/CardLink";
|
||||
|
||||
export function RelevantReports({
|
||||
byUser,
|
|
@ -1,8 +1,8 @@
|
|||
"use client";
|
||||
|
||||
import { Report } from "revolt-api";
|
||||
import { Textarea } from "../ui/textarea";
|
||||
import { Button } from "../ui/button";
|
||||
import { Textarea } from "../../ui/textarea";
|
||||
import { Button } from "../../ui/button";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
|
@ -10,9 +10,9 @@ import {
|
|||
DropdownMenuLabel,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from "../ui/dropdown-menu";
|
||||
} from "../../ui/dropdown-menu";
|
||||
import { useState } from "react";
|
||||
import { useToast } from "../ui/use-toast";
|
||||
import { useToast } from "../../ui/use-toast";
|
||||
import {
|
||||
rejectReport,
|
||||
reopenReport,
|
||||
|
@ -30,8 +30,8 @@ import {
|
|||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogTrigger,
|
||||
} from "../ui/alert-dialog";
|
||||
import { ReportCard } from "../cards/ReportCard";
|
||||
} from "../../ui/alert-dialog";
|
||||
import { ReportCard } from "../../cards/ReportCard";
|
||||
|
||||
const template: Record<string, (ref: string) => string> = {
|
||||
resolved: (ref) =>
|
|
@ -1,7 +1,7 @@
|
|||
"use client";
|
||||
|
||||
import { Server } from "revolt-api";
|
||||
import { Button } from "../ui/button";
|
||||
import { Button } from "../../ui/button";
|
||||
import {
|
||||
Command,
|
||||
CommandEmpty,
|
||||
|
@ -18,7 +18,7 @@ import { Check, ChevronsUpDown } from "lucide-react";
|
|||
import { cn } from "@/lib/utils";
|
||||
import { useState } from "react";
|
||||
import { updateServerDiscoverability, updateServerFlags } from "@/lib/actions";
|
||||
import { useToast } from "../ui/use-toast";
|
||||
import { useToast } from "../../ui/use-toast";
|
||||
|
||||
export function ServerActions({ server }: { server: Server }) {
|
||||
const [selectBadges, setSelectBadges] = useState(false);
|
|
@ -1,13 +1,13 @@
|
|||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { Button, buttonVariants } from "../ui/button";
|
||||
import { Button, buttonVariants } from "../../ui/button";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "../ui/dropdown-menu";
|
||||
} from "../../ui/dropdown-menu";
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
|
@ -18,8 +18,8 @@ import {
|
|||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogTrigger,
|
||||
} from "../ui/alert-dialog";
|
||||
import { Input } from "../ui/input";
|
||||
} from "../../ui/alert-dialog";
|
||||
import { Input } from "../../ui/input";
|
||||
import {
|
||||
banUser,
|
||||
closeReportsByUser,
|
||||
|
@ -30,9 +30,9 @@ import {
|
|||
updateUserBadges,
|
||||
} from "@/lib/actions";
|
||||
import { useRef, useState } from "react";
|
||||
import { useToast } from "../ui/use-toast";
|
||||
import { useToast } from "../../ui/use-toast";
|
||||
import { Bot, User } from "revolt-api";
|
||||
import { Card, CardHeader } from "../ui/card";
|
||||
import { Card, CardHeader } from "../../ui/card";
|
||||
import { cn } from "@/lib/utils";
|
||||
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