Use HTTPS_PROXY environment variable for downloading external_api.min.js if set
This commit is contained in:
parent
acca9005a9
commit
7f4f9b2cf1
3 changed files with 24 additions and 1 deletions
|
@ -7,6 +7,7 @@ const fs = require("fs");
|
|||
const path = require("path");
|
||||
const mkdirp = require("mkdirp");
|
||||
const fetch = require("node-fetch");
|
||||
const ProxyAgent = require("simple-proxy-agent");
|
||||
|
||||
console.log("Making webapp directory");
|
||||
mkdirp.sync("webapp");
|
||||
|
@ -14,7 +15,13 @@ mkdirp.sync("webapp");
|
|||
// curl -s https://jitsi.riot.im/libs/external_api.min.js > ./webapp/jitsi_external_api.min.js
|
||||
console.log("Downloading Jitsi script");
|
||||
const fname = path.join("webapp", "jitsi_external_api.min.js");
|
||||
fetch("https://jitsi.riot.im/libs/external_api.min.js").then(res => {
|
||||
|
||||
const options = {};
|
||||
if (process.env.HTTPS_PROXY) {
|
||||
options.agent = new ProxyAgent(process.env.HTTPS_PROXY, { tunnel : true } );
|
||||
}
|
||||
|
||||
fetch("https://jitsi.riot.im/libs/external_api.min.js", options).then(res => {
|
||||
const stream = fs.createWriteStream(fname);
|
||||
return new Promise((resolve, reject) => {
|
||||
res.body.pipe(stream);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue