Skip to content

Commit

Permalink
move environment variables to api
Browse files Browse the repository at this point in the history
  • Loading branch information
mertushka committed Aug 25, 2022
1 parent 2e2bc05 commit 45771b2
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@ const { Crypto } = require("@peculiar/webcrypto");
const { performance } = require("perf_hooks");
const crypto = new Crypto();

const proxy = process.env.PROXY
let proxyAgent;
if (proxy) {
if (!proxy.startsWith("http")) {
proxy = "http://"+proxy
}
console.log(`Using proxy: ${proxy}`)
proxyAgent = new HttpsProxyAgent(url.parse(proxy));
}
var proxyAgent;
var debug = false;

const headless = new Promise((resolve) => {
(function (cb) {
Expand Down Expand Up @@ -723,19 +716,18 @@ const headless = new Promise((resolve) => {
"Sec-WebSocket-Extensions":
"permessage-deflate; client_max_window_bits",
},
agent: proxyAgent
agent: proxyAgent,
});
d.ta.binaryType = "arraybuffer";

d.ta.on("open", () => {
d.Og();
});
d.ta.on("close", (a) => {
process.env.VERBOSE && console.log(a)
d.xd(4001 != a);
});
d.ta.on("error", (e) => {
process.env.VERBOSE && console.error(e)
debug && console.log(e);
d.xd(!0);
});
d.ta.on("message", Ua(d, d.Ng));
Expand Down Expand Up @@ -2078,6 +2070,12 @@ const headless = new Promise((resolve) => {
}
if (y.tf) throw new l("Can't init twice");
y.tf = !0;

proxyAgent = m("proxy", null)
? new HttpsProxyAgent(url.parse(m("proxy", null)))
: null;
debug = m("debug", null) == true;

var q = !m("public", !1),
g = h("roomName", "Headless Room"),
eb = h("playerName", "Host"),
Expand Down

0 comments on commit 45771b2

Please sign in to comment.