From e2066f51523ecba0f1991edd0c2b94f8f4cd1820 Mon Sep 17 00:00:00 2001 From: "Alex Pooley (@zuedev)" Date: Sun, 24 May 2026 12:58:49 +0100 Subject: shorten community subdirs --- .../174bg.net/src/app/api/auth/[...all]/route.js | 4 -- .../red-right-hand/174bg.net/src/app/globals.css | 8 ---- .../red-right-hand/174bg.net/src/app/layout.js | 31 ------------- .../red-right-hand/174bg.net/src/app/login/page.js | 51 ---------------------- .../red-right-hand/174bg.net/src/app/page.js | 17 -------- .../174bg.net/src/app/secure/discord-data/page.js | 24 ---------- .../174bg.net/src/app/secure/page.js | 13 ------ communities/red-right-hand/174bg.net/src/auth.js | 23 ---------- .../174bg.net/src/lib/auth-client.js | 6 --- communities/red-right-hand/174bg.net/src/proxy.js | 30 ------------- 10 files changed, 207 deletions(-) delete mode 100644 communities/red-right-hand/174bg.net/src/app/api/auth/[...all]/route.js delete mode 100644 communities/red-right-hand/174bg.net/src/app/globals.css delete mode 100644 communities/red-right-hand/174bg.net/src/app/layout.js delete mode 100644 communities/red-right-hand/174bg.net/src/app/login/page.js delete mode 100644 communities/red-right-hand/174bg.net/src/app/page.js delete mode 100644 communities/red-right-hand/174bg.net/src/app/secure/discord-data/page.js delete mode 100644 communities/red-right-hand/174bg.net/src/app/secure/page.js delete mode 100644 communities/red-right-hand/174bg.net/src/auth.js delete mode 100644 communities/red-right-hand/174bg.net/src/lib/auth-client.js delete mode 100644 communities/red-right-hand/174bg.net/src/proxy.js (limited to 'communities/red-right-hand/174bg.net/src') diff --git a/communities/red-right-hand/174bg.net/src/app/api/auth/[...all]/route.js b/communities/red-right-hand/174bg.net/src/app/api/auth/[...all]/route.js deleted file mode 100644 index 2aabedd..0000000 --- a/communities/red-right-hand/174bg.net/src/app/api/auth/[...all]/route.js +++ /dev/null @@ -1,4 +0,0 @@ -import { auth } from "@/auth"; -import { toNextJsHandler } from "better-auth/next-js"; - -export const { POST, GET } = toNextJsHandler(auth); diff --git a/communities/red-right-hand/174bg.net/src/app/globals.css b/communities/red-right-hand/174bg.net/src/app/globals.css deleted file mode 100644 index fa3342d..0000000 --- a/communities/red-right-hand/174bg.net/src/app/globals.css +++ /dev/null @@ -1,8 +0,0 @@ -@import "tailwindcss"; - -@theme inline { - --color-background: var(--background); - --color-foreground: var(--foreground); - --font-sans: var(--font-inter); - --font-mono: var(--font-fira-code); -} diff --git a/communities/red-right-hand/174bg.net/src/app/layout.js b/communities/red-right-hand/174bg.net/src/app/layout.js deleted file mode 100644 index 9fb4098..0000000 --- a/communities/red-right-hand/174bg.net/src/app/layout.js +++ /dev/null @@ -1,31 +0,0 @@ -import { Inter, Fira_Code } from "next/font/google"; -import "./globals.css"; - -const inter = Inter({ - variable: "--font-inter", - subsets: ["latin"], -}); - -const firaCode = Fira_Code({ - variable: "--font-fira-code", - subsets: ["latin"], -}); - -export const metadata = { - title: "174th Battle Group", - description: "Vengeance Within Reach", - icons: { - icon: "/favicon.png", - }, -}; - -export default function RootLayout({ children }) { - return ( - - {children} - - ); -} diff --git a/communities/red-right-hand/174bg.net/src/app/login/page.js b/communities/red-right-hand/174bg.net/src/app/login/page.js deleted file mode 100644 index b2b1ea8..0000000 --- a/communities/red-right-hand/174bg.net/src/app/login/page.js +++ /dev/null @@ -1,51 +0,0 @@ -"use client"; - -import { Suspense, useEffect, useState } from "react"; -import { useSearchParams } from "next/navigation"; -import { authClient } from "@/lib/auth-client"; - -function LoginRedirect() { - const searchParams = useSearchParams(); - const callbackUrl = searchParams.get("callbackUrl") ?? "/secure"; - const [error, setError] = useState(null); - - const signIn = () => { - authClient.signIn - .social({ - provider: "discord", - callbackURL: callbackUrl, - }) - .then(({ error }) => { - if (error) setError(error.message ?? "Sign-in failed"); - }); - }; - - useEffect(() => { - signIn(); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - - if (error) { - return ( -
-

Error: {error}

- -
- ); - } - - return ( -
-

Redirecting to Discord...

- -
- ); -} - -export default function LoginPage() { - return ( - Loading...

}> - -
- ); -} diff --git a/communities/red-right-hand/174bg.net/src/app/page.js b/communities/red-right-hand/174bg.net/src/app/page.js deleted file mode 100644 index 9aaf53a..0000000 --- a/communities/red-right-hand/174bg.net/src/app/page.js +++ /dev/null @@ -1,17 +0,0 @@ -export default function Home() { - return ( -
-

The 174th Battle Group

-

- "Vengeance Within Reach" -

-

- The 174th Battle Group is a logistical support unit of the United Earth - Empire's military. It is responsible for providing logistical support to - the UEE's forces, including transportation, supply, and maintenance. The - 174th Battle Group is known for its efficiency and reliability, and it - has played a crucial role in many of the UEE's military campaigns. -

-
- ); -} diff --git a/communities/red-right-hand/174bg.net/src/app/secure/discord-data/page.js b/communities/red-right-hand/174bg.net/src/app/secure/discord-data/page.js deleted file mode 100644 index b906569..0000000 --- a/communities/red-right-hand/174bg.net/src/app/secure/discord-data/page.js +++ /dev/null @@ -1,24 +0,0 @@ -import { auth } from "@/auth"; -import { headers } from "next/headers"; - -export default async function DiscordData() { - const session = await auth.api.getSession({ headers: await headers() }); - const accounts = await auth.api.listUserAccounts({ - headers: await headers(), - }); - const discordAccount = accounts?.find((a) => a.provider === "discord"); - - return ( -
-

Discord Data

-

The following data is stored about your Discord account:

-
-        {JSON.stringify(
-          { user: session?.user, account: discordAccount },
-          null,
-          2,
-        )}
-      
-
- ); -} diff --git a/communities/red-right-hand/174bg.net/src/app/secure/page.js b/communities/red-right-hand/174bg.net/src/app/secure/page.js deleted file mode 100644 index 27312b7..0000000 --- a/communities/red-right-hand/174bg.net/src/app/secure/page.js +++ /dev/null @@ -1,13 +0,0 @@ -import { auth } from "@/auth"; -import { headers } from "next/headers"; - -export default async function SecurePage() { - const session = await auth.api.getSession({ headers: await headers() }); - - return ( -
-

Secure Area

-

Welcome, {session?.user?.name ?? session?.user?.email}!

-
- ); -} diff --git a/communities/red-right-hand/174bg.net/src/auth.js b/communities/red-right-hand/174bg.net/src/auth.js deleted file mode 100644 index 4fa8408..0000000 --- a/communities/red-right-hand/174bg.net/src/auth.js +++ /dev/null @@ -1,23 +0,0 @@ -import { betterAuth } from "better-auth"; -import { Pool } from "pg"; - -const postgresUser = process.env.POSTGRES_USER || "postgres"; -const postgresPassword = process.env.POSTGRES_PASSWORD || "postgres"; -const postgresHost = process.env.POSTGRES_HOST || "postgres"; -const postgresPort = process.env.POSTGRES_PORT || 5432; -const postgresDatabase = process.env.POSTGRES_DB || "postgres"; - -export const auth = betterAuth({ - baseURL: process.env.BETTER_AUTH_URL, - secret: process.env.BETTER_AUTH_SECRET, - database: new Pool({ - connectionString: `postgresql://${postgresUser}:${postgresPassword}@${postgresHost}:${postgresPort}/${postgresDatabase}`, - }), - socialProviders: { - discord: { - clientId: process.env.DISCORD_CLIENT_ID, - clientSecret: process.env.DISCORD_CLIENT_SECRET, - scope: ["identify", "email", "guilds", "guilds.join"], - }, - }, -}); diff --git a/communities/red-right-hand/174bg.net/src/lib/auth-client.js b/communities/red-right-hand/174bg.net/src/lib/auth-client.js deleted file mode 100644 index fd0a091..0000000 --- a/communities/red-right-hand/174bg.net/src/lib/auth-client.js +++ /dev/null @@ -1,6 +0,0 @@ -import { createAuthClient } from "better-auth/react"; - -export const authClient = createAuthClient({ - /** The base URL of the server (optional if you're using the same domain) */ - baseURL: process.env.BETTER_AUTH_URL, -}); diff --git a/communities/red-right-hand/174bg.net/src/proxy.js b/communities/red-right-hand/174bg.net/src/proxy.js deleted file mode 100644 index dc0fa42..0000000 --- a/communities/red-right-hand/174bg.net/src/proxy.js +++ /dev/null @@ -1,30 +0,0 @@ -import { NextResponse } from "next/server"; - -export async function proxy(request) { - let session = null; - - try { - const internalUrl = - process.env.BETTER_AUTH_URL_INTERNAL || "http://localhost:3000"; - const res = await fetch(new URL("/api/auth/get-session", internalUrl), { - headers: { - cookie: request.headers.get("cookie") ?? "", - }, - }); - session = await res.json(); - } catch { - // If session check fails, treat as unauthenticated - } - - if (!session?.user) { - const loginUrl = new URL("/login", request.url); - loginUrl.searchParams.set("callbackUrl", request.nextUrl.pathname); - return NextResponse.redirect(loginUrl); - } - - return NextResponse.next(); -} - -export const config = { - matcher: ["/secure/:path*"], -}; -- cgit v1.2.3