mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
Updating all dependencies and moving throw errors outside try catches.
This commit is contained in:
parent
3997e4e49b
commit
d13484a105
9 changed files with 741 additions and 683 deletions
1
.nvmrc
Normal file
1
.nvmrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
v20
|
||||
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
|
|
@ -14,7 +17,8 @@
|
|||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"name": "Launch browser",
|
||||
"url": "http://localhost:5173",
|
||||
"url": "http://127.0.0.1:5173",
|
||||
"runtimeExecutable": "/home/bshellnu/.local/share/flatpak/app/org.chromium.Chromium/current/active/files/chromium/chrome",
|
||||
"webRoot": "${workspaceFolder}"
|
||||
}
|
||||
],
|
||||
|
|
@ -24,4 +28,4 @@
|
|||
"configurations": ["Launch server", "Launch browser"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
32
.xdp-env-UKroot
Normal file
32
.xdp-env-UKroot
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Private
|
||||
|
||||
AXIOM_TOKEN=xaat-477c7668-072d-4da9-9e41-0fdf5a999ef8
|
||||
AXIOM_ORG_ID=BradNut
|
||||
AXIOM_DATASET=borederrors
|
||||
|
||||
#DATABASE_URL='mysql://ll7h5x369omo11gan1ar:pscale_pw_E3inO2kdASFczJiAcnjybehxUmlePaYyGO5qN51Qi6l@aws.connect.psdb.cloud/nut-shells?sslaccept=strict'
|
||||
|
||||
DATABASE_URL='mysql://root:@localhost:3036/nut-shells'
|
||||
|
||||
## Sentry
|
||||
|
||||
SENTRY_ORG='shellnut'
|
||||
SENTRY_PROJECT='javascript-sveltekit'
|
||||
SENTRY_AUTH_TOKEN='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'
|
||||
|
||||
# Public
|
||||
|
||||
PUBLIC_UMAMI_DO_NOT_TRACK=true
|
||||
PUBLIC_UMAMI_URL=https://umami-theta-one.vercel.app/script.js
|
||||
PUBLIC_UMAMI_ID=018f0b50-6ed9-49d2-a7b6-4c74b6439dbb
|
||||
|
||||
# quick setting for key-combo only
|
||||
SVELTE_INSPECTOR_TOGGLE=control-shift-i
|
||||
|
||||
# This was inserted by `prisma init`:
|
||||
# Environment variables declared in this file are automatically made available to Prisma.
|
||||
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
|
||||
|
||||
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
|
||||
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
|
||||
|
||||
58
package.json
58
package.json
|
|
@ -27,43 +27,43 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@melt-ui/pp": "^0.1.4",
|
||||
"@playwright/test": "^1.37.0",
|
||||
"@playwright/test": "^1.40.1",
|
||||
"@resvg/resvg-js": "^2.4.1",
|
||||
"@sveltejs/adapter-auto": "^2.1.1",
|
||||
"@sveltejs/adapter-vercel": "^3.0.3",
|
||||
"@sveltejs/kit": "^1.27.5",
|
||||
"@types/cookie": "^0.5.1",
|
||||
"@types/node": "^18.17.5",
|
||||
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
||||
"@typescript-eslint/parser": "^6.10.0",
|
||||
"@sveltejs/adapter-vercel": "^3.1.0",
|
||||
"@sveltejs/kit": "^1.27.6",
|
||||
"@types/cookie": "^0.5.4",
|
||||
"@types/node": "^18.19.2",
|
||||
"@typescript-eslint/eslint-plugin": "^6.13.2",
|
||||
"@typescript-eslint/parser": "^6.13.2",
|
||||
"autoprefixer": "^10.4.15",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-svelte": "^2.35.0",
|
||||
"eslint": "^8.55.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-svelte": "^2.35.1",
|
||||
"just-clone": "^6.2.0",
|
||||
"just-debounce-it": "^3.2.0",
|
||||
"postcss": "^8.4.31",
|
||||
"postcss": "^8.4.32",
|
||||
"postcss-import": "^15.1.0",
|
||||
"postcss-load-config": "^4.0.1",
|
||||
"postcss-load-config": "^4.0.2",
|
||||
"postcss-preset-env": "^9.3.0",
|
||||
"prettier": "^3.0.3",
|
||||
"prettier-plugin-svelte": "^3.1.0",
|
||||
"prisma": "^5.3.1",
|
||||
"prettier": "^3.1.0",
|
||||
"prettier-plugin-svelte": "^3.1.2",
|
||||
"prisma": "^5.6.0",
|
||||
"sass": "^1.65.1",
|
||||
"satori": "^0.10.4",
|
||||
"satori": "^0.10.11",
|
||||
"satori-html": "^0.3.2",
|
||||
"svelte": "^4.2.3",
|
||||
"svelte-check": "^3.6.0",
|
||||
"svelte": "^4.2.8",
|
||||
"svelte-check": "^3.6.2",
|
||||
"svelte-meta-tags": "^3.1.0",
|
||||
"svelte-preprocess": "^5.1.0",
|
||||
"svelte-preprocess": "^5.1.1",
|
||||
"svelte-sequential-preprocessor": "^2.0.1",
|
||||
"sveltekit-flash-message": "^2.2.1",
|
||||
"sveltekit-superforms": "^1.10.1",
|
||||
"tailwindcss": "^3.3.3",
|
||||
"sveltekit-flash-message": "^2.2.2",
|
||||
"sveltekit-superforms": "^1.11.0",
|
||||
"tailwindcss": "^3.3.6",
|
||||
"ts-node": "^10.9.1",
|
||||
"tslib": "^2.6.1",
|
||||
"typescript": "^5.1.6",
|
||||
"vite": "^4.4.9",
|
||||
"typescript": "^5.3.2",
|
||||
"vite": "^4.5.1",
|
||||
"vitest": "^0.34.6",
|
||||
"zod": "^3.22.4"
|
||||
},
|
||||
|
|
@ -81,9 +81,9 @@
|
|||
"@lukeed/uuid": "^2.0.1",
|
||||
"@melt-ui/svelte": "^0.57.3",
|
||||
"@paralleldrive/cuid2": "^2.2.2",
|
||||
"@prisma/client": "^5.3.1",
|
||||
"@sentry/sveltekit": "^7.80.0",
|
||||
"@types/feather-icons": "^4.29.1",
|
||||
"@prisma/client": "^5.6.0",
|
||||
"@sentry/sveltekit": "^7.85.0",
|
||||
"@types/feather-icons": "^4.29.4",
|
||||
"@vercel/og": "^0.5.13",
|
||||
"bits-ui": "^0.0.27",
|
||||
"boardgamegeekclient": "^1.9.1",
|
||||
|
|
@ -98,13 +98,13 @@
|
|||
"loader": "^2.1.1",
|
||||
"lucia": "^2.7.4",
|
||||
"lucide-svelte": "^0.256.1",
|
||||
"open-props": "^1.5.13",
|
||||
"open-props": "^1.6.13",
|
||||
"radix-svelte": "^0.9.0",
|
||||
"svelte-french-toast": "^1.2.0",
|
||||
"svelte-lazy-loader": "^1.0.0",
|
||||
"tailwind-merge": "^1.14.0",
|
||||
"tailwind-variants": "^0.1.18",
|
||||
"tailwindcss-animate": "^1.0.6",
|
||||
"zod-to-json-schema": "^3.21.4"
|
||||
"zod-to-json-schema": "^3.22.1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1160
pnpm-lock.yaml
1160
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
|
@ -1,9 +1,9 @@
|
|||
import { type Actions, error, fail, redirect } from "@sveltejs/kit";
|
||||
import { type Actions, error, fail, redirect } from '@sveltejs/kit';
|
||||
import { superValidate } from 'sveltekit-superforms/server';
|
||||
import prisma from '$lib/prisma';
|
||||
import { modifyListGameSchema, type ListGame } from '$lib/config/zod-schemas.js';
|
||||
import { search_schema } from '$lib/zodValidation.js';
|
||||
import type { PageServerLoad } from "./$types";
|
||||
import type { PageServerLoad } from './$types';
|
||||
|
||||
export const load: PageServerLoad = async ({ fetch, url, locals }) => {
|
||||
const session = await locals.auth.validate();
|
||||
|
|
@ -103,48 +103,46 @@ export const actions: Actions = {
|
|||
const { params, locals, request } = event;
|
||||
const form = await superValidate(event, modifyListGameSchema);
|
||||
|
||||
try {
|
||||
const session = await locals.auth.validate();
|
||||
if (!session) {
|
||||
throw redirect(302, '/login');
|
||||
}
|
||||
const session = await locals.auth.validate();
|
||||
if (!session) {
|
||||
throw redirect(302, '/login');
|
||||
}
|
||||
|
||||
let game = await prisma.game.findUnique({
|
||||
let game = await prisma.game.findUnique({
|
||||
where: {
|
||||
id: form.data.id
|
||||
}
|
||||
});
|
||||
|
||||
if (!game) {
|
||||
// game = await prisma.game.create({
|
||||
// data: {
|
||||
// name: form.name
|
||||
// }
|
||||
// });
|
||||
console.log('game not found');
|
||||
throw redirect(302, '/404');
|
||||
}
|
||||
|
||||
try {
|
||||
const collection = await prisma.collection.findUnique({
|
||||
where: {
|
||||
id: form.data.id
|
||||
user_id: session.user.userId
|
||||
}
|
||||
});
|
||||
|
||||
if (!game) {
|
||||
// game = await prisma.game.create({
|
||||
// data: {
|
||||
// name: form.name
|
||||
// }
|
||||
// });
|
||||
console.log('game not found');
|
||||
throw redirect(302, '/404');
|
||||
if (!collection) {
|
||||
console.log('Wishlist not found');
|
||||
return error(404, 'Wishlist not found');
|
||||
}
|
||||
|
||||
if (game) {
|
||||
const collection = await prisma.collection.findUnique({
|
||||
where: {
|
||||
user_id: session.user.userId
|
||||
}
|
||||
});
|
||||
|
||||
if (!collection) {
|
||||
console.log('Wishlist not found');
|
||||
return error(404, 'Wishlist not found');
|
||||
await prisma.collectionItem.create({
|
||||
data: {
|
||||
game_id: game.id,
|
||||
collection_id: collection.id,
|
||||
times_played: 0
|
||||
}
|
||||
|
||||
await prisma.collectionItem.create({
|
||||
data: {
|
||||
game_id: game.id,
|
||||
collection_id: collection.id,
|
||||
times_played: 0
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
form
|
||||
|
|
@ -175,47 +173,40 @@ export const actions: Actions = {
|
|||
const { params, locals, request } = event;
|
||||
const form = await superValidate(event, modifyListGameSchema);
|
||||
|
||||
try {
|
||||
const session = await locals.auth.validate();
|
||||
if (!session) {
|
||||
throw redirect(302, '/login');
|
||||
}
|
||||
const session = await locals.auth.validate();
|
||||
if (!session) {
|
||||
throw redirect(302, '/login');
|
||||
}
|
||||
|
||||
let game = await prisma.game.findUnique({
|
||||
let game = await prisma.game.findUnique({
|
||||
where: {
|
||||
id: form.data.id
|
||||
}
|
||||
});
|
||||
|
||||
if (!game) {
|
||||
console.log('game not found');
|
||||
throw redirect(302, '/404');
|
||||
}
|
||||
|
||||
try {
|
||||
const collection = await prisma.collection.findUnique({
|
||||
where: {
|
||||
id: form.data.id
|
||||
user_id: session.user.userId
|
||||
}
|
||||
});
|
||||
|
||||
if (!game) {
|
||||
// game = await prisma.game.create({
|
||||
// data: {
|
||||
// name: form.name
|
||||
// }
|
||||
// });
|
||||
console.log('game not found');
|
||||
throw redirect(302, '/404');
|
||||
if (!collection) {
|
||||
console.log('Collection not found');
|
||||
return error(404, 'Collection not found');
|
||||
}
|
||||
|
||||
if (game) {
|
||||
const collection = await prisma.collection.findUnique({
|
||||
where: {
|
||||
user_id: session.user.userId
|
||||
}
|
||||
});
|
||||
|
||||
if (!collection) {
|
||||
console.log('Wishlist not found');
|
||||
return error(404, 'Wishlist not found');
|
||||
await prisma.collectionItem.delete({
|
||||
where: {
|
||||
collection_id: collection.id,
|
||||
game_id: game.id
|
||||
}
|
||||
|
||||
await prisma.collectionItem.delete({
|
||||
where: {
|
||||
collection_id: collection.id,
|
||||
game_id: game.id
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
form
|
||||
|
|
|
|||
|
|
@ -13,26 +13,20 @@ const signInSchema = userSchema.pick({
|
|||
|
||||
export const load: PageServerLoad = async (event) => {
|
||||
const form = await superValidate(event, signInSchema);
|
||||
try {
|
||||
console.log('login load event', event);
|
||||
const session = await event.locals.auth.validate();
|
||||
if (session) {
|
||||
const message = { type: 'info', message: 'You are already signed in' };
|
||||
throw redirect('/', message, event);
|
||||
}
|
||||
return {
|
||||
form
|
||||
};
|
||||
} catch (e) {
|
||||
fail(500, {
|
||||
form
|
||||
});
|
||||
|
||||
console.log('login load event', event);
|
||||
const session = await event.locals.auth.validate();
|
||||
if (session) {
|
||||
const message = { type: 'info', message: 'You are already signed in' } as const;
|
||||
throw redirect('/', message, event);
|
||||
}
|
||||
return {
|
||||
form
|
||||
};
|
||||
};
|
||||
|
||||
export const actions: Actions = {
|
||||
default: async (event) => {
|
||||
const { locals } = event;
|
||||
const form = await superValidate(event, signInSchema);
|
||||
|
||||
if (!form.valid) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {fail, error, type Actions} from '@sveltejs/kit';
|
||||
import {fail, error, type Actions, redirect} from '@sveltejs/kit';
|
||||
import { superValidate } from 'sveltekit-superforms/server';
|
||||
import { LuciaError } from 'lucia';
|
||||
import type { PageServerLoad } from './$types';
|
||||
|
|
@ -42,7 +42,7 @@ export const load: PageServerLoad = async (event) => {
|
|||
export const actions: Actions = {
|
||||
default: async (event) => {
|
||||
const form = await superValidate<typeof signUpSchema, Message>(event, signUpSchema);
|
||||
|
||||
debugger;
|
||||
if (!form.valid) {
|
||||
form.data.password = '';
|
||||
form.data.confirm_password = '';
|
||||
|
|
@ -63,7 +63,7 @@ export const actions: Actions = {
|
|||
password: form.data.password
|
||||
},
|
||||
attributes: {
|
||||
email: form.data.email || '',
|
||||
email: form.data.email || null,
|
||||
username: form.data.username,
|
||||
firstName: form.data.firstName || '',
|
||||
lastName: form.data.lastName || '',
|
||||
|
|
@ -93,8 +93,6 @@ export const actions: Actions = {
|
|||
attributes: {}
|
||||
});
|
||||
event.locals.auth.setSession(session);
|
||||
// const message = { type: 'success', message: 'Signed Up!' } as const;
|
||||
// throw flashRedirect(message, event);
|
||||
} catch (e) {
|
||||
if (e instanceof LuciaError && e.message.toUpperCase() === `DUPLICATE_KEY_ID`) {
|
||||
// key already exists
|
||||
|
|
@ -109,5 +107,8 @@ export const actions: Actions = {
|
|||
form.data.confirm_password = '';
|
||||
throw error(500, message);
|
||||
}
|
||||
throw redirect(302, '/');
|
||||
// const message = { type: 'success', message: 'Signed Up!' } as const;
|
||||
// throw flashRedirect(message, event);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { slide } from 'svelte/transition';
|
||||
import { quintIn } from 'svelte/easing';
|
||||
import { superForm } from 'sveltekit-superforms/client';
|
||||
|
|
|
|||
Loading…
Reference in a new issue