mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-02-21 20:59:04 +00:00
parent
afa09b0312
commit
defa3f2a8c
@ -874,7 +874,6 @@ self.stats = async (req, res, next) => {
|
|||||||
|
|
||||||
const albums = await db.table('albums')
|
const albums = await db.table('albums')
|
||||||
stats[data.title].Total = albums.length
|
stats[data.title].Total = albums.length
|
||||||
const identifiers = []
|
|
||||||
for (const album of albums) {
|
for (const album of albums) {
|
||||||
if (!album.enabled) {
|
if (!album.enabled) {
|
||||||
stats[data.title].Disabled++
|
stats[data.title].Disabled++
|
||||||
@ -882,19 +881,9 @@ self.stats = async (req, res, next) => {
|
|||||||
}
|
}
|
||||||
if (album.download) stats[data.title].Downloadable++
|
if (album.download) stats[data.title].Downloadable++
|
||||||
if (album.public) stats[data.title].Public++
|
if (album.public) stats[data.title].Public++
|
||||||
if (album.zipGeneratedAt) identifiers.push(album.identifier)
|
if (album.zipGeneratedAt) stats[data.title]['ZIP Generated']++
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(identifiers.map(async identifier => {
|
|
||||||
try {
|
|
||||||
await paths.access(path.join(paths.zips, `${identifier}.zip`))
|
|
||||||
stats[data.title]['ZIP Generated']++
|
|
||||||
} catch (error) {
|
|
||||||
// Re-throw error
|
|
||||||
if (error.code !== 'ENOENT') throw error
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
|
|
||||||
// Update cache
|
// Update cache
|
||||||
data.cache = stats[data.title]
|
data.cache = stats[data.title]
|
||||||
data.generating = false
|
data.generating = false
|
||||||
|
Loading…
Reference in New Issue
Block a user