mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-30 04:50:04 +00:00
[Electron] Add electron-specific setup page (#1444)
* Add dummy server start view * Do external nav * nit * nit * nit * nit
This commit is contained in:
@@ -1,8 +1,15 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import {
|
||||
createRouter,
|
||||
createWebHashHistory,
|
||||
createWebHistory
|
||||
} from 'vue-router'
|
||||
import LayoutDefault from '@/views/layouts/LayoutDefault.vue'
|
||||
import { isElectron } from './utils/envUtil'
|
||||
|
||||
const isFileProtocol = () => window.location.protocol === 'file:'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(window.location.pathname),
|
||||
history: isFileProtocol() ? createWebHashHistory() : createWebHistory(),
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
@@ -10,7 +17,21 @@ const router = createRouter({
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'GraphView',
|
||||
component: () => import('@/views/GraphView.vue')
|
||||
},
|
||||
{
|
||||
path: 'server-start',
|
||||
name: 'ServerStartView',
|
||||
component: () => import('@/views/ServerStartView.vue'),
|
||||
beforeEnter: async (to, from, next) => {
|
||||
// Only allow access to this page in electron environment
|
||||
if (isElectron()) {
|
||||
next()
|
||||
} else {
|
||||
next('/')
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
3
src/utils/envUtil.ts
Normal file
3
src/utils/envUtil.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export function isElectron() {
|
||||
return 'electronAPI' in window && window['electronAPI'] !== undefined
|
||||
}
|
||||
17
src/views/ServerStartView.vue
Normal file
17
src/views/ServerStartView.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<!-- This is a dummy page built for electron app only. -->
|
||||
<!-- Replace this page with the electron side logic on installation & log streaming. -->
|
||||
<template>
|
||||
<div
|
||||
class="absolute inset-0 flex flex-col items-center justify-center h-screen bg-surface-0"
|
||||
>
|
||||
<ProgressSpinner class="w-16 h-16 mb-4" />
|
||||
<div class="text-xl">{{ $t('loading') }}{{ counter }}</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ProgressSpinner from 'primevue/progressspinner'
|
||||
import { useInterval } from '@vueuse/core'
|
||||
|
||||
const counter = useInterval(1000)
|
||||
</script>
|
||||
Reference in New Issue
Block a user