diff --git a/README.md b/README.md index 4dbd5ec1..85e1676d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Anonymous imageboard software. - [x] Read-only JSON api - [x] Multi-select moderation actions - [x] Websocket update threads w/o polling -- [x] Webring support ([lynxchan](https://gitlab.com/alogware/LynxChanAddon-Webring)) ([infinity](https://gitlab.com/Tenicu/infinityaddon-webring)) +- [x] Webring w/proxy support ([lynxchan](https://gitlab.com/alogware/LynxChanAddon-Webring)) ([infinity](https://gitlab.com/Tenicu/infinityaddon-webring)) ## Todo - Support running as a hidden service @@ -108,3 +108,8 @@ $ gulp --tasks #list available gulp tasks $ gulp migrate #check for and run db migrations $ gulp #run default gulp task ``` + +8. Optionally, if you plan to use the webring and want to make requests with tor to mask your origin server IP: +Install docker and run torproxy in a container: https://github.com/dperson/torproxy +Edit configs/webring.json and wer proxy enabled:true + diff --git a/configs/webring.json.example b/configs/webring.json.example index 5e30a0cf..d71899af 100644 --- a/configs/webring.json.example +++ b/configs/webring.json.example @@ -5,7 +5,11 @@ "blacklist": [ "badwebsite.com", ], - "logo": [ - "https://yourdomain.com/favicon.ico" - ] + "logo": [ + "https://yourdomain.com/favicon.ico" + ], + "proxy": { + "enabled": false, + "address": "socks5h://localhost:9050" + } } diff --git a/package.json b/package.json index 4fde8806..b691ef0b 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ "sanitize-html": "^1.21.1", "saslprep": "^1.0.3", "socket.io": "^2.3.0", - "socket.io-redis": "^5.2.0" + "socket.io-redis": "^5.2.0", + "socks-proxy-agent": "^5.0.0" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", diff --git a/schedules/webring.js b/schedules/webring.js index 85c5b0f8..7eadbedc 100644 --- a/schedules/webring.js +++ b/schedules/webring.js @@ -2,12 +2,14 @@ const fetch = require('node-fetch') , { debugLogs, meta } = require(__dirname+'/../configs/main.js') - , { logo, following, blacklist } = require(__dirname+'/../configs/webring.json') + , { logo, following, blacklist, proxy } = require(__dirname+'/../configs/webring.json') , { Boards, Webring } = require(__dirname+'/../db/') , { outputFile } = require('fs-extra') , cache = require(__dirname+'/../redis.js') , uploadDirectory = require(__dirname+'/../helpers/files/uploadDirectory.js') - , timeDiffString = require(__dirname+'/../helpers/timediffstring.js'); + , timeDiffString = require(__dirname+'/../helpers/timediffstring.js') + , SocksProxyAgent = proxy.enabled ? require('socks-proxy-agent') : null + , agent = SocksProxyAgent ? new SocksProxyAgent(require('url').parse(proxy.address)) : null module.exports = async () => { const label = `updating webring`; @@ -21,7 +23,12 @@ module.exports = async () => { const toVisit = [...known].filter(url => !visited.has(url)); let rings = await Promise.all(toVisit.map(url => { visited.add(url); - return fetch(url, {headers:{'User-Agent':''}}).then(res => res.json()).catch(e => console.error); + return fetch(url, { + agent, + headers: { + 'User-Agent':'' + } + }).then(res => res.json()).catch(e => console.error); })); for (let i = 0; i < rings.length; i++) { const ring = rings[i];