From 14659122c36c90bb44c561f1d7cd62acb1dbb075 Mon Sep 17 00:00:00 2001 From: Louis Hollingworth Date: Tue, 16 May 2023 20:17:33 +0100 Subject: [PATCH] All pages now in Nuxt, work next on nav. DB connected, check issues with writing. Signed-off-by: Louis Hollingworth --- README.md | 50 +------ components/NavHeader.vue | 32 +++++ middleware/auth.ts | 2 + nuxt.config.ts | 9 +- package.json | 5 +- pages/dash/index.vue | 22 +++ pages/index.vue | 8 +- pages/login.vue | 13 ++ pages/utilities/birthdays.vue | 3 +- pages/utilities/index.vue | 3 +- pages/utilities/time.vue | 3 +- pnpm-lock.yaml | 23 +++ prisma/schema.prisma | 11 ++ server/index.ts | 4 +- server/routes/auth/v1/callback.ts | 228 ++++++++++++++++++++++++++++++ server/routes/auth/v1/discord.ts | 5 + tailwind.config.ts | 10 ++ 17 files changed, 375 insertions(+), 56 deletions(-) create mode 100644 components/NavHeader.vue create mode 100644 middleware/auth.ts create mode 100644 pages/dash/index.vue create mode 100644 pages/login.vue create mode 100644 server/routes/auth/v1/callback.ts create mode 100644 server/routes/auth/v1/discord.ts diff --git a/README.md b/README.md index bea6349..9d813f8 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,3 @@ -# Welcome to [Astro](https://astro.build) +# Friends Best / Vänner Bästa -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics) - -> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun! - -![basics](https://user-images.githubusercontent.com/4677417/186188965-73453154-fdec-4d6b-9c34-cb35c248ae5b.png) - - -## 🚀 Project Structure - -Inside of your Astro project, you'll see the following folders and files: - -``` -/ -├── public/ -│ └── favicon.svg -├── src/ -│ ├── components/ -│ │ └── Card.astro -│ ├── layouts/ -│ │ └── Layout.astro -│ └── pages/ -│ └── index.astro -└── package.json -``` - -Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name. - -There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components. - -Any static assets, like images, can be placed in the `public/` directory. - -## 🧞 Commands - -All commands are run from the root of the project, from a terminal: - -| Command | Action | -| :--------------------- | :------------------------------------------------- | -| `npm install` | Installs dependencies | -| `npm run dev` | Starts local dev server at `localhost:3000` | -| `npm run build` | Build your production site to `./dist/` | -| `npm run preview` | Preview your build locally, before deploying | -| `npm run astro ...` | Run CLI commands like `astro add`, `astro preview` | -| `npm run astro --help` | Get help using the Astro CLI | - -## 👀 Want to learn more? - -Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat). +A young royals fan website made for the [Young Royals](https://discord.gg/youngroyals) Discord guild. diff --git a/components/NavHeader.vue b/components/NavHeader.vue new file mode 100644 index 0000000..a5e43b4 --- /dev/null +++ b/components/NavHeader.vue @@ -0,0 +1,32 @@ + + + + + \ No newline at end of file diff --git a/middleware/auth.ts b/middleware/auth.ts new file mode 100644 index 0000000..cdbf915 --- /dev/null +++ b/middleware/auth.ts @@ -0,0 +1,2 @@ +export default defineNuxtRouteMiddleware((to, from) => { +}) \ No newline at end of file diff --git a/nuxt.config.ts b/nuxt.config.ts index 7872cdf..407e308 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -4,7 +4,14 @@ export default defineNuxtConfig({ //plugins: ['~/server/index.ts'], }, runtimeConfig: { - mongoUri: process.env.MONGO_URI || 'mongodb://localhost:27017/friends-best', + dbUri: process.env.DATABASE_URL || '', + discordClientId: process.env.DISCORD_CID || '', + discordClientSecret: process.env.DISCORD_CS || '', + discordRedirectUri: process.env.DISCORD_REDIRECT_URI || 'http://localhost:3000/auth/v1/callback', + discordGuildId: process.env.DISCORD_GUILD || '', + discordAdminRoleId: process.env.DISCORD_ADMIN_ROLE || '', + discordStaffRoleId: process.env.DISCORD_STAFF_ROLE || '', + jwtSecret: process.env.JWT_SECRET || 'not_so_secret', }, modules: ["@nuxtjs/tailwindcss", "@nuxtjs/color-mode"], colorMode: { diff --git a/package.json b/package.json index 4b3f268..4940f7c 100644 --- a/package.json +++ b/package.json @@ -10,12 +10,15 @@ "devDependencies": { "@nuxtjs/color-mode": "3.2.0", "@nuxtjs/tailwindcss": "6.6.7", + "@types/jsonwebtoken": "9.0.2", "nuxt": "3.4.3", "prisma": "4.14.0", "tailwindcss": "3.3.2" }, "dependencies": { "@prisma/client": "4.14.0", - "scss": "0.2.4" + "jose": "4.14.4", + "scss": "0.2.4", + "zod": "3.21.4" } } diff --git a/pages/dash/index.vue b/pages/dash/index.vue new file mode 100644 index 0000000..081d1d6 --- /dev/null +++ b/pages/dash/index.vue @@ -0,0 +1,22 @@ + + + \ No newline at end of file diff --git a/pages/index.vue b/pages/index.vue index b6283f8..9bf6621 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1,5 +1,6 @@ \ No newline at end of file diff --git a/pages/login.vue b/pages/login.vue new file mode 100644 index 0000000..cc141cf --- /dev/null +++ b/pages/login.vue @@ -0,0 +1,13 @@ + + + \ No newline at end of file diff --git a/pages/utilities/birthdays.vue b/pages/utilities/birthdays.vue index d18ccf6..6e94b53 100644 --- a/pages/utilities/birthdays.vue +++ b/pages/utilities/birthdays.vue @@ -1,6 +1,7 @@