mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-05 19:40:09 +00:00
Database now saves album
This commit is contained in:
parent
c4b5457891
commit
ddb6d0df7d
@ -26,7 +26,7 @@ uploadsController.upload = function(req, res, next){
|
|||||||
if(req.headers.auth !== config.clientToken)
|
if(req.headers.auth !== config.clientToken)
|
||||||
return res.status(401).send('not-authorized')
|
return res.status(401).send('not-authorized')
|
||||||
|
|
||||||
let gallery = req.headers.gallery
|
let album = req.headers.album
|
||||||
|
|
||||||
upload(req, res, function (err) {
|
upload(req, res, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -45,7 +45,7 @@ uploadsController.upload = function(req, res, next){
|
|||||||
type: file.mimetype,
|
type: file.mimetype,
|
||||||
size: file.size,
|
size: file.size,
|
||||||
ip: req.ip,
|
ip: req.ip,
|
||||||
galleryid: gallery,
|
albumid: album,
|
||||||
created_at: Math.floor(Date.now() / 1000)
|
created_at: Math.floor(Date.now() / 1000)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
let init = function(db, config){
|
let init = function(db, config){
|
||||||
|
|
||||||
// Create the tables we need to store galleries and files
|
// 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.increments()
|
||||||
table.string('name')
|
table.string('name')
|
||||||
table.timestamps()
|
table.timestamps()
|
||||||
@ -15,7 +15,7 @@ let init = function(db, config){
|
|||||||
table.string('type')
|
table.string('type')
|
||||||
table.string('size')
|
table.string('size')
|
||||||
table.string('ip')
|
table.string('ip')
|
||||||
table.integer('galleryid')
|
table.integer('albumid')
|
||||||
table.timestamps()
|
table.timestamps()
|
||||||
}).then(() => {})
|
}).then(() => {})
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ panel.getUploads = function(){
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>File</th>
|
<th>File</th>
|
||||||
<th>Gallery</th>
|
<th>Album</th>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -91,7 +91,7 @@ panel.getUploads = function(){
|
|||||||
tr.innerHTML = `
|
tr.innerHTML = `
|
||||||
<tr>
|
<tr>
|
||||||
<th><a href="${item.file}" target="_blank">${item.file}</a></th>
|
<th><a href="${item.file}" target="_blank">${item.file}</a></th>
|
||||||
<th>${item.gallery}</th>
|
<th>${item.album}</th>
|
||||||
<td>${item.date}</td>
|
<td>${item.date}</td>
|
||||||
</tr>
|
</tr>
|
||||||
`;
|
`;
|
||||||
|
@ -9,7 +9,6 @@ routes.get ('/check', (req, res, next) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
routes.get('/info', (req, res, next) => {
|
routes.get('/info', (req, res, next) => {
|
||||||
|
|
||||||
if(config.private === true)
|
if(config.private === true)
|
||||||
if(req.headers.auth !== config.clientToken)
|
if(req.headers.auth !== config.clientToken)
|
||||||
return res.status(401).send('not-authorized')
|
return res.status(401).send('not-authorized')
|
||||||
|
Loading…
Reference in New Issue
Block a user