tweak: add hardcoded proxy as backup
This commit is contained in:
parent
9bda1c2558
commit
76325bcc48
3
package-lock.json
generated
3
package-lock.json
generated
|
@ -20,7 +20,8 @@
|
||||||
"open": "^7.3.1",
|
"open": "^7.3.1",
|
||||||
"papaparse": "^5.3.0",
|
"papaparse": "^5.3.0",
|
||||||
"tabletojson": "^2.0.4",
|
"tabletojson": "^2.0.4",
|
||||||
"textversionjs": "^1.1.3"
|
"textversionjs": "^1.1.3",
|
||||||
|
"tunnel": "^0.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@algolia/cache-browser-local-storage": {
|
"node_modules/@algolia/cache-browser-local-storage": {
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"reload": "heroku run:detached node src/utils/doEverythingForScheduler.js",
|
"reload": "heroku run:detached node src/utils/doEverythingForScheduler.js",
|
||||||
"setCookies": "./src/utils/setCookies.sh"
|
"setCookies": "./src/utils/setCookies.sh"
|
||||||
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -37,6 +36,7 @@
|
||||||
"open": "^7.3.1",
|
"open": "^7.3.1",
|
||||||
"papaparse": "^5.3.0",
|
"papaparse": "^5.3.0",
|
||||||
"tabletojson": "^2.0.4",
|
"tabletojson": "^2.0.4",
|
||||||
"textversionjs": "^1.1.3"
|
"textversionjs": "^1.1.3",
|
||||||
|
"tunnel": "^0.0.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,20 @@ String.prototype.replaceAll = function replaceAll(search, replace) {
|
||||||
/* Body */
|
/* Body */
|
||||||
export async function goodjudgment() {
|
export async function goodjudgment() {
|
||||||
// Proxy fuckery
|
// Proxy fuckery
|
||||||
|
let proxy;
|
||||||
let proxy = await axios
|
try {
|
||||||
.get("http://pubproxy.com/api/proxy")
|
proxy = await axios
|
||||||
.then((query) => query.data);
|
.get("http://pubproxy.com/api/proxy")
|
||||||
console.log(proxy);
|
.then((query) => query.data);
|
||||||
|
console.log(proxy);
|
||||||
|
} catch (error) {
|
||||||
|
console.log("Proxy generation failed; using backup proxy instead");
|
||||||
|
// hard-coded backup proxy
|
||||||
|
proxy = {
|
||||||
|
ip: process.env.BACKUP_PROXY_IP,
|
||||||
|
port: process.env.BACKUP_PROXY_PORT,
|
||||||
|
};
|
||||||
|
}
|
||||||
let agent = tunnel.httpsOverHttp({
|
let agent = tunnel.httpsOverHttp({
|
||||||
proxy: {
|
proxy: {
|
||||||
host: proxy.ip,
|
host: proxy.ip,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd /home/loki/Documents/core/software/fresh/js/metaforecasts/metaforecasts-mongo
|
cd /home/loki/Documents/core/software/fresh/js/metaforecast/metaforecast-backend
|
||||||
date > done.txt
|
date > done.txt
|
||||||
/home/loki/.nvm/versions/node/v16.8.0/bin/node ./src/utils/pullSuperforecastsManually.js >> done.txt
|
/home/loki/.nvm/versions/node/v16.8.0/bin/node ./src/utils/pullSuperforecastsManually.js >> done.txt
|
||||||
|
|
Loading…
Reference in New Issue
Block a user