Add registration page, fix auth paths, and improve navigation
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user