mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-13 07:56:23 +00:00
Updates
Added total size to album public pages.
This commit is contained in:
parent
7d55b43ef2
commit
7665836ef4
@ -238,7 +238,12 @@ authController.listUsers = async (req, res, next) => {
|
||||
|
||||
for (const upload of uploads) {
|
||||
// This is the fastest method that I can think of
|
||||
if (maps[upload.userid] === undefined) { maps[upload.userid] = { count: 0, size: 0 } }
|
||||
if (maps[upload.userid] === undefined) {
|
||||
maps[upload.userid] = {
|
||||
count: 0,
|
||||
size: 0
|
||||
}
|
||||
}
|
||||
maps[upload.userid].count++
|
||||
maps[upload.userid].size += parseInt(upload.size)
|
||||
}
|
||||
|
@ -261,9 +261,8 @@ uploadsController.actuallyUploadByUrl = async (req, res, user, albumid) => {
|
||||
return erred('File too large.')
|
||||
}
|
||||
|
||||
const fetchFile = await fetch(url, {
|
||||
size // limit max response body size with content-length
|
||||
})
|
||||
// limit max response body size with content-length
|
||||
const fetchFile = await fetch(url, { size })
|
||||
if (fetchFile.status !== 200) {
|
||||
return erred(`${fetchHead.status} ${fetchHead.statusText}`)
|
||||
}
|
||||
|
@ -39,8 +39,10 @@ routes.get('/a/:identifier', async (req, res, next) => {
|
||||
let thumb = ''
|
||||
const basedomain = config.domain
|
||||
|
||||
let totalSize = 0
|
||||
for (const file of files) {
|
||||
file.file = `${basedomain}/${file.name}`
|
||||
totalSize += parseInt(file.size)
|
||||
|
||||
file.extname = path.extname(file.name).toLowerCase()
|
||||
if (utils.mayGenerateThumb(file.extname)) {
|
||||
@ -65,7 +67,8 @@ routes.get('/a/:identifier', async (req, res, next) => {
|
||||
generateZips: config.uploads.generateZips,
|
||||
downloadLink: album.download === 0 ? null : `../api/album/zip/${album.identifier}?v=${album.editedAt}`,
|
||||
editedAt: album.editedAt,
|
||||
url: `${homeDomain}/a/${album.identifier}`
|
||||
url: `${homeDomain}/a/${album.identifier}`,
|
||||
totalSize
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
</div>
|
||||
<div class="level-item">
|
||||
<h1 id="count" class="subtitle">
|
||||
{{ count }} files
|
||||
{{ count }} files (<span class="file-size">{{ totalSize }}</span>)
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user