only call keepGUIAlive when run as gui
This commit is contained in:
@@ -9,6 +9,7 @@ import { fileState, toastState } from './store/Atoms'
|
||||
import { keepGUIAlive } from './utils'
|
||||
import Header from './components/Header/Header'
|
||||
import useHotKey from './hooks/useHotkey'
|
||||
import { isDesktop } from './adapters/inpainting'
|
||||
|
||||
const SUPPORTED_FILE_TYPE = [
|
||||
'image/jpeg',
|
||||
@@ -18,9 +19,6 @@ const SUPPORTED_FILE_TYPE = [
|
||||
'image/tiff',
|
||||
]
|
||||
|
||||
// Keeping GUI Window Open
|
||||
keepGUIAlive()
|
||||
|
||||
function App() {
|
||||
const [file, setFile] = useRecoilState(fileState)
|
||||
const [theme, setTheme] = useRecoilState(themeState)
|
||||
@@ -34,6 +32,17 @@ function App() {
|
||||
setFile(userInputImage)
|
||||
}, [userInputImage, setFile])
|
||||
|
||||
// Keeping GUI Window Open
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
const isRunDesktop = await isDesktop().then(res => res.text())
|
||||
if (isRunDesktop === 'True') {
|
||||
keepGUIAlive()
|
||||
}
|
||||
}
|
||||
fetchData()
|
||||
}, [])
|
||||
|
||||
// Dark Mode Hotkey
|
||||
useHotKey(
|
||||
'shift+d',
|
||||
|
||||
@@ -102,6 +102,12 @@ export function currentModel() {
|
||||
})
|
||||
}
|
||||
|
||||
export function isDesktop() {
|
||||
return fetch(`${API_ENDPOINT}/is_desktop`, {
|
||||
method: 'GET',
|
||||
})
|
||||
}
|
||||
|
||||
export function modelDownloaded(name: string) {
|
||||
return fetch(`${API_ENDPOINT}/model_downloaded/${name}`, {
|
||||
method: 'GET',
|
||||
|
||||
Reference in New Issue
Block a user