diff options
| author | Pitu <[email protected]> | 2018-09-18 03:34:00 -0300 |
|---|---|---|
| committer | Pitu <[email protected]> | 2018-09-18 03:34:00 -0300 |
| commit | 4b2b02110b457d8ebeee78e1bdf99eb0660d0626 (patch) | |
| tree | a6e30208b61e3927c1681c7006241cd0d837de89 /src/api/structures | |
| parent | Stupid hash was working, the size changes for some reason when uploading (diff) | |
| download | host.fuwn.me-4b2b02110b457d8ebeee78e1bdf99eb0660d0626.tar.xz host.fuwn.me-4b2b02110b457d8ebeee78e1bdf99eb0660d0626.zip | |
We can now download albums yayyyy
Diffstat (limited to 'src/api/structures')
| -rw-r--r-- | src/api/structures/Database.js | 2 | ||||
| -rw-r--r-- | src/api/structures/Server.js | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/api/structures/Database.js b/src/api/structures/Database.js index dc26afe..76ea006 100644 --- a/src/api/structures/Database.js +++ b/src/api/structures/Database.js @@ -34,6 +34,7 @@ class Database { // table.string('identifier'); // table.boolean('enabled'); // table.boolean('enableDownload').defaultTo(true); + table.timestamp('zippedAt'); table.timestamp('createdAt'); table.timestamp('editedAt'); }); @@ -57,6 +58,7 @@ class Database { if (!await db.schema.hasTable('links')) { await db.schema.createTable('links', table => { table.increments(); + table.integer('userId'); table.integer('albumId'); table.string('identifier'); table.integer('views').defaultTo(0); diff --git a/src/api/structures/Server.js b/src/api/structures/Server.js index ae4b678..0b05570 100644 --- a/src/api/structures/Server.js +++ b/src/api/structures/Server.js @@ -24,6 +24,10 @@ class Server { this.server.use(helmet()); this.server.use(cors({ allowedHeaders: ['Accept', 'Authorization', 'Cache-Control', 'X-Requested-With', 'Content-Type', 'albumId'] })); this.server.use((req, res, next) => { + /* + This bypasses the headers.accept for album download, since it's accesed directly through the browser. + */ + if (req.url.includes('/api/album/') && req.url.includes('/zip') && req.method === 'GET') return next(); if (req.headers.accept === 'application/vnd.lolisafe.json') return next(); return res.status(405).json({ message: 'Incorrect `Accept` header provided' }); }); |