mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-02-21 20:59:04 +00:00
feat: added audios count to uploads stats
As always, this uses hardcoded whitelisted audio extensions (the ones that are also internally used for "is:audio" filter).
This commit is contained in:
parent
991d743ef0
commit
81cf940160
@ -757,6 +757,7 @@ self.stats = async (req, res, next) => {
|
||||
Total: 0,
|
||||
Images: 0,
|
||||
Videos: 0,
|
||||
Audios: 0,
|
||||
Others: 0,
|
||||
Temporary: 0,
|
||||
'Size in DB': {
|
||||
@ -792,6 +793,16 @@ self.stats = async (req, res, next) => {
|
||||
.count('id as count')
|
||||
.then(rows => rows[0].count)
|
||||
})(),
|
||||
(async () => {
|
||||
stats[data.title].Audios = await db.table('files')
|
||||
.where(function () {
|
||||
for (const ext of self.audioExts) {
|
||||
this.orWhere('name', 'like', `%${ext}`)
|
||||
}
|
||||
})
|
||||
.count('id as count')
|
||||
.then(rows => rows[0].count)
|
||||
})(),
|
||||
(async () => {
|
||||
stats[data.title].Temporary = await db.table('files')
|
||||
.whereNotNull('expirydate')
|
||||
@ -800,7 +811,10 @@ self.stats = async (req, res, next) => {
|
||||
})()
|
||||
])
|
||||
|
||||
stats[data.title].Others = stats[data.title].Total - stats[data.title].Images - stats[data.title].Videos
|
||||
stats[data.title].Others = stats[data.title].Total -
|
||||
stats[data.title].Images -
|
||||
stats[data.title].Videos -
|
||||
stats[data.title].Audios
|
||||
|
||||
// Update cache
|
||||
data.cache = stats[data.title]
|
||||
|
Loading…
Reference in New Issue
Block a user