1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2024-11-14 04:17:30 +00:00

Allow customisation of tor port

This commit is contained in:
Cadence Ember 2021-09-28 16:23:52 +13:00
parent f14837be44
commit a807acc296
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17
2 changed files with 3 additions and 2 deletions

View File

@ -28,6 +28,7 @@ let constants = {
tor: {
enabled: true, // If false, everything else in this block has no effect.
password: null, // If `null`, Bibliogram will run its own Tor process instead.
port: 9051, // If a password is provided, Bibliogram will connect to Tor on this port. (This is ignored when running its own Tor process.)
for: {
user_html: true,
timeline_graphql: false,

View File

@ -51,11 +51,11 @@ module.exports = new Promise(resolve => {
/** @type {import("@deadcanaries/granax/lib/controller")} */
// @ts-ignore
let tor
if (constants.tor.password == null) {
if (constants.tor.password == null || constants.tor.port == null) {
// @ts-ignore
tor = new granax()
} else {
tor = new granax.TorController(connect(9051), {authOnConnect: false})
tor = new granax.TorController(connect(constants.tor.port), {authOnConnect: false})
tor.authenticate(`"${constants.tor.password}"`, err => {
if (err) console.log("Tor auth error:", err)
})