Add registration page, fix auth paths, and improve navigation

This commit is contained in:
Torsten Schulz (local)
2025-10-21 11:31:43 +02:00
parent 2b249577a7
commit f058516a3d
86 changed files with 2914 additions and 531 deletions

View File

@@ -2,10 +2,25 @@ import bcrypt from 'bcryptjs'
import jwt from 'jsonwebtoken'
import { promises as fs } from 'fs'
import path from 'path'
import { fileURLToPath } from 'url'
const JWT_SECRET = process.env.JWT_SECRET || 'harheimertc-secret-key-change-in-production'
const USERS_FILE = path.join(process.cwd(), 'server/data/users.json')
const SESSIONS_FILE = path.join(process.cwd(), 'server/data/sessions.json')
// Handle both dev and production paths
const getDataPath = (filename) => {
const cwd = process.cwd()
// In production (.output/server), working dir is .output
if (cwd.endsWith('.output')) {
return path.join(cwd, '../server/data', filename)
}
// In development, working dir is project root
return path.join(cwd, 'server/data', filename)
}
const USERS_FILE = getDataPath('users.json')
const SESSIONS_FILE = getDataPath('sessions.json')
// Read users from file
export async function readUsers() {