From e48d937d6eb047372f44ac10e3aa99e9531c8b3c Mon Sep 17 00:00:00 2001 From: Bradley Shellnut Date: Mon, 30 Sep 2024 20:55:20 -0700 Subject: [PATCH 1/7] Adding domain to env --- src/lib/server/api/common/config.ts | 18 ++---------------- src/lib/server/api/common/env.ts | 1 + 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/lib/server/api/common/config.ts b/src/lib/server/api/common/config.ts index 5330e2a..4c8b15b 100644 --- a/src/lib/server/api/common/config.ts +++ b/src/lib/server/api/common/config.ts @@ -1,23 +1,9 @@ import env from './env' import type { Config } from './types/config' -const isPreview = process.env.VERCEL_ENV === 'preview' || process.env.VERCEL_ENV === 'development' - -let domain: string -if (process.env.NODE_ENV === 'production' || process.env.VERCEL_ENV === 'production') { - domain = 'boredgame.vercel.app' -} else if (isPreview && process.env.VERCEL_BRANCH_URL !== undefined) { - domain = process.env.VERCEL_BRANCH_URL -} else { - domain = 'localhost' -} - -// export const config = { ...env, isProduction: process.env.NODE_ENV === 'production' -// || process.env.VERCEL_ENV === 'production', domain }; - export const config: Config = { - isProduction: process.env.NODE_ENV === 'production' || process.env.VERCEL_ENV === 'production', - domain, + isProduction: process.env.NODE_ENV === 'production', + domain: env.DOMAIN, api: { origin: env.ORIGIN, }, diff --git a/src/lib/server/api/common/env.ts b/src/lib/server/api/common/env.ts index 5dd1157..ea4b523 100644 --- a/src/lib/server/api/common/env.ts +++ b/src/lib/server/api/common/env.ts @@ -17,6 +17,7 @@ const EnvSchema = z.object({ DATABASE_DB: z.string(), DB_MIGRATING: stringBoolean, DB_SEEDING: stringBoolean, + DOMAIN: z.string(), GITHUB_CLIENT_ID: z.string(), GITHUB_CLIENT_SECRET: z.string(), GOOGLE_CLIENT_ID: z.string(), From e86c589ba4256067eb8ab4a5ea6750a7b0d9c65e Mon Sep 17 00:00:00 2001 From: Bradley Shellnut Date: Mon, 30 Sep 2024 20:56:21 -0700 Subject: [PATCH 2/7] Updating example env. --- .env.example | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index a539bcd..ecffe7b 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,6 @@ # Private -ORIGIN=http://localhost:5173 +DOMAIN=localhost +ORIGIN=http://$DOMAIN:5173 NODE_ENV=development @@ -27,7 +28,7 @@ GOOGLE_CLIENT_SECRET="" # Public PUBLIC_SITE_NAME='Bored Game' -PUBLIC_SITE_URL='http://localhost:5173' +PUBLIC_SITE_URL='http://$DOMAIN:5173' PUBLIC_UMAMI_DO_NOT_TRACK=true PUBLIC_UMAMI_URL= PUBLIC_UMAMI_ID= From fc4396ccdd2bc094278fd19357dc62b4669a5a2e Mon Sep 17 00:00:00 2001 From: Bradley Shellnut Date: Mon, 30 Sep 2024 21:20:19 -0700 Subject: [PATCH 3/7] Fixing origin config --- src/lib/server/api/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/server/api/index.ts b/src/lib/server/api/index.ts index 3106d86..10fd92d 100644 --- a/src/lib/server/api/index.ts +++ b/src/lib/server/api/index.ts @@ -61,6 +61,6 @@ container.resolve(AuthCleanupJobs).deleteStaleLoginRequests() /* -------------------------------------------------------------------------- */ /* Exports */ /* -------------------------------------------------------------------------- */ -export const rpc = hc(config.ORIGIN) +export const rpc = hc(config.api.origin) export type ApiClient = typeof rpc export type ApiRoutes = typeof routes From 4032838f49c79134aa5d6777821f049458d610ce Mon Sep 17 00:00:00 2001 From: Bradley Shellnut Date: Tue, 1 Oct 2024 17:09:56 -0700 Subject: [PATCH 4/7] Fixing get all wishlists, style wishlist cards, and fix TOTP. --- package.json | 4 +- pnpm-lock.yaml | 26 ++++++------- .../repositories/collections.repository.ts | 5 +++ .../repositories/recovery-codes.repository.ts | 2 +- .../api/repositories/wishlists.repository.ts | 1 + src/lib/server/api/services/totp.service.ts | 6 +-- .../(protected)/collections/+page.svelte | 10 ++--- .../(app)/(protected)/settings/+layout.svelte | 22 +++++++---- .../security/mfa/totp/+page.server.ts | 6 +-- .../(protected)/wishlists/+page.server.ts | 12 +----- .../(app)/(protected)/wishlists/+page.svelte | 38 ++++++++++--------- src/routes/(app)/+page.svelte | 4 +- 12 files changed, 68 insertions(+), 68 deletions(-) diff --git a/package.json b/package.json index dc6a12c..a4e9e9a 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "@hono/zod-validator": "^0.2.2", "@iconify-icons/line-md": "^1.2.30", "@iconify-icons/mdi": "^1.2.48", - "@internationalized/date": "^3.5.5", + "@internationalized/date": "^3.5.6", "@lucia-auth/adapter-drizzle": "^1.1.0", "@lukeed/uuid": "^2.0.1", "@neondatabase/serverless": "^0.9.5", @@ -97,7 +97,7 @@ "@types/feather-icons": "^4.29.4", "bits-ui": "^0.21.13", "boardgamegeekclient": "^1.9.1", - "bullmq": "^5.14.0", + "bullmq": "^5.15.0", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "cookie": "^0.6.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 453dea3..acfa118 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -27,8 +27,8 @@ importers: specifier: ^1.2.48 version: 1.2.48 '@internationalized/date': - specifier: ^3.5.5 - version: 3.5.5 + specifier: ^3.5.6 + version: 3.5.6 '@lucia-auth/adapter-drizzle': specifier: ^1.1.0 version: 1.1.0(drizzle-orm@0.32.2(@neondatabase/serverless@0.9.5)(@types/pg@8.11.10)(pg@8.13.0(pg-native@3.2.0))(postgres@3.4.4))(lucia@3.2.0) @@ -78,8 +78,8 @@ importers: specifier: ^1.9.1 version: 1.9.1 bullmq: - specifier: ^5.14.0 - version: 5.14.0 + specifier: ^5.15.0 + version: 5.15.0 class-variance-authority: specifier: ^0.7.0 version: 0.7.0 @@ -1415,8 +1415,8 @@ packages: cpu: [x64] os: [win32] - '@internationalized/date@3.5.5': - resolution: {integrity: sha512-H+CfYvOZ0LTJeeLOqm19E3uj/4YjrmOFtBufDHPfvtI80hFAMqtrp7oCACpe4Cil5l8S0Qu/9dYfZc/5lY8WQQ==} + '@internationalized/date@3.5.6': + resolution: {integrity: sha512-jLxQjefH9VI5P9UQuqB6qNKnvFt1Ky1TPIzHGsIlCi7sZZoMR8SdYbBGRvM0y+Jtb+ez4ieBzmiAUcpmPYpyOw==} '@ioredis/commands@1.2.0': resolution: {integrity: sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg==} @@ -2366,8 +2366,8 @@ packages: buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} - bullmq@5.14.0: - resolution: {integrity: sha512-qxZHtRuGEp0oHM1aNokuZ4gA0xr6vcZQPe1OLuQoDTuhaEXB4faxApUoo85v/PHnzrniAAqNT9kqD+UBbmECDQ==} + bullmq@5.15.0: + resolution: {integrity: sha512-h53shVjx8s6wxYGtUfzAfENpSP7N5T0D4PMTvbZncozLjb8yUKhopfpa7PmcpQfq7SSO9dm/OZ9XQuGOCSGNug==} bytes@3.1.2: resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} @@ -5668,7 +5668,7 @@ snapshots: '@img/sharp-win32-x64@0.33.5': optional: true - '@internationalized/date@3.5.5': + '@internationalized/date@3.5.6': dependencies: '@swc/helpers': 0.5.13 @@ -5746,7 +5746,7 @@ snapshots: dependencies: '@floating-ui/core': 1.6.7 '@floating-ui/dom': 1.6.10 - '@internationalized/date': 3.5.5 + '@internationalized/date': 3.5.6 dequal: 2.0.3 focus-trap: 7.5.4 nanoid: 5.0.7 @@ -5756,7 +5756,7 @@ snapshots: dependencies: '@floating-ui/core': 1.6.7 '@floating-ui/dom': 1.6.10 - '@internationalized/date': 3.5.5 + '@internationalized/date': 3.5.6 dequal: 2.0.3 focus-trap: 7.5.4 nanoid: 5.0.7 @@ -6577,7 +6577,7 @@ snapshots: bits-ui@0.21.15(svelte@5.0.0-next.175): dependencies: - '@internationalized/date': 3.5.5 + '@internationalized/date': 3.5.6 '@melt-ui/svelte': 0.76.2(svelte@5.0.0-next.175) nanoid: 5.0.7 svelte: 5.0.0-next.175 @@ -6631,7 +6631,7 @@ snapshots: buffer-from@1.1.2: {} - bullmq@5.14.0: + bullmq@5.15.0: dependencies: cron-parser: 4.9.0 ioredis: 5.4.1 diff --git a/src/lib/server/api/repositories/collections.repository.ts b/src/lib/server/api/repositories/collections.repository.ts index c351714..7ce1e71 100644 --- a/src/lib/server/api/repositories/collections.repository.ts +++ b/src/lib/server/api/repositories/collections.repository.ts @@ -48,6 +48,11 @@ export class CollectionsRepository { async findAllByUserId(userId: string, db = this.drizzle.db) { return db.query.collections.findMany({ where: eq(collections.user_id, userId), + columns: { + cuid: true, + name: true, + createdAt: true, + }, }) } diff --git a/src/lib/server/api/repositories/recovery-codes.repository.ts b/src/lib/server/api/repositories/recovery-codes.repository.ts index f6ff1e9..9d9e720 100644 --- a/src/lib/server/api/repositories/recovery-codes.repository.ts +++ b/src/lib/server/api/repositories/recovery-codes.repository.ts @@ -16,7 +16,7 @@ export class RecoveryCodesRepository { } async findAllByUserId(userId: string, db = this.drizzle.db) { - return db.query.recoveryCodesTable.findFirst({ + return db.query.recoveryCodesTable.findMany({ where: eq(recoveryCodesTable.userId, userId), }) } diff --git a/src/lib/server/api/repositories/wishlists.repository.ts b/src/lib/server/api/repositories/wishlists.repository.ts index 5667cc2..112f272 100644 --- a/src/lib/server/api/repositories/wishlists.repository.ts +++ b/src/lib/server/api/repositories/wishlists.repository.ts @@ -51,6 +51,7 @@ export class WishlistsRepository { columns: { cuid: true, name: true, + createdAt: true, }, }) } diff --git a/src/lib/server/api/services/totp.service.ts b/src/lib/server/api/services/totp.service.ts index ac0253c..f5f1ca6 100644 --- a/src/lib/server/api/services/totp.service.ts +++ b/src/lib/server/api/services/totp.service.ts @@ -1,5 +1,4 @@ import { CredentialsRepository } from '$lib/server/api/repositories/credentials.repository' -import { HMAC } from 'oslo/crypto' import { decodeHex, encodeHexLowerCase } from '@oslojs/encoding' import { verifyTOTP } from '@oslojs/otp' import { inject, injectable } from 'tsyringe' @@ -22,12 +21,11 @@ export class TotpService { } async create(userId: string) { - const twoFactorSecret = await new HMAC('SHA-1').generateKey() - + const secret = new Uint8Array(20) try { return await this.credentialsRepository.create({ user_id: userId, - secret_data: encodeHexLowerCase(twoFactorSecret), + secret_data: encodeHexLowerCase(crypto.getRandomValues(secret)), type: 'totp', }) } catch (e) { diff --git a/src/routes/(app)/(protected)/collections/+page.svelte b/src/routes/(app)/(protected)/collections/+page.svelte index 6d600b9..63f8d7d 100644 --- a/src/routes/(app)/(protected)/collections/+page.svelte +++ b/src/routes/(app)/(protected)/collections/+page.svelte @@ -1,5 +1,6 @@ @@ -9,14 +10,13 @@ let collections = data?.collections || []
-

