mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-19 01:31:34 +00:00
Updated lolisafe.js
Forgot to update this to take into account the changes in Cloudflare's cache purge utility.
This commit is contained in:
parent
d5c24165cf
commit
e479ac53ff
18
lolisafe.js
18
lolisafe.js
@ -204,10 +204,22 @@ const start = async () => {
|
|||||||
if (config.cacheControl) {
|
if (config.cacheControl) {
|
||||||
process.stdout.write('Cache control enabled. Purging Cloudflare\'s cache ...')
|
process.stdout.write('Cache control enabled. Purging Cloudflare\'s cache ...')
|
||||||
const routes = config.pages.concat(['api/check'])
|
const routes = config.pages.concat(['api/check'])
|
||||||
const result = await utils.purgeCloudflareCache(routes)
|
const results = await utils.purgeCloudflareCache(routes)
|
||||||
process.stdout.write(` ${result.errors.length ? 'ERROR' : `${result.files.length} OK`}!\n`)
|
let errored = false
|
||||||
if (result.errors.length)
|
let succeeded = 0
|
||||||
|
for (const result of results) {
|
||||||
|
if (!result.errors.length) {
|
||||||
|
if (!errored) {
|
||||||
|
errored = true
|
||||||
|
process.stdout.write(' ERROR!\n')
|
||||||
|
}
|
||||||
result.errors.forEach(error => console.log(`CF: ${error}`))
|
result.errors.forEach(error => console.log(`CF: ${error}`))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
succeeded += result.files.length
|
||||||
|
}
|
||||||
|
if (!errored)
|
||||||
|
process.stdout.write(` ${succeeded} OK!\n`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NODE_ENV=development yarn start
|
// NODE_ENV=development yarn start
|
||||||
|
Loading…
Reference in New Issue
Block a user