Added desktop application mode

Run lama-cleaner as a desktop application.
This commit is contained in:
blessedcoolant
2022-03-24 05:07:33 +13:00
parent 1207b6e291
commit 44e131f9ac
9 changed files with 58 additions and 12 deletions

View File

@@ -6,6 +6,27 @@ import FileSelect from './components/FileSelect'
import ShortcutsModal from './components/ShortcutsModal'
import Editor from './Editor'
// Keeping GUI Window Open
async function getRequest(url = '') {
const response = await fetch(url, {
method: 'GET',
cache: 'no-cache',
})
return response.json()
}
if (!process.env.NODE_ENV || process.env.NODE_ENV === 'production') {
document.addEventListener('DOMContentLoaded', function () {
const url = document.location
const route = '/flaskwebgui-keep-server-alive'
const intervalRequest = 3 * 1000
function keepAliveServer() {
getRequest(url + route).then(data => console.log(data))
}
setInterval(keepAliveServer, intervalRequest)
})
}
function App() {
const [file, setFile] = useState<File>()
const [showShortcuts, toggleShowShortcuts] = useToggle(false)