added systemd service howto traefik nginix set_real_ip_from improved readme visuals fixed on mobile labels removed updated readme fixed visuals overlay for the hotkey disable screen lock clean up git precommit hooks clean up clean up update check for update feature added build-time information fixed date clean up added hook script fix fix fix hooks fixed webhook setup players stay in run all timers mode mqtt mqtt allways connected mqtt messages work capturing mqtt in edit player mqtt in Setup updated readme state of the mqtt Global Pass turn offline mode docs: update documentation to reflect current codebase and MQTT features - Update README.md with global MQTT commands - Enhance architecture.md with comprehensive data model and MQTT state - Update development.md with project structure and workflow - Remove redundant script listings - Fix formatting and organization rebase
59 lines
1.9 KiB
JavaScript
59 lines
1.9 KiB
JavaScript
import { createRouter, createWebHistory } from 'vue-router';
|
|
import SetupView from '../views/SetupView.vue';
|
|
import GameView from '../views/GameView.vue';
|
|
import InfoView from '../views/InfoView.vue';
|
|
import store from '../store';
|
|
|
|
const routes = [
|
|
{
|
|
path: '/',
|
|
name: 'Setup',
|
|
component: SetupView,
|
|
beforeEnter: (to, from, next) => {
|
|
// Check if we are navigating FROM the Game view.
|
|
// If so, the user explicitly clicked the Setup button, so allow it.
|
|
if (from.name === 'Game') {
|
|
console.log('Router Guard: Allowing navigation from Game to Setup.');
|
|
next(); // Allow navigation to Setup
|
|
return; // Stop further processing of this guard
|
|
}
|
|
|
|
// Original logic for initial load or other navigations TO Setup:
|
|
if (store.state.players && store.state.players.length >= 2) {
|
|
// If 2 or more players exist (and not coming from Game), redirect to Game.
|
|
console.log('Router Guard: Players found, redirecting to Game (not coming from Game).');
|
|
next({ name: 'Game', replace: true });
|
|
} else {
|
|
// Otherwise (fewer than 2 players), allow navigation to the Setup view.
|
|
console.log('Router Guard: Not enough players, proceeding to Setup.');
|
|
next();
|
|
}
|
|
}
|
|
},
|
|
{
|
|
path: '/game',
|
|
name: 'Game',
|
|
component: GameView,
|
|
beforeEnter: (to, from, next) => {
|
|
// Keep this guard: prevent direct access to /game without enough players
|
|
if (!store.state.players || store.state.players.length < 2) {
|
|
console.log('Router Guard: Attempted to access Game without enough players, redirecting to Setup.');
|
|
next({ name: 'Setup' });
|
|
} else {
|
|
next();
|
|
}
|
|
}
|
|
},
|
|
{
|
|
path: '/info',
|
|
name: 'Info',
|
|
component: InfoView
|
|
}
|
|
];
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(import.meta.env.BASE_URL),
|
|
routes
|
|
});
|
|
|
|
export default router; |