Webring proxy support

merge-requests/208/head
fatchan 4 years ago
parent 1c2f5cc440
commit 8d49e2d815
  1. 7
      README.md
  2. 10
      configs/webring.json.example
  3. 3
      package.json
  4. 13
      schedules/webring.js

@ -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

@ -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"
}
}

@ -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",

@ -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];

Loading…
Cancel
Save