From 0dfb1cf22fb080d0302570a3f1a08aed1a78496b Mon Sep 17 00:00:00 2001 From: fatchan Date: Fri, 5 Jun 2020 14:38:05 +1000 Subject: [PATCH 1/5] This should change it back closes #158 --- models/forms/makepost.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/forms/makepost.js b/models/forms/makepost.js index 413f5a58..fba6e79b 100644 --- a/models/forms/makepost.js +++ b/models/forms/makepost.js @@ -306,7 +306,7 @@ module.exports = async (req, res, next) => { salt = (await randomBytes(128)).toString('base64'); } if (ids === true) { - const fullUserIdHash = createHash('sha256').update(salt + res.locals.ip.single).digest('hex'); + const fullUserIdHash = createHash('sha256').update(salt + res.locals.ip.raw).digest('hex'); userId = fullUserIdHash.substring(fullUserIdHash.length-6); } let country = null; From 39a2db4178c73a6f7b4ce52bbc1f59f3297c04cf Mon Sep 17 00:00:00 2001 From: fatchan Date: Sat, 6 Jun 2020 12:17:01 +1000 Subject: [PATCH 2/5] Typo, close #162 --- models/forms/editpost.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/forms/editpost.js b/models/forms/editpost.js index 2e46ce3c..fbe743c8 100644 --- a/models/forms/editpost.js +++ b/models/forms/editpost.js @@ -147,7 +147,7 @@ todo: handle some more situations user: req.session.user.username, ip: { single: res.locals.ip.single, - raw: ras.locals.ip.raw, + raw: res.locals.ip.raw, } }); From 9f9d8387f91257a1a185f30b14ed6c8e3d0e1e6c Mon Sep 17 00:00:00 2001 From: fatchan Date: Sun, 7 Jun 2020 11:50:51 +1000 Subject: [PATCH 3/5] Exit if migrateVersion outdated close #163 --- db/db.js | 13 +++++++++++++ gulpfile.js | 2 +- schedules/index.js | 1 + server.js | 1 + worker.js | 1 + 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/db/db.js b/db/db.js index 1e7ddd57..2df13386 100644 --- a/db/db.js +++ b/db/db.js @@ -1,6 +1,7 @@ 'use strict'; const { MongoClient, ObjectId, Int32 } = require('mongodb') + , { migrateVersion } = require(__dirname+'/../package.json') , configs = require(__dirname+'/../configs/main.js'); module.exports = { @@ -15,6 +16,18 @@ module.exports = { }); }, + checkVersion: async() => { + const currentVersion = await module.exports.client + .db('jschan') + .collection('version') + .findOne({ '_id': 'version' }) + .then(res => res.version); + if (currentVersion < migrateVersion) { + console.error('Your migration version is out-of-date. Run `gulp migrate` to update.'); + process.exit(1); + } + }, + ObjectId, NumberInt: Int32, diff --git a/gulpfile.js b/gulpfile.js index 21c98a60..c9a1959c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -14,7 +14,7 @@ const gulp = require('gulp') , del = require('del') , pug = require('pug') , gulppug = require('gulp-pug') - , migrateVersion = require(__dirname+'/package.json').migrateVersion + , { migrateVersion } = require(__dirname+'/package.json') , paths = { styles: { src: 'gulp/res/css/**/*.css', diff --git a/schedules/index.js b/schedules/index.js index 18c4b133..23245b8f 100644 --- a/schedules/index.js +++ b/schedules/index.js @@ -13,6 +13,7 @@ const timeUtils = require(__dirname+'/../helpers/timeutils.js') debugLogs && console.log('CONNECTING TO MONGODB'); await Mongo.connect(); + await Mongo.checkVersion(); debugLogs && console.log('STARTING SCHEDULES'); //update board stats and homepage diff --git a/server.js b/server.js index b4529652..ff0ecee4 100644 --- a/server.js +++ b/server.js @@ -32,6 +32,7 @@ const express = require('express') // connect to mongodb debugLogs && console.log('CONNECTING TO MONGODB'); await Mongo.connect(); + await Mongo.checkVersion(); // connect to redis debugLogs && console.log('CONNECTING TO REDIS'); diff --git a/worker.js b/worker.js index 5ee7fa2e..c02b7a7e 100644 --- a/worker.js +++ b/worker.js @@ -11,6 +11,7 @@ const { debugLogs } = require(__dirname+'/configs/main.js') debugLogs && console.log('CONNECTING TO MONGODB'); await Mongo.connect(); + await Mongo.checkVersion(); const tasks = require(__dirname+'/helpers/tasks.js') , { queue } = require(__dirname+'/queue.js') From ebff360786d762097e01c2769f588664a7326682 Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Tue, 9 Jun 2020 10:50:30 +1000 Subject: [PATCH 4/5] bmps missing from nginx config reference #165 --- configs/nginx.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/nginx.example b/configs/nginx.example index b540a988..509f97b1 100644 --- a/configs/nginx.example +++ b/configs/nginx.example @@ -111,7 +111,7 @@ server { } # Files (image, video, audio, other) - location ~* \.(png|jpg|jpeg|gif|apng|webp|jfif|pjpeg|mkv|mp4|webm|mov|svg|mp3|ogg|wav|opus)$ { + location ~* \.(png|jpg|jpeg|bmp|gif|apng|webp|jfif|pjpeg|mkv|mp4|webm|mov|svg|mp3|ogg|wav|opus)$ { access_log off; expires max; root /path/to/jschan/static; From cb57b72744ecc647fb64f856a0a104d5127dc020 Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Tue, 9 Jun 2020 10:50:46 +1000 Subject: [PATCH 5/5] bmps missing from nginx config reference #165 --- configs/nginx_no_https.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/nginx_no_https.example b/configs/nginx_no_https.example index f891b795..cf9378d8 100644 --- a/configs/nginx_no_https.example +++ b/configs/nginx_no_https.example @@ -111,7 +111,7 @@ server { } # Files (image, video, audio, other) - location ~* \.(png|jpg|jpeg|gif|apng|webp|pjpeg|jfif|mkv|mp4|webm|mov|svg|mp3|ogg|wav|opus)$ { + location ~* \.(png|jpg|jpeg|bmp|gif|apng|webp|pjpeg|jfif|mkv|mp4|webm|mov|svg|mp3|ogg|wav|opus)$ { access_log off; expires max; root /path/to/jschan/static;