resolve only after thumbnailing actually finishes

merge-requests/208/head
fatchan 5 years ago
parent 2de229337b
commit 72391e0558
  1. 2
      gulp/res/css/style.css
  2. 3
      helpers/captchagenerate.js
  3. 2
      helpers/captchaverify.js
  4. 16
      helpers/files/image-thumbnail.js
  5. 2
      helpers/files/video-thumbnail.js
  6. 7
      models/pages/captcha.js
  7. 2
      views/mixins/catalogtile.pug
  8. 4
      views/mixins/post.pug

@ -46,7 +46,7 @@ body {
padding: 10px;
}
.pages a, a:visited {
.pages a {
text-decoration: none;
color: black;
}

@ -29,7 +29,8 @@ module.exports = (text, captchaId) => {
x.wave(10, rr(50,80))
.blur(1, 2)
.crop(200, 80, 0, 0)
.write(`./uploads/captcha/${captchaId}.png`, (err) => {
.quality(30)
.write(`./uploads/captcha/${captchaId}.jpg`, (err) => {
if (err) {
return reject();
}

@ -47,7 +47,7 @@ module.exports = async (req, res, next) => {
//it was correct, so delete the file, the cookie and continue
res.clearCookie('captchaid');
await unlink(`${uploadDirectory}captcha/${captchaId}.png`)
await unlink(`${uploadDirectory}captcha/${captchaId}.jpg`)
return next();

@ -6,14 +6,14 @@ module.exports = (filename) => {
return new Promise((resolve, reject) => {
gm(`${uploadDirectory}img/${filename}`)
.resize(128, 128)
.noProfile()
.write(`${uploadDirectory}img/thumb-${filename.split('.')[0]}.png`, function (err) {
if (err) {
return reject(err);
}
});
return resolve();
.resize(128, 128)
// .quality(30)
.write(`${uploadDirectory}img/thumb-${filename.split('.')[0]}.jpg`, function (err) {
if (err) {
return reject(err);
}
return resolve();
});
});
};

@ -12,7 +12,7 @@ module.exports = (filename) => {
.screenshots({
timestamps: [0],
count: 1,
filename: `thumb-${filename.split('.')[0]}.png`,
filename: `thumb-${filename.split('.')[0]}.jpg`,
folder: `${uploadDirectory}img/`,
size: '128x?'
});

@ -6,11 +6,6 @@ const crypto = require('crypto')
module.exports = async (req, res, next) => {
//will move captcha cookie check to nginx at some point
if (req.cookies.captchaid) {
return res.redirect(`/captcha/${req.cookies.captchaid}.png`);
}
// if we got here, they dont have a cookie so we need to
// gen a captcha, set their cookie and redirect to the captcha
const text = crypto.randomBytes(20).toString('hex').substring(0,6);
@ -28,6 +23,6 @@ module.exports = async (req, res, next) => {
'httpOnly': true,
'secure': true
})
.redirect(`/captcha/${captchaId}.png`);
.redirect(`/captcha/${captchaId}.jpg`);
}

@ -11,7 +11,7 @@ mixin catalogtile(board, post, truncate)
if post.spoiler
object(data='/img/spoiler.png' width='64' height='64')
else
object.catalog-thumb(data=`/img/thumb-${post.files[0].filename.split('.')[0]}.png` width='64' height='64')
object.catalog-thumb(data=`/img/thumb-${post.files[0].filename.split('.')[0]}.jpg` width='64' height='64')
header.post-info
span: a(href=postURL) ##{post.postId}
|

@ -53,7 +53,7 @@ mixin post(post, truncate, manage=false, globalmanage=false)
if post.spoiler
object(data='/img/spoiler.png' width='128' height='128')
else
object(data=`/img/thumb-${file.filename.split('.')[0]}.png`)
object(data=`/img/thumb-${file.filename.split('.')[0]}.jpg`)
if post.message
if truncate
-
@ -69,7 +69,7 @@ mixin post(post, truncate, manage=false, globalmanage=false)
else
blockquote.post-message !{post.message}
if post.banmessage
blockquote.left.clear-both.banmessage (USER WAS BANNED FOR THIS POST #{post.banmessage})
blockquote.left.clear-both.banmessage USER WAS BANNED FOR THIS POST (#{post.banmessage})
if post.omittedposts || post.omittedimages
blockquote.left.clear-both #{post.omittedposts} post(s)#{post.omittedimages > 0 ? ' and '+post.omittedimages+' image(s)' : ''} omitted. #[a(href=postURL) View the full thread]

Loading…
Cancel
Save