From d742486c067e1658a4fc9addc84439b37fdbf96f Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Sun, 24 Oct 2021 23:17:21 +1100 Subject: [PATCH 1/2] nvm dont want to fuck my ass with EJS modules --- helpers/checks/captcha.js | 2 +- package-lock.json | 89 +++++--------------------------------- package.json | 2 +- schedules/tasks/webring.js | 2 +- 4 files changed, 13 insertions(+), 82 deletions(-) diff --git a/helpers/checks/captcha.js b/helpers/checks/captcha.js index 2b1072f4..d4f57fa8 100644 --- a/helpers/checks/captcha.js +++ b/helpers/checks/captcha.js @@ -5,7 +5,7 @@ const { Captchas } = require(__dirname+'/../../db/') , config = require(__dirname+'/../../config.js') , { hcaptcha, google } = require(__dirname+'/../../configs/secrets.js') , FormData = require('form-data') - , fetch = import('node-fetch') + , fetch = require('node-fetch') , { timingSafeEqual } = require('crypto') module.exports = async (captchaInput, captchaId) => { diff --git a/package-lock.json b/package-lock.json index 218c0846..b28b753a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,7 +41,7 @@ "ioredis": "^4.28.0", "ip6addr": "^0.2.3", "mongodb": "^4.0.1", - "node-fetch": "^3.0.0", + "node-fetch": "^2.6.5", "node-image-hash": "^1.1.0", "path": "^0.12.7", "pm2": "^5.1.0", @@ -1861,17 +1861,6 @@ "node-pre-gyp": "bin/node-pre-gyp" } }, - "node_modules/@mapbox/node-pre-gyp/node_modules/node-fetch": { - "version": "2.6.5", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz", - "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - } - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -5654,27 +5643,6 @@ "resolved": "https://registry.npmjs.org/fclone/-/fclone-1.0.11.tgz", "integrity": "sha1-EOhdo4v+p/xZk0HClu4ddyZu5kA=" }, - "node_modules/fetch-blob": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.1.2.tgz", - "integrity": "sha512-hunJbvy/6OLjCD0uuhLdp0mMPzP/yd2ssd1t2FCJsaA7wkWhpbp9xfuNVpv7Ll4jFhzp6T4LAupSiV9uOeg0VQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "paypal", - "url": "https://paypal.me/jimmywarting" - } - ], - "dependencies": { - "web-streams-polyfill": "^3.0.3" - }, - "engines": { - "node": "^12.20 || >= 14.13" - } - }, "node_modules/file-type": { "version": "16.5.3", "resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.3.tgz", @@ -9085,19 +9053,14 @@ "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==" }, "node_modules/node-fetch": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0.tgz", - "integrity": "sha512-bKMI+C7/T/SPU1lKnbQbwxptpCrG9ashG+VkytmXCPZyuM9jB6VU+hY0oi4lC8LxTtAeWdckNCTa3nrGsAdA3Q==", + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz", + "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", "dependencies": { - "data-uri-to-buffer": "^3.0.1", - "fetch-blob": "^3.1.2" + "whatwg-url": "^5.0.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/node-fetch" + "node": "4.x || >=6.0.0" } }, "node_modules/node-image-hash": { @@ -13336,14 +13299,6 @@ "makeerror": "1.0.x" } }, - "node_modules/web-streams-polyfill": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.1.1.tgz", - "integrity": "sha512-Czi3fG883e96T4DLEPRvufrF2ydhOOW1+1a6c3gNjH2aIh50DNFBdfwh2AKoOf1rXvpvavAoA11Qdq9+BKjE0Q==", - "engines": { - "node": ">= 8" - } - }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -14792,16 +14747,6 @@ "rimraf": "^3.0.2", "semver": "^7.3.4", "tar": "^6.1.0" - }, - "dependencies": { - "node-fetch": { - "version": "2.6.5", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz", - "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", - "requires": { - "whatwg-url": "^5.0.0" - } - } } }, "@nodelib/fs.scandir": { @@ -17861,14 +17806,6 @@ "resolved": "https://registry.npmjs.org/fclone/-/fclone-1.0.11.tgz", "integrity": "sha1-EOhdo4v+p/xZk0HClu4ddyZu5kA=" }, - "fetch-blob": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.1.2.tgz", - "integrity": "sha512-hunJbvy/6OLjCD0uuhLdp0mMPzP/yd2ssd1t2FCJsaA7wkWhpbp9xfuNVpv7Ll4jFhzp6T4LAupSiV9uOeg0VQ==", - "requires": { - "web-streams-polyfill": "^3.0.3" - } - }, "file-type": { "version": "16.5.3", "resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.3.tgz", @@ -20548,12 +20485,11 @@ "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==" }, "node-fetch": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0.tgz", - "integrity": "sha512-bKMI+C7/T/SPU1lKnbQbwxptpCrG9ashG+VkytmXCPZyuM9jB6VU+hY0oi4lC8LxTtAeWdckNCTa3nrGsAdA3Q==", + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz", + "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", "requires": { - "data-uri-to-buffer": "^3.0.1", - "fetch-blob": "^3.1.2" + "whatwg-url": "^5.0.0" } }, "node-image-hash": { @@ -23920,11 +23856,6 @@ "makeerror": "1.0.x" } }, - "web-streams-polyfill": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.1.1.tgz", - "integrity": "sha512-Czi3fG883e96T4DLEPRvufrF2ydhOOW1+1a6c3gNjH2aIh50DNFBdfwh2AKoOf1rXvpvavAoA11Qdq9+BKjE0Q==" - }, "webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", diff --git a/package.json b/package.json index cf257d48..6098c033 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "ioredis": "^4.28.0", "ip6addr": "^0.2.3", "mongodb": "^4.0.1", - "node-fetch": "^3.0.0", + "node-fetch": "^2.6.5", "node-image-hash": "^1.1.0", "path": "^0.12.7", "pm2": "^5.1.0", diff --git a/schedules/tasks/webring.js b/schedules/tasks/webring.js index 5ccff855..343dfb29 100644 --- a/schedules/tasks/webring.js +++ b/schedules/tasks/webring.js @@ -1,6 +1,6 @@ 'use strict'; -const fetch = import('node-fetch') +const fetch = require('node-fetch') , { debugLogs } = require(__dirname+'/../../configs/secrets.js') , config = require(__dirname+'/../../config.js') , Mongo = require(__dirname+'/../../db/db.js') From 079f3d243713bce313f785e3cc0da5f231e98546 Mon Sep 17 00:00:00 2001 From: l29utp0 <23908-l29utp0@users.noreply.gitgud.io> Date: Sun, 24 Oct 2021 20:25:54 +0000 Subject: [PATCH 2/2] typo, that will be $1000 --- helpers/tasks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers/tasks.js b/helpers/tasks.js index ef7ab49f..6b53c845 100644 --- a/helpers/tasks.js +++ b/helpers/tasks.js @@ -239,7 +239,7 @@ module.exports = { let [ totalStats, boards, fileStats, recentNews ] = await Promise.all([ Boards.totalStats(), //overall total posts ever made Boards.boardSort(0, 20), //top 20 boards sorted by users, pph, total posts - Files.activeContent(), //size ans number of files + Files.activeContent(), //size and number of files News.find(maxRecentNews), //some recent newsposts ]); const [ localStats, webringStats ] = totalStats;