Files
game-timer/js/config.js
2025-03-30 22:51:35 +02:00

48 lines
1.7 KiB
JavaScript

// config.js
import { getEnv } from './env-loader.js';
export function getPublicVapidKey() {
// Get the VAPID key from environment variables through the env-loader
return getEnv('PUBLIC_VAPID_KEY', 'BKfRJXjSQmAJ452gLwlK_8scGrW6qMU1mBRp39ONtcQHkSsQgmLAaODIyGbgHyRpnDEv3HfXV1oGh3SC0fHxY0E');
}
// The VAPID key should not be exposed directly in the source code
// Use the getter function instead: getPublicVapidKey()
// export const PUBLIC_VAPID_KEY = 'BKfRJXjSQmAJ452gLwlK_8scGrW6qMU1mBRp39ONtcQHkSsQgmLAaODIyGbgHyRpnDEv3HfXV1oGh3SC0fHxY0E';
// Get backend URL from environment variables
export const BACKEND_URL = getEnv('BACKEND_URL', 'https://webpush.virtonline.eu');
export const FLIC_BUTTON_ID = 'game-button'; // Example ID, might need configuration
export const LOCAL_STORAGE_KEY = 'gameTimerData';
// Default player settings
export const DEFAULT_PLAYER_TIME_SECONDS = 300; // 5 minutes
export const DEFAULT_PLAYERS = [
{ id: 1, name: 'Player 1', timeInSeconds: DEFAULT_PLAYER_TIME_SECONDS, remainingTime: DEFAULT_PLAYER_TIME_SECONDS, image: null },
{ id: 2, name: 'Player 2', timeInSeconds: DEFAULT_PLAYER_TIME_SECONDS, remainingTime: DEFAULT_PLAYER_TIME_SECONDS, image: null }
];
// CSS Classes (optional, but can help consistency)
export const CSS_CLASSES = {
ACTIVE_PLAYER: 'active-player',
INACTIVE_PLAYER: 'inactive-player',
TIMER_ACTIVE: 'timer-active',
TIMER_FINISHED: 'timer-finished',
MODAL_ACTIVE: 'active',
CAMERA_ACTIVE: 'active'
};
// Game States
export const GAME_STATES = {
SETUP: 'setup',
RUNNING: 'running',
PAUSED: 'paused',
OVER: 'over'
};
// Flic Actions
export const FLIC_ACTIONS = {
SINGLE_CLICK: 'SingleClick',
DOUBLE_CLICK: 'DoubleClick',
HOLD: 'Hold'
};