mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-19 01:31:34 +00:00
Album stuff
This commit is contained in:
parent
31e9a19821
commit
36e17b0372
@ -18,8 +18,10 @@ albumsController.list = function(req, res, next){
|
|||||||
|
|
||||||
let fields = ['id', 'name']
|
let fields = ['id', 'name']
|
||||||
|
|
||||||
if(req.params.sidebar === undefined)
|
if(req.params.sidebar === undefined){
|
||||||
fields.push('timestamp')
|
fields.push('timestamp')
|
||||||
|
fields.push('identifier')
|
||||||
|
}
|
||||||
|
|
||||||
db.table('albums').select(fields).where({enabled: 1, userid: user[0].id}).then((albums) => {
|
db.table('albums').select(fields).where({enabled: 1, userid: user[0].id}).then((albums) => {
|
||||||
|
|
||||||
@ -31,6 +33,14 @@ albumsController.list = function(req, res, next){
|
|||||||
album.date = new Date(album.timestamp * 1000)
|
album.date = new Date(album.timestamp * 1000)
|
||||||
album.date = album.date.getFullYear() + '-' + (album.date.getMonth() + 1) + '-' + album.date.getDate() + ' ' + (album.date.getHours() < 10 ? '0' : '') + album.date.getHours() + ':' + (album.date.getMinutes() < 10 ? '0' : '') + album.date.getMinutes() + ':' + (album.date.getSeconds() < 10 ? '0' : '') + album.date.getSeconds()
|
album.date = album.date.getFullYear() + '-' + (album.date.getMonth() + 1) + '-' + album.date.getDate() + ' ' + (album.date.getHours() < 10 ? '0' : '') + album.date.getHours() + ':' + (album.date.getMinutes() < 10 ? '0' : '') + album.date.getMinutes() + ':' + (album.date.getSeconds() < 10 ? '0' : '') + album.date.getSeconds()
|
||||||
|
|
||||||
|
let basedomain = req.get('host')
|
||||||
|
for(let domain of config.domains)
|
||||||
|
if(domain.host === req.get('host'))
|
||||||
|
if(domain.hasOwnProperty('resolve'))
|
||||||
|
basedomain = domain.resolve
|
||||||
|
|
||||||
|
album.identifier = basedomain + '/' + album.identifier
|
||||||
|
|
||||||
ids.push(album.id)
|
ids.push(album.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,6 +206,7 @@ albumsController.get = function(req, res, next){
|
|||||||
return res.json({
|
return res.json({
|
||||||
success: true,
|
success: true,
|
||||||
title: title,
|
title: title,
|
||||||
|
count: files.length,
|
||||||
files
|
files
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
<div class="hero-head">
|
<div class="hero-head">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1 class="title" id='title' style='margin-top: 1.5rem;'></h1>
|
<h1 class="title" id='title' style='margin-top: 1.5rem;'></h1>
|
||||||
|
<h1 class="subtitle" id='count'></h1>
|
||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,6 +4,7 @@ album.get = function(album){
|
|||||||
axios.get('/api/album/get/' + album)
|
axios.get('/api/album/get/' + album)
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
document.getElementById('title').innerHTML = response.data.title;
|
document.getElementById('title').innerHTML = response.data.title;
|
||||||
|
document.getElementById('count').innerHTML = response.data.count + ' files';
|
||||||
|
|
||||||
var container = document.createElement('div');
|
var container = document.createElement('div');
|
||||||
container.innerHTML = `<div class="columns is-multiline is-mobile" id="table"></div>`
|
container.innerHTML = `<div class="columns is-multiline is-mobile" id="table"></div>`
|
||||||
|
@ -272,6 +272,7 @@ panel.getAlbums = function(){
|
|||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Files</th>
|
<th>Files</th>
|
||||||
<th>Created At</th>
|
<th>Created At</th>
|
||||||
|
<th>Public link</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -290,6 +291,7 @@ panel.getAlbums = function(){
|
|||||||
<th>${item.name}</th>
|
<th>${item.name}</th>
|
||||||
<th>${item.files}</th>
|
<th>${item.files}</th>
|
||||||
<td>${item.date}</td>
|
<td>${item.date}</td>
|
||||||
|
<td><a href="${item.identifier}" target="_blank">Album link</a></td>
|
||||||
<td>
|
<td>
|
||||||
<a class="button is-small is-primary is-outlined" title="Edit name" onclick="panel.renameAlbum(${item.id})">
|
<a class="button is-small is-primary is-outlined" title="Edit name" onclick="panel.renameAlbum(${item.id})">
|
||||||
<span class="icon is-small">
|
<span class="icon is-small">
|
||||||
|
Loading…
Reference in New Issue
Block a user