68 lines
1.9 KiB
Vue
68 lines
1.9 KiB
Vue
<script setup>
|
|
import ContentManager from '../managers/ContentManager.vue';
|
|
import ToastManager from '../managers/ToastManager.vue';
|
|
import WindowManager from '../managers/WindowManager.vue';
|
|
import ServiceLinkAuthorize from './ServiceLinkAuthorize.vue';
|
|
|
|
import { CreateWindow } from '@/services/Windows'
|
|
import { GetUser, HasAdmin } from '@/services/User';
|
|
import TooltipManager from '../managers/TooltipManager.vue';
|
|
import ContextMenuManager from '../managers/ContextMenuManager.vue';
|
|
import { useCampaignService } from '@/services/Campaign';
|
|
|
|
const { RestoreCampaign } = useCampaignService();
|
|
|
|
// Els serveis (Discord, Foundry, Obsidian) enllacen amb aquesta pantalla única; no són part
|
|
// de l'aplicació i no han d'arrencar les finestres normals. La ruta antiga de Discord també
|
|
// hi porta, perquè els enllaços que ja corren per Discord no queden morts.
|
|
const requestUrl = useRequestURL();
|
|
const isServiceLink = computed(() => {
|
|
const path = requestUrl.pathname.replace(/\/+$/, '');
|
|
return path === '/link/authorize' || path === '/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');
|
|
}
|
|
|
|
onMounted(() => {
|
|
if(!isServiceLink.value){
|
|
start();
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<ServiceLinkAuthorize v-if="isServiceLink"></ServiceLinkAuthorize>
|
|
<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>
|