Fixes to albums

* It will now properly create "editedAt" and "zipGeneratedAt" columns into "albums" table, which will then be used for the "Download Album" feature. Previously, due to the lack of those columns, people could not download albums. Existing installation will have to do some manual patches, which I will describe further in the commit's comments.

* Thumbnail-less files will properly show the extensions in albums. Previously it would have two dots.
This commit is contained in:
Bobby Wibowo 2018-02-07 23:56:32 +07:00
parent 73f1d40077
commit 677d8717e7
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF
3 changed files with 6 additions and 2 deletions

View File

@ -64,7 +64,9 @@ albumsController.create = async (req, res, next) => {
enabled: 1, enabled: 1,
userid: user.id, userid: user.id,
identifier: randomstring.generate(8), identifier: randomstring.generate(8),
timestamp: Math.floor(Date.now() / 1000) timestamp: Math.floor(Date.now() / 1000),
editedAt: 0,
zipGeneratedAt: 0
}) })
return res.json({ success: true }) return res.json({ success: true })

View File

@ -7,6 +7,8 @@ let init = function (db) {
table.string('identifier') table.string('identifier')
table.integer('enabled') table.integer('enabled')
table.integer('timestamp') table.integer('timestamp')
table.integer('editedAt').defaultTo(0)
table.integer('zipGeneratedAt').defaultTo(0)
}).then(() => {}) }).then(() => {})
db.schema.createTableIfNotExists('files', function (table) { db.schema.createTableIfNotExists('files', function (table) {

View File

@ -34,7 +34,7 @@ routes.get('/a/:identifier', async (req, res, next) => {
file.thumb = `<img src="${file.thumb}"/>` file.thumb = `<img src="${file.thumb}"/>`
} else { } else {
file.thumb = `<h1 class="title">.${ext}</h1>` file.thumb = `<h1 class="title">${ext}</h1>`
} }
} }