Add alternative method to fetch user
This commit is contained in:
@@ -44,12 +44,12 @@ 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) {
|
||||
// @ts-ignore
|
||||
tor = new granax()
|
||||
} else {
|
||||
tor = new granax.TorController(connect(9051), {authOnConnect: false})
|
||||
tor.authenticate(`"${constants.tor_password}"`, err => {
|
||||
tor.authenticate(`"${constants.tor.password}"`, err => {
|
||||
if (err) console.log("Tor auth error:", err)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ class TorSwitcher {
|
||||
* @returns {Promise<T>}
|
||||
* @template T the return value of the test function
|
||||
*/
|
||||
request(url, test) {
|
||||
if (this.torManager) {
|
||||
request(type, url, test) {
|
||||
if (this.torManager && constants.tor.for[type]) {
|
||||
return this.torManager.request(url, test)
|
||||
} else {
|
||||
return request(url).then(res => test(res))
|
||||
@@ -32,7 +32,7 @@ class TorSwitcher {
|
||||
|
||||
const switcher = new TorSwitcher()
|
||||
|
||||
if (constants.use_tor) {
|
||||
if (constants.tor.enabled) {
|
||||
require("./tor").then(torManager => {
|
||||
if (torManager) switcher.setManager(torManager)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user