diff --git a/apps/website/astro.config.ts b/apps/website/astro.config.ts
index d3d8d91..709c4b4 100644
--- a/apps/website/astro.config.ts
+++ b/apps/website/astro.config.ts
@@ -2,36 +2,24 @@ import path from "path";
import { fileURLToPath } from "url";
import { defineConfig } from "astro/config";
import sitemap from "@astrojs/sitemap";
-import robotsTxt from "astro-robots-txt";
-import compress from "astro-compress";
import tailwind from "@astrojs/tailwind";
+import cloudflare from "@astrojs/cloudflare";
+import auth from "auth-astro";
import { CONFIG } from "./src/config";
-import image from "@astrojs/image";
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
// https://astro.build/config
export default defineConfig({
- site: CONFIG.origin,
- base: "/",
- trailingSlash: "always",
- output: "static",
- integrations: [sitemap(), robotsTxt({
- policy: [{
- userAgent: "*"
- }],
- sitemap: true
- }), compress({
- css: true,
- html: true,
- img: true,
- js: true,
- svg: true
- }), tailwind(), image()],
- vite: {
- resolve: {
- alias: {
- "~": path.resolve(__dirname, "./src")
- }
- }
- }
-});
\ No newline at end of file
+ site: CONFIG.origin,
+ integrations: [sitemap(), tailwind(), auth()],
+ output: "server",
+ adapter: cloudflare(),
+ vite: {
+ resolve: {
+ alias: {
+ "~": path.resolve(__dirname, "./src"),
+ },
+ },
+ },
+});
diff --git a/apps/website/auth.config.ts b/apps/website/auth.config.ts
new file mode 100644
index 0000000..140c417
--- /dev/null
+++ b/apps/website/auth.config.ts
@@ -0,0 +1,23 @@
+import Discord from "@auth/core/providers/discord";
+import { defineConfig } from "auth-astro";
+
+export default defineConfig({
+ providers: [
+ Discord({
+ clientId: import.meta.env.DISCORD_CLIENT_ID,
+ clientSecret: import.meta.env.DISCORD_CLIENT_SECRET,
+ }),
+ ],
+ callbacks: {
+ session({ session, token }) {
+ if (session.user && token?.sub) {
+ session.user.id = token.sub;
+ }
+ return session;
+ },
+ },
+ pages: {
+ signIn: "/auth/login",
+ signOut: "/auth/logout",
+ },
+});
diff --git a/apps/website/bun.lockb b/apps/website/bun.lockb
new file mode 100755
index 0000000..2e6eea9
Binary files /dev/null and b/apps/website/bun.lockb differ
diff --git a/apps/website/package.json b/apps/website/package.json
index c979ac4..1643d29 100644
--- a/apps/website/package.json
+++ b/apps/website/package.json
@@ -9,16 +9,16 @@
"astro": "astro"
},
"dependencies": {
- "@astrojs/image": "^0.16.5",
+ "@astrojs/cloudflare": "^11.0.1",
"@astrojs/prefetch": "^0.2.1",
- "@astrojs/sitemap": "^1.2.1",
- "@astrojs/tailwind": "^3.1.1",
+ "@astrojs/sitemap": "^3.1.6",
+ "@astrojs/tailwind": "^5.1.0",
+ "@auth/core": "^0.18.6",
"@tailwindcss/typography": "^0.5.9",
- "astro": "^2.2.1",
- "astro-compress": "2.2.11",
+ "astro": "^4.11.5",
"astro-google-fonts-optimizer": "^0.2.2",
"astro-icon": "^0.8.0",
- "astro-robots-txt": "^0.4.1",
+ "auth-astro": "^4.1.2",
"tailwindcss": "^3.3.1"
},
"devDependencies": {
diff --git a/apps/website/src/pages/auth/login.astro b/apps/website/src/pages/auth/login.astro
new file mode 100644
index 0000000..fa7fb8e
--- /dev/null
+++ b/apps/website/src/pages/auth/login.astro
@@ -0,0 +1,13 @@
+---
+import Layout from "~/layouts/Layout.astro";
+---
+
+
Welcome {session.user?.name}
:Not logged in
} diff --git a/apps/website/src/pages/index.astro b/apps/website/src/pages/index.astro index 8009f4b..5a9ab2d 100644 --- a/apps/website/src/pages/index.astro +++ b/apps/website/src/pages/index.astro @@ -2,8 +2,8 @@ import Layout from "~/layouts/Layout.astro"; import Invite from "~/components/Invite.astro"; import Computer from "~/components/Computer.astro"; -import { Image } from "@astrojs/image/components"; import Logo from "~/assets/logo.png"; +import { Image } from "astro:assets"; ---