Your Collections

- +

Your Collections

{#if collections.length === 0}

You have no collections

{:else} {#each collections as collection} - + {collection.name} @@ -25,10 +25,6 @@ let collections = data?.collections || []

Created at: {new Date(collection.createdAt).toLocaleString()}

- {/each} {/if}
diff --git a/src/routes/(app)/(protected)/settings/+layout.svelte b/src/routes/(app)/(protected)/settings/+layout.svelte index 81483b4..4f4c6f4 100644 --- a/src/routes/(app)/(protected)/settings/+layout.svelte +++ b/src/routes/(app)/(protected)/settings/+layout.svelte @@ -34,15 +34,21 @@ let { children } = $props() .security-nav { display: flex; + @media (width <= 1000px) { + display: grid; + } + nav { - width: 16rem; - position: sticky; - top: 0; - left: 0; - background-color: #fff; - padding: 1rem; - border-right: 1px solid #ddd; - height: 100vh; + @media (width > 1000px) { + width: 16rem; + position: sticky; + top: 0; + left: 0; + background-color: #fff; + padding: 1rem; + border-right: 1px solid #ddd; + height: 100vh; + } ul { list-style-type: none; diff --git a/src/routes/(app)/(protected)/settings/security/mfa/totp/+page.server.ts b/src/routes/(app)/(protected)/settings/security/mfa/totp/+page.server.ts index 91f2ec4..a551027 100644 --- a/src/routes/(app)/(protected)/settings/security/mfa/totp/+page.server.ts +++ b/src/routes/(app)/(protected)/settings/security/mfa/totp/+page.server.ts @@ -1,9 +1,9 @@ import { notSignedInMessage } from '$lib/flashMessages' import env from '$lib/server/api/common/env' +import { decodeHex, encodeBase32 } from '@oslojs/encoding' +import { createTOTPKeyURI } from '@oslojs/otp' import { type Actions, fail } from '@sveltejs/kit' import kebabCase from 'just-kebab-case' -import { encodeBase32, decodeHex } from '@oslojs/encoding' -import { createTOTPKeyURI } from '@oslojs/otp' import QRCode from 'qrcode' import { redirect } from 'sveltekit-flash-message/server' import { zod } from 'sveltekit-superforms/adapters' @@ -63,7 +63,7 @@ export const load: PageServerLoad = async (event) => { }) } const decodedHexSecret = decodeHex(createdTotpCredentials.secret_data) - const secret = encodeBase32(new TextEncoder().encode(decodedHexSecret)) + const secret = encodeBase32(decodedHexSecret) const intervalInSeconds = 30 const digits = 6 diff --git a/src/routes/(app)/(protected)/wishlists/+page.server.ts b/src/routes/(app)/(protected)/wishlists/+page.server.ts index f211518..d5e1386 100644 --- a/src/routes/(app)/(protected)/wishlists/+page.server.ts +++ b/src/routes/(app)/(protected)/wishlists/+page.server.ts @@ -1,7 +1,6 @@ import { notSignedInMessage } from '$lib/flashMessages.js' import { gamesTable, wishlist_items, wishlistsTable } from '$lib/server/api/databases/tables' import { db } from '$lib/server/api/packages/drizzle' -import { userNotAuthenticated } from '$lib/server/auth-utils' import { modifyListGameSchema } from '$lib/validations/zod-schemas' import { type Actions, error, fail } from '@sveltejs/kit' import { and, eq } from 'drizzle-orm' @@ -17,15 +16,8 @@ export async function load(event) { throw redirect(302, '/login', notSignedInMessage, event) } - const userWishlists = await db.query.wishlists.findMany({ - columns: { - cuid: true, - name: true, - createdAt: true, - }, - where: eq(wishlistsTable.user_id, authedUser.id), - }) - console.log('wishlists', userWishlists) + const { data } = await locals.api.wishlists.$get().then(locals.parseApiResponse) + const userWishlists = data?.wishlists if (userWishlists?.length === 0) { console.log('Wishlists not found') diff --git a/src/routes/(app)/(protected)/wishlists/+page.svelte b/src/routes/(app)/(protected)/wishlists/+page.svelte index ace0846..29ad9b3 100644 --- a/src/routes/(app)/(protected)/wishlists/+page.svelte +++ b/src/routes/(app)/(protected)/wishlists/+page.svelte @@ -1,4 +1,6 @@ @@ -8,21 +10,25 @@ const { wishlists = [] } = data
-

Your wishlistsTable

+

Your wishlists

-
-
- {#if wishlists.length === 0} -

You have no wishlistsTable

- {:else} - {#each wishlists as wishlist} -
-

{wishlist.name}

-

Created at: {new Date(wishlist.created_at).toLocaleString()}

-
- {/each} - {/if} -
+
+ {#if wishlists.length === 0} +

You have no wishlists

+ {:else} + {#each wishlists as wishlist} + + + + {wishlist.name} + + +

Created at: {new Date(wishlist.createdAt).toLocaleString()}

+
+
+
+ {/each} + {/if}
@@ -32,10 +38,6 @@ const { wishlists = [] } = data width: 100%; } - .wishlists { - margin: 2rem 0; - } - .wishlist-list { display: grid; grid-template-columns: repeat(3, minmax(200px, 1fr)); diff --git a/src/routes/(app)/+page.svelte b/src/routes/(app)/+page.svelte index bb10caa..4f8f756 100644 --- a/src/routes/(app)/+page.svelte +++ b/src/routes/(app)/+page.svelte @@ -8,7 +8,7 @@ const welcomeName = $derived.by(() => { welcomeName += data?.user?.firstName } if (data?.user?.lastName) { - welcomeName += ' ' + data?.user?.lastName + welcomeName = welcomeName.length === 0 ? data?.user?.lastName : welcomeName } if (welcomeName.length === 0) { @@ -23,7 +23,7 @@ const welcomeName = $derived.by(() => { {#if user}

Welcome, {welcomeName}!

-

You wishlistsTable:

+

You wishlists:

{#each wishlists as wishlist} {wishlist.name} {/each} From ad74bc0f85519d47ab9c14c04e8dc88fa6c4e7b5 Mon Sep 17 00:00:00 2001 From: Bradley Shellnut Date: Wed, 2 Oct 2024 16:01:38 -0700 Subject: [PATCH 5/7] Moving to TS tailwindcss, move to Sonner toast. --- components.json | 2 +- docker-compose.yaml | 15 +-- package.json | 3 +- pnpm-lock.yaml | 42 +++---- src/app.d.ts | 17 +-- src/app.html | 35 +----- src/lib/components/Header.svelte | 38 ++---- src/lib/components/ui/sonner/index.ts | 1 + src/lib/components/ui/sonner/sonner.svelte | 20 ++++ src/lib/utils/superforms.ts | 20 ++++ .../(app)/(protected)/admin/+layout.server.ts | 1 + .../(app)/(protected)/admin/+layout.svelte | 20 +--- src/routes/(app)/+layout.svelte | 25 +--- src/routes/(auth)/login/+page.server.ts | 89 +------------- src/routes/+layout.svelte | 113 +++++++++--------- tailwind.config.js | 65 ---------- tailwind.config.ts | 69 +++++++++++ 17 files changed, 217 insertions(+), 358 deletions(-) create mode 100644 src/lib/components/ui/sonner/index.ts create mode 100644 src/lib/components/ui/sonner/sonner.svelte create mode 100644 src/lib/utils/superforms.ts delete mode 100644 tailwind.config.js create mode 100644 tailwind.config.ts diff --git a/components.json b/components.json index 8d5d8e6..6d70d7d 100644 --- a/components.json +++ b/components.json @@ -2,7 +2,7 @@ "$schema": "https://shadcn-svelte.com/schema.json", "style": "default", "tailwind": { - "config": "tailwind.config.js", + "config": "tailwind.config.ts", "css": "src/lib/styles/app.pcss", "baseColor": "slate" }, diff --git a/docker-compose.yaml b/docker-compose.yaml index 82b9871..b16dfd0 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,6 +1,8 @@ +version: '3.8' services: postgres: image: postgres:latest + container_name: boredgame_postgres environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres @@ -11,6 +13,7 @@ services: - postgres_data:/var/lib/postgresql/data redis: image: redis:latest + container_name: boredgame_redis ports: - '6379:6379' volumes: @@ -23,18 +26,6 @@ services: # - '3592:3592' # volumes: # - ./policies:/policies -# caddy: -# image: caddy:latest -# restart: unless-stopped -# ports: -# - "80:80" -# - "443:443" -# - "443:443/udp" -# volumes: -# - ./Caddyfile:/etc/caddy/Caddyfile -# - ./site:/srv -# - caddy_data:/data -# - caddy_config:/config volumes: postgres_data: redis_data: diff --git a/package.json b/package.json index a4e9e9a..dcd652b 100644 --- a/package.json +++ b/package.json @@ -116,6 +116,7 @@ "just-capitalize": "^3.2.0", "just-kebab-case": "^4.2.0", "loader": "^2.1.1", + "mode-watcher": "^0.4.1", "open-props": "^1.7.6", "oslo": "^1.2.1", "pg": "^8.13.0", @@ -124,8 +125,8 @@ "radix-svelte": "^0.9.0", "rate-limit-redis": "^4.2.0", "reflect-metadata": "^0.2.2", - "svelte-french-toast": "^1.2.0", "svelte-lazy-loader": "^1.0.0", + "svelte-sonner": "^0.3.28", "tailwind-merge": "^2.5.2", "tailwind-variants": "^0.2.1", "tailwindcss-animate": "^1.0.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index acfa118..ad331de 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -134,6 +134,9 @@ importers: loader: specifier: ^2.1.1 version: 2.1.1 + mode-watcher: + specifier: ^0.4.1 + version: 0.4.1(svelte@5.0.0-next.175) open-props: specifier: ^1.7.6 version: 1.7.6 @@ -158,12 +161,12 @@ importers: reflect-metadata: specifier: ^0.2.2 version: 0.2.2 - svelte-french-toast: - specifier: ^1.2.0 - version: 1.2.0(svelte@5.0.0-next.175) svelte-lazy-loader: specifier: ^1.0.0 version: 1.0.0 + svelte-sonner: + specifier: ^0.3.28 + version: 0.3.28(svelte@5.0.0-next.175) tailwind-merge: specifier: ^2.5.2 version: 2.5.2 @@ -3454,6 +3457,11 @@ packages: mlly@1.7.1: resolution: {integrity: sha512-rrVRZRELyQzrIUAVMHxP97kv+G786pHmOKzuFII8zDYahFBS7qnHh2AlYSl1GAHhaMPCz6/oHjVMcfFYgFYHgA==} + mode-watcher@0.4.1: + resolution: {integrity: sha512-bNC+1NXmwEFZtziCdZSgP7HFQTpqJPcQn9GwwJQGSf6SBF3neEPYV1uRwkYuAQwbsvsXIYtzaqgedDzJ7D1mhg==} + peerDependencies: + svelte: ^4.0.0 || ^5.0.0-next.1 + mri@1.2.0: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} engines: {node: '>=4'} @@ -4369,11 +4377,6 @@ packages: svelte: optional: true - svelte-french-toast@1.2.0: - resolution: {integrity: sha512-5PW+6RFX3xQPbR44CngYAP1Sd9oCq9P2FOox4FZffzJuZI2mHOB7q5gJBVnOiLF5y3moVGZ7u2bYt7+yPAgcEQ==} - peerDependencies: - svelte: ^3.57.0 || ^4.0.0 - svelte-headless-table@0.18.2: resolution: {integrity: sha512-dnDTaXW5CNzRUjHVbc/Hb0Zv80zU4VcIUnAja6OuZriXvim1AqcWYQCHPRzBGwqj1m3YEHHNvspSzY0o5HzA0A==} peerDependencies: @@ -4480,16 +4483,16 @@ packages: resolution: {integrity: sha512-DIFm0kSNscVxtBmKkBiygAHB5otoqN1aVmJ3t57jZhJfCB7Np/lUSoTtSrvPFjmlBbMeOsb1VQ06cut1+rBYOg==} engines: {node: '>=16'} + svelte-sonner@0.3.28: + resolution: {integrity: sha512-K3AmlySeFifF/cKgsYNv5uXqMVNln0NBAacOYgmkQStLa/UoU0LhfAACU6Gr+YYC8bOCHdVmFNoKuDbMEsppJg==} + peerDependencies: + svelte: ^3.0.0 || ^4.0.0 || ^5.0.0-next.1 + svelte-subscribe@2.0.1: resolution: {integrity: sha512-eKXIjLxB4C7eQWPqKEdxcGfNXm2g/qJ67zmEZK/GigCZMfrTR3m7DPY93R6MX+5uoqM1FRYxl8LZ1oy4URWi2A==} peerDependencies: svelte: ^4.0.0 - svelte-writable-derived@3.1.1: - resolution: {integrity: sha512-w4LR6/bYZEuCs7SGr+M54oipk/UQKtiMadyOhW0PTwAtJ/Ai12QS77sLngEcfBx2q4H8ZBQucc9ktSA5sUGZWw==} - peerDependencies: - svelte: ^3.2.1 || ^4.0.0-next.1 || ^5.0.0-next.94 - svelte@4.2.19: resolution: {integrity: sha512-IY1rnGr6izd10B0A8LqsBfmlT5OILVuZ7XsI0vdGPEvuonFV7NYEUK4dAkm9Zg2q0Um92kYjTpS1CAP3Nh/KWw==} engines: {node: '>=16'} @@ -7753,6 +7756,10 @@ snapshots: pkg-types: 1.2.0 ufo: 1.5.4 + mode-watcher@0.4.1(svelte@5.0.0-next.175): + dependencies: + svelte: 5.0.0-next.175 + mri@1.2.0: {} mrmime@2.0.0: {} @@ -8719,11 +8726,6 @@ snapshots: optionalDependencies: svelte: 5.0.0-next.175 - svelte-french-toast@1.2.0(svelte@5.0.0-next.175): - dependencies: - svelte: 5.0.0-next.175 - svelte-writable-derived: 3.1.1(svelte@5.0.0-next.175) - svelte-headless-table@0.18.2(svelte@5.0.0-next.175): dependencies: svelte: 5.0.0-next.175 @@ -8781,11 +8783,11 @@ snapshots: svelte: 4.2.19 tslib: 2.7.0 - svelte-subscribe@2.0.1(svelte@5.0.0-next.175): + svelte-sonner@0.3.28(svelte@5.0.0-next.175): dependencies: svelte: 5.0.0-next.175 - svelte-writable-derived@3.1.1(svelte@5.0.0-next.175): + svelte-subscribe@2.0.1(svelte@5.0.0-next.175): dependencies: svelte: 5.0.0-next.175 diff --git a/src/app.d.ts b/src/app.d.ts index 6ab483d..609d7c7 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -21,17 +21,12 @@ declare global { parseApiResponse: typeof parseApiResponse; getAuthedUser: () => Promise | null>; getAuthedUserOrThrow: () => Promise>; - auth: import('lucia').AuthRequest; - user: import('lucia').User | null; - session: import('lucia').Session | null; - startTimer: number; - ip: string; - country: string; - error: string; - errorId: string; - errorStackTrace: string; - message: unknown; - track: unknown; + } + namespace Superforms { + type Message = { + type: 'error' | 'success' | 'info', + text: string + } } interface Error { code?: string; diff --git a/src/app.html b/src/app.html index 936b6ea..ad66b45 100644 --- a/src/app.html +++ b/src/app.html @@ -6,40 +6,11 @@ - + %sveltekit.head% - -
%sveltekit.body%
+ +
%sveltekit.body%
diff --git a/src/lib/components/Header.svelte b/src/lib/components/Header.svelte index 4b3a06b..d0e912c 100644 --- a/src/lib/components/Header.svelte +++ b/src/lib/components/Header.svelte @@ -1,15 +1,14 @@
@@ -63,26 +62,7 @@ let avatar: string = $derived(user?.username?.slice(0, 1).toUpperCase() || ':)') -
{ - return async ({ result }) => { - console.log(result); - if (result.type === 'success' || result.type === 'redirect') { - toast.success('Logged Out'); - } else if (result.type === 'error') { - console.log(result); - toast.error(`Error: ${result.error.message}`); - } else { - toast.error(`Something went wrong.`); - console.log(result); - } - await invalidateAll(); - await applyAction(result); - }; - }} - action="/logout" - method="POST" - > +
diff --git a/src/routes/(app)/about/+page.svelte b/src/routes/(app)/about/+page.svelte index f2b6915..9dd3f37 100644 --- a/src/routes/(app)/about/+page.svelte +++ b/src/routes/(app)/about/+page.svelte @@ -6,7 +6,7 @@

About Bored Game

-

One day we were bored and wanted to play one of our board gamesTable.

+

One day we were bored and wanted to play one of our board games.

Our problem was that we didn't know which one to play.

Rather than just pick a game I decided to make this overcomplicated solution.

I hope you enjoy using it!

diff --git a/src/routes/(app)/search/+error.svelte b/src/routes/(app)/search/+error.svelte index 808e9a2..8e260a9 100644 --- a/src/routes/(app)/search/+error.svelte +++ b/src/routes/(app)/search/+error.svelte @@ -1,4 +1,4 @@ -

There was an error searching for gamesTable! 🤦

+

There was an error searching for games! 🤦

Please try again later. 🙇