aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPitu <[email protected]>2017-01-17 19:05:00 -0300
committerPitu <[email protected]>2017-01-17 19:05:00 -0300
commitddb6d0df7dafb3da14ce1fd86e1838890432bb8d (patch)
tree6b0636c57c12eb71103f63d9ee49d5531f2ebf72
parentChange from gallery to album (diff)
downloadhost.fuwn.me-ddb6d0df7dafb3da14ce1fd86e1838890432bb8d.tar.xz
host.fuwn.me-ddb6d0df7dafb3da14ce1fd86e1838890432bb8d.zip
Database now saves album
-rw-r--r--controllers/uploadController.js4
-rw-r--r--database/db.js4
-rw-r--r--public/js/panel.js4
-rw-r--r--routes/api.js1
4 files changed, 6 insertions, 7 deletions
diff --git a/controllers/uploadController.js b/controllers/uploadController.js
index c9959fb..120a52b 100644
--- a/controllers/uploadController.js
+++ b/controllers/uploadController.js
@@ -26,7 +26,7 @@ uploadsController.upload = function(req, res, next){
if(req.headers.auth !== config.clientToken)
return res.status(401).send('not-authorized')
- let gallery = req.headers.gallery
+ let album = req.headers.album
upload(req, res, function (err) {
if (err) {
@@ -45,7 +45,7 @@ uploadsController.upload = function(req, res, next){
type: file.mimetype,
size: file.size,
ip: req.ip,
- galleryid: gallery,
+ albumid: album,
created_at: Math.floor(Date.now() / 1000)
})
})
diff --git a/database/db.js b/database/db.js
index d641c2e..6c4889b 100644
--- a/database/db.js
+++ b/database/db.js
@@ -2,7 +2,7 @@
let init = function(db, config){
// Create the tables we need to store galleries and files
- db.schema.createTableIfNotExists('gallery', function (table) {
+ db.schema.createTableIfNotExists('albums', function (table) {
table.increments()
table.string('name')
table.timestamps()
@@ -15,7 +15,7 @@ let init = function(db, config){
table.string('type')
table.string('size')
table.string('ip')
- table.integer('galleryid')
+ table.integer('albumid')
table.timestamps()
}).then(() => {})
diff --git a/public/js/panel.js b/public/js/panel.js
index e008abd..14f6237 100644
--- a/public/js/panel.js
+++ b/public/js/panel.js
@@ -74,7 +74,7 @@ panel.getUploads = function(){
<thead>
<tr>
<th>File</th>
- <th>Gallery</th>
+ <th>Album</th>
<th>Date</th>
</tr>
</thead>
@@ -91,7 +91,7 @@ panel.getUploads = function(){
tr.innerHTML = `
<tr>
<th><a href="${item.file}" target="_blank">${item.file}</a></th>
- <th>${item.gallery}</th>
+ <th>${item.album}</th>
<td>${item.date}</td>
</tr>
`;
diff --git a/routes/api.js b/routes/api.js
index a759bf3..7a4480b 100644
--- a/routes/api.js
+++ b/routes/api.js
@@ -9,7 +9,6 @@ routes.get ('/check', (req, res, next) => {
})
routes.get('/info', (req, res, next) => {
-
if(config.private === true)
if(req.headers.auth !== config.clientToken)
return res.status(401).send('not-authorized')