mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
delay update action
This commit is contained in:
parent
e5dda9ab8b
commit
075743e8be
@ -56,6 +56,10 @@ class WebWrapper extends Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async updateDistApp() {
|
async updateDistApp() {
|
||||||
|
if (!fs.existsSync(WebWrapper.appDistPath)) {
|
||||||
|
await fs.promises.rm(WebWrapper.appDistPath, { recursive: true })
|
||||||
|
}
|
||||||
|
|
||||||
await Setup.setupLatestRelease({
|
await Setup.setupLatestRelease({
|
||||||
repository: WebWrapper.repoName,
|
repository: WebWrapper.repoName,
|
||||||
distCompressedFile: WebWrapper.distCompressedFile,
|
distCompressedFile: WebWrapper.distCompressedFile,
|
||||||
@ -88,13 +92,20 @@ class WebWrapper extends Server {
|
|||||||
return res.status(401).json({ error: "Invalid signature" })
|
return res.status(401).json({ error: "Invalid signature" })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (req.body.action !== "published") {
|
||||||
|
return res.status(400).json({ error: "Invalid action" })
|
||||||
|
}
|
||||||
|
|
||||||
|
// return ok and schedule update for the 30 seconds
|
||||||
console.log("[WEBHOOK] Update app dist triggered >", {
|
console.log("[WEBHOOK] Update app dist triggered >", {
|
||||||
sig: req.headers["x-hub-signature-256"],
|
sig: req.headers["x-hub-signature-256"],
|
||||||
})
|
})
|
||||||
|
|
||||||
await this.updateDistApp()
|
res.status(200).json({ ok: true })
|
||||||
|
|
||||||
return res.status(200).json({ ok: true })
|
setTimeout(async () => {
|
||||||
|
await this.updateDistApp()
|
||||||
|
}, 30000)
|
||||||
}
|
}
|
||||||
|
|
||||||
async onInitialize() {
|
async onInitialize() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user