aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPitu <[email protected]>2017-01-17 19:35:18 -0300
committerPitu <[email protected]>2017-01-17 19:35:18 -0300
commit66f4961c38effa408a48d6d801787958b0a5e6fe (patch)
tree24fcd99215bafe60af15aae1953ef87adf763bef
parentRemoved maxFile check on frontend (diff)
downloadhost.fuwn.me-66f4961c38effa408a48d6d801787958b0a5e6fe.tar.xz
host.fuwn.me-66f4961c38effa408a48d6d801787958b0a5e6fe.zip
Better link display on homepage
-rw-r--r--pages/home.html10
-rw-r--r--public/js/upload.js8
-rw-r--r--routes/api.js5
3 files changed, 16 insertions, 7 deletions
diff --git a/pages/home.html b/pages/home.html
index aa1434b..50ad9d3 100644
--- a/pages/home.html
+++ b/pages/home.html
@@ -27,8 +27,6 @@
<a id='tokenSubmit' class="button is-danger">Check</a>
</p>
- <a id='btnGithub' class="button is-danger is-outlined" href='https://github.com/kanadeko/loli-safe' target='_blank'>View on Github</a>
-
</div>
<div class="column is-hidden-mobile"></div>
</div>
@@ -41,7 +39,13 @@
<div class="columns">
<div class="column is-hidden-mobile"></div>
- <div class="column"><a href="https://chrome.google.com/webstore/detail/loli-safe-uploader/enkkmplljfjppcdaancckgilmgoiofnj/related" target="_blank" class="is-danger">Uploader Chrome extension</a></div>
+ <div class="column">
+ <p>
+ <a href="https://github.com/kanadeko/loli-safe" target="_blank" class="is-danger">View on Github</a>
+ |
+ <a href="https://chrome.google.com/webstore/detail/loli-safe-uploader/enkkmplljfjppcdaancckgilmgoiofnj/related" target="_blank" class="is-danger">Chrome extension</a>
+ </p>
+ </div>
<div class="column is-hidden-mobile"></div>
</div>
diff --git a/public/js/upload.js b/public/js/upload.js
index f5e8427..8f36fa5 100644
--- a/public/js/upload.js
+++ b/public/js/upload.js
@@ -2,12 +2,14 @@ var upload = {};
upload.isPrivate = true;
upload.token = localStorage.token;
+upload.maxFileSize;
upload.checkIfPublic = function(){
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == XMLHttpRequest.DONE) {
upload.isPublic = JSON.parse(xhr.responseText).private;
+ upload.maxFileSize = JSON.parse(xhr.responseText).maxFileSize;
upload.preparePage();
}
}
@@ -62,7 +64,6 @@ upload.prepareUpload = function(){
div.innerHTML = 'Click here or drag and drop files';
div.style.display = 'flex';
- document.getElementById('btnGithub').style.display = 'none';
document.getElementById('tokenContainer').style.display = 'none';
document.getElementById('uploadContainer').appendChild(div);
document.getElementById('panel').style.display = 'block';
@@ -81,6 +82,7 @@ upload.prepareDropzone = function(){
var dropzone = new Dropzone('div#dropzone', {
url: '/api/upload',
paramName: 'files[]',
+ maxFilesize: upload.maxFileSize.slice(0, -2),
parallelUploads: 2,
uploadMultiple: false,
previewsContainer: 'div#uploads',
@@ -89,13 +91,13 @@ upload.prepareDropzone = function(){
maxFiles: 1000,
autoProcessQueue: true,
headers: {
- 'auth': localStorage.token
+ 'auth': upload.token
},
init: function() {
this.on('addedfile', function(file) {
document.getElementById('uploads').style.display = 'block';
});
- }
+ }
});
// Update the total progress bar
diff --git a/routes/api.js b/routes/api.js
index c2ce8a8..ca9c7c0 100644
--- a/routes/api.js
+++ b/routes/api.js
@@ -5,7 +5,10 @@ const albumsController = require('../controllers/albumsController')
const tokenController = require('../controllers/tokenController')
routes.get ('/check', (req, res, next) => {
- return res.json({ private: config.private })
+ return res.json({
+ private: config.private,
+ maxFileSize: config.uploads.maxsize
+ })
})
routes.get ('/uploads', (req, res, next) => uploadController.list(req, res))