mirror of
https://github.com/yuzu-emu/liftinstall.git
synced 2024-11-22 12:05:42 +01:00
ui: mock-server: can now simulate other modes...
... like maintenance mode and launcher mode
This commit is contained in:
parent
3ce4504a5b
commit
01419e5da4
@ -5,6 +5,8 @@ const app = express()
|
|||||||
const port = 3000
|
const port = 3000
|
||||||
|
|
||||||
let showError = false
|
let showError = false
|
||||||
|
let maintenance = false
|
||||||
|
let launcher = false
|
||||||
|
|
||||||
function progressSimulation (res) {
|
function progressSimulation (res) {
|
||||||
if (showError) {
|
if (showError) {
|
||||||
@ -22,7 +24,7 @@ function progressSimulation (res) {
|
|||||||
res.status(200).end()
|
res.status(200).end()
|
||||||
clearInterval(timer)
|
clearInterval(timer)
|
||||||
}
|
}
|
||||||
}, 1500)
|
}, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
function returnConfig (res) {
|
function returnConfig (res) {
|
||||||
@ -78,8 +80,8 @@ app.get('/api/installation-status', (req, res) => {
|
|||||||
res.json({
|
res.json({
|
||||||
database: { packages: [], shortcuts: [] },
|
database: { packages: [], shortcuts: [] },
|
||||||
install_path: null,
|
install_path: null,
|
||||||
preexisting_install: false,
|
preexisting_install: maintenance,
|
||||||
is_launcher: false,
|
is_launcher: launcher,
|
||||||
launcher_path: null
|
launcher_path: null
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -95,7 +97,7 @@ app.get('/api/config', (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
app.post('/api/start-install', (req, res) => {
|
app.post('/api/start-install', (req, res) => {
|
||||||
console.log(`-- Install: ${req.body}`)
|
console.log(`-- Install: ${req}`)
|
||||||
progressSimulation(res)
|
progressSimulation(res)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -105,7 +107,7 @@ app.get('/api/exit', (req, res) => {
|
|||||||
res.status(500).send('Simulated error: Nothing to see here.')
|
res.status(500).send('Simulated error: Nothing to see here.')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
res.status(204)
|
res.status(204).send()
|
||||||
})
|
})
|
||||||
|
|
||||||
app.get('/api/mock_error', (req, res) => {
|
app.get('/api/mock_error', (req, res) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user