aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--controllers/galleryController.js4
-rw-r--r--controllers/uploadController.js2
-rw-r--r--public/css/style.css3
-rw-r--r--public/index.html10
-rw-r--r--routes/routes.js2
6 files changed, 15 insertions, 7 deletions
diff --git a/README.md b/README.md
index e3f05ae..e4760af 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,4 @@
+![loli-safe](https://i.imgur.com/YqO1nuc.png)
# loli-safe
Pomf-like image uploading service, written in NodeJS
diff --git a/controllers/galleryController.js b/controllers/galleryController.js
index c7ea726..a74dde5 100644
--- a/controllers/galleryController.js
+++ b/controllers/galleryController.js
@@ -6,7 +6,7 @@ let galleryController = {}
galleryController.list = function(req, res, next){
if(!config.privacy.public)
- if(!config.privacy.IPs.includes(req.ip)) return res.status(401).send('Not Authorized!')
+ if(!config.privacy.IPs.includes(req.ip)) return res.status(401).send('not-authorized')
db.table('gallery').select('id', 'name').then((data) => {
res.json({ data })
@@ -16,7 +16,7 @@ galleryController.list = function(req, res, next){
galleryController.test = function(req, res, next){
if(!config.privacy.public)
- if(!config.privacy.IPs.includes(req.ip)) return res.status(401).send('Not Authorized!')
+ if(!config.privacy.IPs.includes(req.ip)) return res.status(401).send('not-authorized')
let testdata = [
{name: 'Test 1'},
diff --git a/controllers/uploadController.js b/controllers/uploadController.js
index d2d9cf8..259e824 100644
--- a/controllers/uploadController.js
+++ b/controllers/uploadController.js
@@ -25,7 +25,7 @@ uploadsController.upload = function(req, res, next){
let gallery = req.headers.gallery
if(!config.privacy.public)
- if(!config.privacy.IPs.includes(req.ip)) return res.status(401).send('Not Authorized!')
+ if(!config.privacy.IPs.includes(req.ip)) return res.status(401).send('not-authorized')
upload(req, res, function (err) {
if (err) {
diff --git a/public/css/style.css b/public/css/style.css
index 7cc0548..5fc58c7 100644
--- a/public/css/style.css
+++ b/public/css/style.css
@@ -28,7 +28,7 @@ div#dropzone {
background-color: rgba(0, 0, 0, 0);
border-color: #ff3860;
color: #ff3860;
- display: flex;
+ display: none;
width: 100%;
border-radius: 3px;
box-shadow: none;
@@ -49,6 +49,7 @@ div#dropzone:hover {
border-color: #ff3860;
color: #fff;
}
+
img.logo { height: 200px; margin-top: 20px; }
.dz-preview .dz-details { display: flex; }
.dz-preview .dz-details .dz-size, .dz-preview .dz-details .dz-filename { flex: 1 }
diff --git a/public/index.html b/public/index.html
index dd2a12d..dcd4697 100644
--- a/public/index.html
+++ b/public/index.html
@@ -24,6 +24,7 @@
<div class="columns">
<div class="column"></div>
<div class="column">
+ <a class="button is-danger is-outlined" id='btnGithub' href='https://github.com/kanadeko/loli-safe' target='_blank'>View on Github</a>
<div id="dropzone">Click here or drag and drop files</div>
</div>
<div class="column"></div>
@@ -57,10 +58,15 @@
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == XMLHttpRequest.DONE) {
+ console.log(xhr.responseText)
+ if(xhr.responseText !== 'not-authorized'){
+ document.getElementById('btnGithub').style.display = 'none';
+ document.getElementById('dropzone').style.display = 'flex';
+ }
if(xhr.responseText.maxFileSize)
- maxSize = xhr.responseText.maxFileSize
+ maxSize = xhr.responseText.maxFileSize;
if(xhr.responseText.urlPrefix)
- urlPrefix = xhr.responseText.urlPrefix + '/'
+ urlPrefix = xhr.responseText.urlPrefix + '/';
}
}
xhr.open('GET', '/api/info', true);
diff --git a/routes/routes.js b/routes/routes.js
index 2e8005c..e81b733 100644
--- a/routes/routes.js
+++ b/routes/routes.js
@@ -5,7 +5,7 @@ const galleryController = require('../controllers/galleryController')
routes.get ('/info', (req, res, next) => {
if(!config.privacy.public)
- if(!config.privacy.IPs.includes(req.ip)) return res.status(401).send('Not Authorized!')
+ if(!config.privacy.IPs.includes(req.ip)) return res.status(401).send('not-authorized')
return res.json({
maxFileSize: config.uploads.maxsize.slice(0, -2),