feat: implement daily character guessing game with local storage and hint system
- Added character selection and history management using local storage. - Implemented hint system that unlocks based on the number of guesses. - Enhanced UI with animations for hint unlocks and special win conditions. - Created a server endpoint to record wins in the database.
This commit is contained in:
@@ -1,8 +1,36 @@
|
||||
import type { Handle } from '@sveltejs/kit';
|
||||
import { building } from '$app/environment';
|
||||
import { auth } from '$lib/server/auth';
|
||||
import { getDailyModeCharacters, getOrCreateTodayCharacter } from '$lib/server/daily-character';
|
||||
import { svelteKitHandler } from 'better-auth/svelte-kit';
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line no-var
|
||||
var __dailyCharacterSchedulerStarted: boolean | undefined;
|
||||
}
|
||||
|
||||
async function runDailyCharacterSchedulerJob() {
|
||||
try {
|
||||
const characters = await getDailyModeCharacters();
|
||||
if (characters.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
await getOrCreateTodayCharacter(characters);
|
||||
} catch (error) {
|
||||
console.error('Daily character scheduler failed:', error);
|
||||
}
|
||||
}
|
||||
|
||||
if (!building && !globalThis.__dailyCharacterSchedulerStarted) {
|
||||
globalThis.__dailyCharacterSchedulerStarted = true;
|
||||
|
||||
void runDailyCharacterSchedulerJob();
|
||||
setInterval(() => {
|
||||
void runDailyCharacterSchedulerJob();
|
||||
}, 60_000);
|
||||
}
|
||||
|
||||
const handleBetterAuth: Handle = async ({ event, resolve }) => {
|
||||
const session = await auth.api.getSession({ headers: event.request.headers });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user