indent & spacing adjustments

indiachan-spamvector
Thomas Lynch 2 years ago
parent c6d646ce8d
commit f4f88d697a
Signed by: fatchan
GPG Key ID: A7E5E8B7E11EE92D
  1. 9
      lib/file/video/videothumbnail.js
  2. 6
      lib/misc/dotwofactor.js
  3. 4
      lib/misc/dynamic.js
  4. 6
      lib/post/deletequotes.js

@ -16,10 +16,11 @@ module.exports = (file, geometry, timestamp) => {
}); });
if (timestamp === 0) { if (timestamp === 0) {
//bypass issue with some dumb files like audio album art covert not working with .screenshots //bypass issue with some dumb files like audio album art covert not working with .screenshots
command.inputOptions([ command
'-t', .inputOptions([
0 '-t',
]) 0
])
.outputOptions([ .outputOptions([
`-vf scale=${geometry.width > geometry.height ? thumbSize + ':-2' : '-2:' + thumbSize}`, `-vf scale=${geometry.width > geometry.height ? thumbSize + ':-2' : '-2:' + thumbSize}`,
'-frames:v 1' '-frames:v 1'

@ -2,18 +2,22 @@ const OTPAuth = require('otpauth')
, redis = require(__dirname+'/../redis/redis.js'); , redis = require(__dirname+'/../redis/redis.js');
module.exports = async (username, totpSecret, userInput) => { module.exports = async (username, totpSecret, userInput) => {
if (!userInput) { if (!userInput) {
return null; return null;
} }
const totp = new OTPAuth.TOTP({ const totp = new OTPAuth.TOTP({
secret: totpSecret, secret: totpSecret,
algorithm: 'SHA256', algorithm: 'SHA256',
}); });
let delta = totp.validate({ let delta = totp.validate({
token: userInput, token: userInput,
algorithm: 'SHA256', algorithm: 'SHA256',
window: 1, window: 1,
}); });
if (delta !== null) { if (delta !== null) {
const key = `twofactor_success:${username}:${userInput}`; const key = `twofactor_success:${username}:${userInput}`;
const uses = await redis.incr(key); const uses = await redis.incr(key);
@ -22,5 +26,7 @@ module.exports = async (username, totpSecret, userInput) => {
return null; return null;
} }
} }
return delta; return delta;
}; };

@ -1,14 +1,18 @@
'use strict'; 'use strict';
module.exports = (req, res, code, page, data) => { module.exports = (req, res, code, page, data) => {
res.status(code); res.status(code);
if (req.body.minimal) { if (req.body.minimal) {
data.minimal = true; data.minimal = true;
} }
if (req.headers && req.headers['x-using-xhr'] != null) { if (req.headers && req.headers['x-using-xhr'] != null) {
//if sending header with js, and not a bypass_minimal page, show modal //if sending header with js, and not a bypass_minimal page, show modal
return res.json(data); return res.json(data);
} else { } else {
return res.render(page, data); return res.render(page, data);
} }
}; };

@ -8,8 +8,10 @@ module.exports = (deletedPosts, updateQuotePosts) => {
const quotesBefore = post.quotes.length; const quotesBefore = post.quotes.length;
post.quotes = post.quotes.filter(q => q.postId !== ap.postId); post.quotes = post.quotes.filter(q => q.postId !== ap.postId);
if (quotesBefore !== post.quotes.length) { //optimization, probably if (quotesBefore !== post.quotes.length) { //optimization, probably
post.message = post.message.replace(`<a class="quote" href="/${ap.board}/thread/${ap.thread}.html#${ap.postId}">&gt;&gt;${ap.postId}</a>`, post.message = post.message.replace(
`<span class="invalid-quote">&gt;&gt;${ap.postId}</span>`); `<a class="quote" href="/${ap.board}/thread/${ap.thread}.html#${ap.postId}">&gt;&gt;${ap.postId}</a>`,
`<span class="invalid-quote">&gt;&gt;${ap.postId}</span>`
);
} }
}); });
bulkWrites.push({ bulkWrites.push({

Loading…
Cancel
Save