diff --git a/.env.example b/.env.example index be021f5..5bbb1d5 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,4 @@ -NUXT_SESSION_PASSWORD= \ No newline at end of file +NUXT_SESSION_PASSWORD= +NUXT_OAUTH_GITHUB_CLIENT_ID= +NUXT_OAUTH_GITHUB_CLIENT_SECRET= +NUXT_HUB_PROJECT_KEY= \ No newline at end of file diff --git a/app/app.config.ts b/app/app.config.ts index 437115f..7864699 100644 --- a/app/app.config.ts +++ b/app/app.config.ts @@ -2,8 +2,5 @@ export default defineAppConfig({ ui: { gray: 'neutral', primary: 'gray', - icons: { - dynamic: true, - }, }, }) diff --git a/app/app.vue b/app/app.vue index d1c0180..f5bf468 100644 --- a/app/app.vue +++ b/app/app.vue @@ -1,38 +1,54 @@ @@ -42,19 +58,4 @@ body { font-family: 'DM Sans', sans-serif; @apply h-full w-full text-neutral-700 dark:text-neutral-300; } - -.page-enter-active, -.page-leave-active { - transition: all 0.2s; -} - -.page-leave-to { - opacity: 0; - transform: translateY(-5px); -} - -.page-enter-from { - opacity: 0; - transform: translateY(5px); -} diff --git a/app/composables/authorization.ts b/app/composables/authorization.ts new file mode 100644 index 0000000..cb69077 --- /dev/null +++ b/app/composables/authorization.ts @@ -0,0 +1,10 @@ +export async function isAuthorized() { + const { user } = useUserSession() + const { data: authorized } = await useFetch('/api/authorized', { + method: 'POST', + body: { + email: user.value?.email ?? 'test@nuxt.com', + }, + }) + return authorized.value +} diff --git a/app/middleware/auth.ts b/app/middleware/auth.ts new file mode 100644 index 0000000..6fd88dd --- /dev/null +++ b/app/middleware/auth.ts @@ -0,0 +1,8 @@ +export default defineNuxtRouteMiddleware(async () => { + const { loggedIn } = useUserSession() + const authorized = await isAuthorized() + + if (!loggedIn.value || !authorized) { + return navigateTo('/') + } +}) diff --git a/app/pages/home.vue b/app/pages/home.vue new file mode 100644 index 0000000..c179485 --- /dev/null +++ b/app/pages/home.vue @@ -0,0 +1,35 @@ + + + diff --git a/app/pages/index.vue b/app/pages/index.vue new file mode 100644 index 0000000..7e46d06 --- /dev/null +++ b/app/pages/index.vue @@ -0,0 +1,59 @@ + + + diff --git a/content/maths/geogebra.json b/content/maths/geogebra.json index 4d7c6c9..8e7b3f8 100644 --- a/content/maths/geogebra.json +++ b/content/maths/geogebra.json @@ -9,4 +9,4 @@ ], "icon": "i-icon-park-outline:geometric-flowers", "color": "indigo" -} \ No newline at end of file +} diff --git a/content/maths/mathdf.json b/content/maths/mathdf.json index 5f1bb85..ebfc921 100644 --- a/content/maths/mathdf.json +++ b/content/maths/mathdf.json @@ -9,4 +9,4 @@ ], "icon": "i-ph:math-operations-duotone", "color": "stone" -} \ No newline at end of file +} diff --git a/content/maths/worlfram.json b/content/maths/worlfram.json index f7b982e..aa6a2e4 100644 --- a/content/maths/worlfram.json +++ b/content/maths/worlfram.json @@ -9,4 +9,4 @@ ], "icon": "i-vscode-icons:file-type-wolfram", "color": "red" -} \ No newline at end of file +} diff --git a/content/nuxt/nuxt-content.json b/content/nuxt/nuxt-content.json index 4f16992..9c8a956 100644 --- a/content/nuxt/nuxt-content.json +++ b/content/nuxt/nuxt-content.json @@ -6,11 +6,12 @@ { "name": "Nuxt", "color": "emerald" - }, { + }, + { "name": "Doc", "color": "purple" } ], "icon": "i-logos:nuxt-icon", "color": "green" -} \ No newline at end of file +} diff --git a/content/nuxt/nuxt-hub.json b/content/nuxt/nuxt-hub.json index fb297c8..b911e62 100644 --- a/content/nuxt/nuxt-hub.json +++ b/content/nuxt/nuxt-hub.json @@ -6,11 +6,12 @@ { "name": "Nuxt", "color": "emerald" - }, { + }, + { "name": "Doc", "color": "purple" } ], "icon": "i-logos:nuxt-icon", "color": "green" -} \ No newline at end of file +} diff --git a/content/nuxt/nuxt-labs.json b/content/nuxt/nuxt-labs.json index ae9e10a..d545731 100644 --- a/content/nuxt/nuxt-labs.json +++ b/content/nuxt/nuxt-labs.json @@ -6,11 +6,12 @@ { "name": "Nuxt", "color": "emerald" - }, { + }, + { "name": "Doc", "color": "purple" } ], "icon": "i-logos:nuxt-icon", "color": "zinc" -} \ No newline at end of file +} diff --git a/content/nuxt/nuxt-studio.json b/content/nuxt/nuxt-studio.json index 903e3e6..75cf777 100644 --- a/content/nuxt/nuxt-studio.json +++ b/content/nuxt/nuxt-studio.json @@ -6,11 +6,12 @@ { "name": "Nuxt", "color": "emerald" - }, { + }, + { "name": "Doc", "color": "purple" } ], "icon": "i-logos:nuxt-icon", "color": "green" -} \ No newline at end of file +} diff --git a/content/nuxt/nuxt-ui.json b/content/nuxt/nuxt-ui.json index e5115a7..75bfce5 100644 --- a/content/nuxt/nuxt-ui.json +++ b/content/nuxt/nuxt-ui.json @@ -6,11 +6,12 @@ { "name": "Nuxt", "color": "emerald" - }, { + }, + { "name": "Doc", "color": "purple" } ], "icon": "i-logos:nuxt-icon", "color": "green" -} \ No newline at end of file +} diff --git a/content/nuxt/nuxt.json b/content/nuxt/nuxt.json index f0b1d43..c803d72 100644 --- a/content/nuxt/nuxt.json +++ b/content/nuxt/nuxt.json @@ -5,11 +5,12 @@ { "name": "Nuxt", "color": "emerald" - }, { + }, + { "name": "Doc", "color": "purple" } ], "icon": "i-logos:nuxt-icon", "color": "green" -} \ No newline at end of file +} diff --git a/content/nuxt/vueuse.json b/content/nuxt/vueuse.json index 7aeb624..dfb30dc 100644 --- a/content/nuxt/vueuse.json +++ b/content/nuxt/vueuse.json @@ -14,4 +14,4 @@ ], "icon": "i-logos:vueuse", "color": "green" -} \ No newline at end of file +} diff --git a/content/perso/artsite.json b/content/perso/artsite.json index 46bc4f3..cc619df 100644 --- a/content/perso/artsite.json +++ b/content/perso/artsite.json @@ -13,4 +13,4 @@ ], "icon": "i-ph:globe-duotone", "color": "blue" -} \ No newline at end of file +} diff --git a/content/perso/duolingo.json b/content/perso/duolingo.json index a65d8d8..0575fdd 100644 --- a/content/perso/duolingo.json +++ b/content/perso/duolingo.json @@ -9,4 +9,4 @@ ], "icon": "i-ph:bird-duotone", "color": "lime" -} \ No newline at end of file +} diff --git a/content/social/github.json b/content/social/github.json index 6f2bcb9..94cc204 100644 --- a/content/social/github.json +++ b/content/social/github.json @@ -13,4 +13,4 @@ ], "icon": "i-ph:github-logo-duotone", "color": "black" -} \ No newline at end of file +} diff --git a/content/social/instagram.json b/content/social/instagram.json index 0623895..c86f952 100644 --- a/content/social/instagram.json +++ b/content/social/instagram.json @@ -13,4 +13,4 @@ ], "icon": "i-ph:instagram-logo-duotone", "color": "fuchsia" -} \ No newline at end of file +} diff --git a/content/social/linkedin.json b/content/social/linkedin.json index 9f7d171..33e82a6 100644 --- a/content/social/linkedin.json +++ b/content/social/linkedin.json @@ -13,4 +13,4 @@ ], "icon": "i-ph:linkedin-logo-duotone", "color": "blue" -} \ No newline at end of file +} diff --git a/content/social/twitch.json b/content/social/twitch.json index 25ff5e7..e32cab2 100644 --- a/content/social/twitch.json +++ b/content/social/twitch.json @@ -13,4 +13,4 @@ ], "icon": "i-ph:twitch-logo-duotone", "color": "purple" -} \ No newline at end of file +} diff --git a/content/social/x.json b/content/social/x.json index 7014848..71ab84f 100644 --- a/content/social/x.json +++ b/content/social/x.json @@ -13,4 +13,4 @@ ], "icon": "i-ph:x-logo-duotone", "color": "black" -} \ No newline at end of file +} diff --git a/content/social/youtube.json b/content/social/youtube.json index 52d6b86..953f569 100644 --- a/content/social/youtube.json +++ b/content/social/youtube.json @@ -13,4 +13,4 @@ ], "icon": "i-ph:youtube-logo-duotone", "color": "red" -} \ No newline at end of file +} diff --git a/nuxt.config.ts b/nuxt.config.ts index 9ce5db3..b6e5a9b 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -28,6 +28,7 @@ export default defineNuxtConfig({ hub: { cache: true, analytics: true, + database: true, }, // Nuxt Icon diff --git a/package.json b/package.json index b45ef70..452a24d 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "@nuxthq/studio": "^2.0.3", "@nuxthub/core": "^0.7.3", "@nuxtjs/google-fonts": "^3.2.0", - "drizzle-orm": "^0.33.0", + "drizzle-orm": "^0.32.1", "h3-zod": "^0.5.3", "nuxt": "^3.12.4", "nuxt-auth-utils": "^0.3.4", @@ -32,7 +32,7 @@ "@types/node": "^22.4.2", "@vueuse/core": "^11.0.1", "@vueuse/nuxt": "^11.0.1", - "drizzle-kit": "^0.24.0", + "drizzle-kit": "^0.23.0", "eslint": "^9.9.0", "typescript": "^5.5.4", "vue-tsc": "^2.0.29", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2399f9f..6f87cfa 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,7 +10,7 @@ importers: dependencies: '@nuxt/content': specifier: ^2.13.2 - version: 2.13.2(ioredis@5.4.1)(magicast@0.3.4)(nuxt@3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.33.0(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)))(rollup@4.19.0)(vue@3.4.38(typescript@5.5.4)) + version: 2.13.2(ioredis@5.4.1)(magicast@0.3.4)(nuxt@3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.32.2(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)))(rollup@4.19.0)(vue@3.4.38(typescript@5.5.4)) '@nuxthq/studio': specifier: ^2.0.3 version: 2.0.3(magicast@0.3.4)(rollup@4.19.0) @@ -21,14 +21,14 @@ importers: specifier: ^3.2.0 version: 3.2.0(magicast@0.3.4)(rollup@4.19.0) drizzle-orm: - specifier: ^0.33.0 - version: 0.33.0(@cloudflare/workers-types@4.20240815.0) + specifier: ^0.32.1 + version: 0.32.2(@cloudflare/workers-types@4.20240815.0) h3-zod: specifier: ^0.5.3 version: 0.5.3(h3@1.12.0)(zod@3.23.8) nuxt: specifier: ^3.12.4 - version: 3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.33.0(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)) + version: 3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.32.2(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)) nuxt-auth-utils: specifier: ^0.3.4 version: 0.3.4(magicast@0.3.4)(rollup@4.19.0) @@ -56,10 +56,10 @@ importers: version: 11.0.1(vue@3.4.38(typescript@5.5.4)) '@vueuse/nuxt': specifier: ^11.0.1 - version: 11.0.1(magicast@0.3.4)(nuxt@3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.33.0(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)))(rollup@4.19.0)(vue@3.4.38(typescript@5.5.4)) + version: 11.0.1(magicast@0.3.4)(nuxt@3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.32.2(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)))(rollup@4.19.0)(vue@3.4.38(typescript@5.5.4)) drizzle-kit: - specifier: ^0.24.0 - version: 0.24.0 + specifier: ^0.23.0 + version: 0.23.2 eslint: specifier: ^9.9.0 version: 9.9.0(jiti@1.21.6) @@ -2832,12 +2832,12 @@ packages: resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==} engines: {node: '>=12'} - drizzle-kit@0.24.0: - resolution: {integrity: sha512-rUl5Rf5HLOVkAwHEVEi8xgulIRWzoys0q77RHGCxv5e9v8AI3JGFg7Ug5K1kn513RwNZbuNJMUKOXo0j8kPRgg==} + drizzle-kit@0.23.2: + resolution: {integrity: sha512-NWkQ7GD2OTbQ7HzcjsaCOf3n0tlFPSEAF38fvDpwDj8jRbGWGFtN2cD8I8wp4lU+5Os/oyP2xycTKGLHdPipUw==} hasBin: true - drizzle-orm@0.33.0: - resolution: {integrity: sha512-SHy72R2Rdkz0LEq0PSG/IdvnT3nGiWuRk+2tXZQ90GVq/XQhpCzu/EFT3V2rox+w8MlkBQxifF8pCStNYnERfA==} + drizzle-orm@0.32.2: + resolution: {integrity: sha512-3fXKzPzrgZIcnWCSLiERKN5Opf9Iagrag75snfFlKeKSYB1nlgPBshzW3Zn6dQymkyiib+xc4nIz0t8U+Xdpuw==} peerDependencies: '@aws-sdk/client-rds-data': '>=3' '@cloudflare/workers-types': '>=3' @@ -2980,8 +2980,8 @@ packages: es-module-lexer@1.5.4: resolution: {integrity: sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==} - esbuild-register@3.5.0: - resolution: {integrity: sha512-+4G/XmakeBAsvJuDugJvtyF1x+XJT4FMocynNpxrvEBViirpfUn2PgNpCHedfWhF4WokNsO/OvMKrmJOIJsI5A==} + esbuild-register@3.6.0: + resolution: {integrity: sha512-H2/S7Pm8a9CL1uhp9OvjwrBh5Pvx0H8qVOxNu8Wed9Y7qv56MPtq+GGM8RJpq6glYJn9Wspr8uw7l55uyinNeg==} peerDependencies: esbuild: '>=0.12 <1' @@ -6185,7 +6185,7 @@ snapshots: '@babel/helper-split-export-declaration': 7.24.7 '@babel/parser': 7.24.8 '@babel/types': 7.24.9 - debug: 4.3.5 + debug: 4.3.6 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -6811,7 +6811,7 @@ snapshots: '@koa/router@12.0.1': dependencies: - debug: 4.3.5 + debug: 4.3.6 http-errors: 2.0.0 koa-compose: 4.1.0 methods: 1.1.2 @@ -6865,13 +6865,13 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.17.1 - '@nuxt/content@2.13.2(ioredis@5.4.1)(magicast@0.3.4)(nuxt@3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.33.0(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)))(rollup@4.19.0)(vue@3.4.38(typescript@5.5.4))': + '@nuxt/content@2.13.2(ioredis@5.4.1)(magicast@0.3.4)(nuxt@3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.32.2(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)))(rollup@4.19.0)(vue@3.4.38(typescript@5.5.4))': dependencies: '@nuxt/kit': 3.12.4(magicast@0.3.4)(rollup@4.19.0) '@nuxtjs/mdc': 0.8.3(magicast@0.3.4)(rollup@4.19.0) '@vueuse/core': 10.11.0(vue@3.4.38(typescript@5.5.4)) '@vueuse/head': 2.0.0(vue@3.4.38(typescript@5.5.4)) - '@vueuse/nuxt': 10.11.1(magicast@0.3.4)(nuxt@3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.33.0(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)))(rollup@4.19.0)(vue@3.4.38(typescript@5.5.4)) + '@vueuse/nuxt': 10.11.1(magicast@0.3.4)(nuxt@3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.32.2(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)))(rollup@4.19.0)(vue@3.4.38(typescript@5.5.4)) consola: 3.2.3 defu: 6.1.4 destr: 2.0.3 @@ -7728,7 +7728,7 @@ snapshots: dependencies: '@typescript-eslint/types': 7.17.0 '@typescript-eslint/visitor-keys': 7.17.0 - debug: 4.3.5 + debug: 4.3.6 globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.5 @@ -8132,13 +8132,13 @@ snapshots: '@vueuse/metadata@11.0.1': {} - '@vueuse/nuxt@10.11.1(magicast@0.3.4)(nuxt@3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.33.0(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)))(rollup@4.19.0)(vue@3.4.38(typescript@5.5.4))': + '@vueuse/nuxt@10.11.1(magicast@0.3.4)(nuxt@3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.32.2(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)))(rollup@4.19.0)(vue@3.4.38(typescript@5.5.4))': dependencies: '@nuxt/kit': 3.12.4(magicast@0.3.4)(rollup@4.19.0) '@vueuse/core': 10.11.1(vue@3.4.38(typescript@5.5.4)) '@vueuse/metadata': 10.11.1 local-pkg: 0.5.0 - nuxt: 3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.33.0(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)) + nuxt: 3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.32.2(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)) vue-demi: 0.14.10(vue@3.4.38(typescript@5.5.4)) transitivePeerDependencies: - '@vue/composition-api' @@ -8147,13 +8147,13 @@ snapshots: - supports-color - vue - '@vueuse/nuxt@11.0.1(magicast@0.3.4)(nuxt@3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.33.0(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)))(rollup@4.19.0)(vue@3.4.38(typescript@5.5.4))': + '@vueuse/nuxt@11.0.1(magicast@0.3.4)(nuxt@3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.32.2(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)))(rollup@4.19.0)(vue@3.4.38(typescript@5.5.4))': dependencies: '@nuxt/kit': 3.12.4(magicast@0.3.4)(rollup@4.19.0) '@vueuse/core': 11.0.1(vue@3.4.38(typescript@5.5.4)) '@vueuse/metadata': 11.0.1 local-pkg: 0.5.0 - nuxt: 3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.33.0(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)) + nuxt: 3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.32.2(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)) vue-demi: 0.14.10(vue@3.4.38(typescript@5.5.4)) transitivePeerDependencies: - '@vue/composition-api' @@ -8210,7 +8210,7 @@ snapshots: agent-base@6.0.2: dependencies: - debug: 4.3.5 + debug: 4.3.6 transitivePeerDependencies: - supports-color @@ -8421,7 +8421,7 @@ snapshots: capnp-ts@0.7.0: dependencies: - debug: 4.3.5 + debug: 4.3.6 tslib: 2.6.3 transitivePeerDependencies: - supports-color @@ -8679,9 +8679,9 @@ snapshots: date-fns@3.6.0: {} - db0@0.1.4(drizzle-orm@0.33.0(@cloudflare/workers-types@4.20240815.0)): + db0@0.1.4(drizzle-orm@0.32.2(@cloudflare/workers-types@4.20240815.0)): optionalDependencies: - drizzle-orm: 0.33.0(@cloudflare/workers-types@4.20240815.0) + drizzle-orm: 0.32.2(@cloudflare/workers-types@4.20240815.0) de-indent@1.0.2: {} @@ -8788,16 +8788,16 @@ snapshots: dotenv@16.4.5: {} - drizzle-kit@0.24.0: + drizzle-kit@0.23.2: dependencies: '@drizzle-team/brocli': 0.8.2 '@esbuild-kit/esm-loader': 2.6.5 esbuild: 0.19.12 - esbuild-register: 3.5.0(esbuild@0.19.12) + esbuild-register: 3.6.0(esbuild@0.19.12) transitivePeerDependencies: - supports-color - drizzle-orm@0.33.0(@cloudflare/workers-types@4.20240815.0): + drizzle-orm@0.32.2(@cloudflare/workers-types@4.20240815.0): optionalDependencies: '@cloudflare/workers-types': 4.20240815.0 @@ -8850,9 +8850,9 @@ snapshots: es-module-lexer@1.5.4: {} - esbuild-register@3.5.0(esbuild@0.19.12): + esbuild-register@3.6.0(esbuild@0.19.12): dependencies: - debug: 4.3.5 + debug: 4.3.6 esbuild: 0.19.12 transitivePeerDependencies: - supports-color @@ -9730,7 +9730,7 @@ snapshots: https-proxy-agent@5.0.1: dependencies: agent-base: 6.0.2 - debug: 4.3.5 + debug: 4.3.6 transitivePeerDependencies: - supports-color @@ -9774,7 +9774,7 @@ snapshots: dependencies: '@ioredis/commands': 1.2.0 cluster-key-slot: 1.1.2 - debug: 4.3.5 + debug: 4.3.6 denque: 2.1.0 lodash.defaults: 4.2.0 lodash.isarguments: 3.1.0 @@ -9961,7 +9961,7 @@ snapshots: koa-send@5.0.1: dependencies: - debug: 4.3.5 + debug: 4.3.6 http-errors: 1.8.1 resolve-path: 1.4.0 transitivePeerDependencies: @@ -9981,7 +9981,7 @@ snapshots: content-disposition: 0.5.4 content-type: 1.0.5 cookies: 0.9.1 - debug: 4.3.5 + debug: 4.3.6 delegates: 1.0.0 depd: 2.0.0 destroy: 1.2.0 @@ -10422,7 +10422,7 @@ snapshots: micromark@2.11.4: dependencies: - debug: 4.3.5 + debug: 4.3.6 parse-entities: 2.0.0 transitivePeerDependencies: - supports-color @@ -10579,7 +10579,7 @@ snapshots: mlly: 1.7.1 pkg-types: 1.1.3 - nitropack@2.9.7(drizzle-orm@0.33.0(@cloudflare/workers-types@4.20240815.0))(magicast@0.3.4): + nitropack@2.9.7(drizzle-orm@0.32.2(@cloudflare/workers-types@4.20240815.0))(magicast@0.3.4): dependencies: '@cloudflare/kv-asset-handler': 0.3.4 '@netlify/functions': 2.8.1 @@ -10602,7 +10602,7 @@ snapshots: cookie-es: 1.2.1 croner: 8.1.0 crossws: 0.2.4 - db0: 0.1.4(drizzle-orm@0.33.0(@cloudflare/workers-types@4.20240815.0)) + db0: 0.1.4(drizzle-orm@0.32.2(@cloudflare/workers-types@4.20240815.0)) defu: 6.1.4 destr: 2.0.3 dot-prop: 8.0.2 @@ -10753,7 +10753,7 @@ snapshots: - rollup - supports-color - nuxt@3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.33.0(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)): + nuxt@3.12.4(@parcel/watcher@2.4.1)(@types/node@22.4.2)(drizzle-orm@0.32.2(@cloudflare/workers-types@4.20240815.0))(eslint@9.9.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.4)(optionator@0.9.4)(rollup@4.19.0)(terser@5.31.3)(typescript@5.5.4)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3))(vue-tsc@2.0.29(typescript@5.5.4)): dependencies: '@nuxt/devalue': 2.0.2 '@nuxt/devtools': 1.3.14(rollup@4.19.0)(vite@5.3.4(@types/node@22.4.2)(terser@5.31.3)) @@ -10787,7 +10787,7 @@ snapshots: knitwork: 1.1.0 magic-string: 0.30.10 mlly: 1.7.1 - nitropack: 2.9.7(drizzle-orm@0.33.0(@cloudflare/workers-types@4.20240815.0))(magicast@0.3.4) + nitropack: 2.9.7(drizzle-orm@0.32.2(@cloudflare/workers-types@4.20240815.0))(magicast@0.3.4) nuxi: 3.12.0 nypm: 0.3.9 ofetch: 1.3.4 @@ -12246,7 +12246,7 @@ snapshots: vite-node@2.0.4(@types/node@22.4.2)(terser@5.31.3): dependencies: cac: 6.7.14 - debug: 4.3.5 + debug: 4.3.6 pathe: 1.1.2 tinyrainbow: 1.2.0 vite: 5.3.4(@types/node@22.4.2)(terser@5.31.3) diff --git a/server/api/authorized.post.ts b/server/api/authorized.post.ts new file mode 100644 index 0000000..c441794 --- /dev/null +++ b/server/api/authorized.post.ts @@ -0,0 +1,10 @@ +import { useValidatedBody, z } from 'h3-zod' + +export default defineEventHandler(async (event) => { + const users = await useDB().select().from(tables.users).all() + const { email } = await useValidatedBody(event, { + email: z.string(), + }) + const user = users.find(user => user.email === email) + return !!user +}) diff --git a/server/api/test.ts b/server/api/test.ts deleted file mode 100644 index 2353df0..0000000 --- a/server/api/test.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default defineEventHandler(() => { - return { hello: 'API' } -}) diff --git a/server/database/migrations/0000_hot_thunderball.sql b/server/database/migrations/0000_hot_thunderball.sql deleted file mode 100644 index f47763e..0000000 --- a/server/database/migrations/0000_hot_thunderball.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE `users` ( - `id` integer PRIMARY KEY NOT NULL, - `name` text DEFAULT '', - `created_at` text DEFAULT (CURRENT_DATE) -); diff --git a/server/database/migrations/meta/0000_snapshot.json b/server/database/migrations/meta/0000_snapshot.json deleted file mode 100644 index cc7bfa9..0000000 --- a/server/database/migrations/meta/0000_snapshot.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "ef8e28cd-73a1-4801-9a0b-7e80169a57c0", - "prevId": "00000000-0000-0000-0000-000000000000", - "tables": { - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "''" - }, - "created_at": { - "name": "created_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(CURRENT_DATE)" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": {} - } -} diff --git a/server/database/migrations/meta/_journal.json b/server/database/migrations/meta/_journal.json deleted file mode 100644 index d7430e8..0000000 --- a/server/database/migrations/meta/_journal.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "entries": [ - { - "idx": 0, - "version": "6", - "when": 1721758030188, - "tag": "0000_hot_thunderball", - "breakpoints": true - } - ] -} diff --git a/server/database/schema.ts b/server/database/schema.ts index d9b6a71..53b2175 100644 --- a/server/database/schema.ts +++ b/server/database/schema.ts @@ -4,5 +4,6 @@ import { sql } from 'drizzle-orm' export const users = sqliteTable('users', { id: integer('id').primaryKey(), name: text('name').default(''), + email: text('email').default(''), createdAt: text('created_at').default(sql`(CURRENT_DATE)`), }) diff --git a/server/routes/auth/github.get.ts b/server/routes/auth/github.get.ts new file mode 100644 index 0000000..581984d --- /dev/null +++ b/server/routes/auth/github.get.ts @@ -0,0 +1,18 @@ +export default oauthGitHubEventHandler({ + config: { + emailRequired: true, + }, + async onSuccess(event, { user }) { + await setUserSession(event, { + user: { + email: user.email, + name: user.name, + }, + }) + return sendRedirect(event, '/home') + }, + onError(event, error) { + console.error('GitHub OAuth error:', error) + return sendRedirect(event, '/') + }, +}) diff --git a/auth.d.ts b/types/auth.d.ts similarity index 61% rename from auth.d.ts rename to types/auth.d.ts index b991897..d05bcd8 100644 --- a/auth.d.ts +++ b/types/auth.d.ts @@ -1,11 +1,13 @@ // auth.d.ts declare module '#auth-utils' { interface User { - // Add your own fields + email: string + name: string } interface UserSession { - // Add your own fields + email: string + name: string } }