Files
dragonroll/frontend/app/app.vue
Aran Roig 1402045001
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 1m51s
Foundry and discord bot
2026-10-11 22:26:29 +02:00

75 lines
2.3 KiB
Vue

<script setup lang="ts">
import ContentManager from './components/managers/ContentManager.vue';
import ToastManager from './components/managers/ToastManager.vue';
import WindowManager from './components/managers/WindowManager.vue';
import DiscordAuthorize from './components/views/DiscordAuthorize.vue';
import { CreateWindow } from '@/services/Windows'
import { GetUser, HasAdmin } from './services/User';
import TooltipManager from './components/managers/TooltipManager.vue';
import ContextMenuManager from './components/managers/ContextMenuManager.vue';
import { useCampaignService } from './services/Campaign';
const { RestoreCampaign } = useCampaignService();
// El bot de Discord enllaça amb aquesta pantalla; no és part de l'aplicació i no ha d'arrencar
// les finestres normals.
const requestUrl = useRequestURL();
const isDiscordAuthorize = computed(() => requestUrl.pathname.replace(/\/+$/, '') === '/discord/authorize');
async function start(){
if(GetUser()){
const restoredCampaign = await RestoreCampaign();
if (!restoredCampaign) {
CreateWindow('main_menu');
}
return;
}
if(await HasAdmin()){
CreateWindow('login');
} else {
CreateWindow('register', {firstTime: true});
}
// DisplayToast('aqua', 'All plugins loaded successfully');
}
useHead({
title: 'Dragonroll',
meta: [
{ name: 'description', content: 'Dragonroll is a free and open-source tabletop RPG virtual tabletop. It allows you to play your favorite pen-and-paper RPGs online with your friends, with features like character sheets, dice rolling, maps, tokens, and more.' },
{ name: 'keywords', content: 'virtual tabletop, vtt, online rpg, pen-and-paper rpg, dungeons and dragons, pathfinder, roll20 alternative' },
{ name: 'author', content: 'Aran Roig' },
],
})
onMounted(() => {
setupTheme();
setTheme('dark');
if(!isDiscordAuthorize.value){
start();
}
})
</script>
<template>
<DiscordAuthorize v-if="isDiscordAuthorize"></DiscordAuthorize>
<div v-else class="viewer">
<ToastManager></ToastManager>
<TooltipManager></TooltipManager>
<ContextMenuManager></ContextMenuManager>
<WindowManager></WindowManager>
<ContentManager></ContentManager>
<!-- Managers -->
</div>
</template>
<style scoped>
.viewer {
display: flex;
flex-direction: column;
width: 100%;
height: 100vh;
}
</style>