summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules <jules@asdf.us>2018-03-31 08:56:10 -0400
committerJules <jules@asdf.us>2018-03-31 08:56:10 -0400
commitb3c1619d2027939963d4f906e9da40b26e17eee1 (patch)
treee1365afa3defc1be996edd65bc08d283e2775175
parentc3d17983b398b5c5b2c2c62dd8fff478b5f02b4d (diff)
server fixes, raises size limit
-rw-r--r--lib/db/index.js2
-rw-r--r--lib/index.js10
-rw-r--r--lib/upload.js4
3 files changed, 8 insertions, 8 deletions
diff --git a/lib/db/index.js b/lib/db/index.js
index b2ea59c..93fdd0e 100644
--- a/lib/db/index.js
+++ b/lib/db/index.js
@@ -34,7 +34,7 @@ db.getIndex = function(limit, offset) {
return Image.query(function(qb){
qb.orderBy("id", "desc").limit(limit)
if (offset) qb.offset(offset)
- }).fetch()
+ }).fetchAll()
}
db.createImage = function(url){
return new Image({ url: url }).save()
diff --git a/lib/index.js b/lib/index.js
index 6d07dda..a4e5263 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -30,11 +30,6 @@ site.init = function(){
console.log('plop listening at http://5.k:%s', server.address().port)
})
- app.get("/p/get/random", function(req, res){
- db.getRandom().then(function(img){
- res.json(img)
- })
- })
app.get("/p/list/", function(req, res){
limit = parseInt(req.params.limit)
if (isNaN(limit)) limit = 20
@@ -45,6 +40,11 @@ site.init = function(){
res.json(img)
})
})
+ app.get("/p/get/random", function(req, res){
+ db.getRandom().then(function(img){
+ res.json(img)
+ })
+ })
app.get("/p/get/", function(req, res){
db.getLatest().then(function(img){
res.json(img)
diff --git a/lib/upload.js b/lib/upload.js
index 82ea9b5..385e626 100644
--- a/lib/upload.js
+++ b/lib/upload.js
@@ -37,8 +37,8 @@ module.exports.put = function (key, file, opt) {
else if (file.size < 10) {
err = "File too small"
}
- else if (file.size > 2097152) { // 2mb limit
- err = "File too large. Uploads can be a maximum of 2 mb."
+ else if (file.size > 1024*1024*3) { // 3mb limit
+ err = "File too large. Uploads can be a maximum of 3 mb."
}
if (err) {