This commit is contained in:
Lamp 2023-10-09 14:59:31 -05:00
parent 41a1f0533f
commit 6b29918703
1 changed files with 6 additions and 6 deletions

View File

@ -74,13 +74,13 @@ Client.prototype.connect = function() {
return;
this.emit("status", "Connecting...");
if(typeof module !== "undefined") {
let headers = {
"origin": `https://${new URL(this.uri).host}`,
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36"
};
if (this.uri.includes("multiplayerpiano.com")) headers["X-Forwarded-For"] = `${Math.floor(Math.random() * 256)}.${Math.floor(Math.random() * 256)}.${Math.floor(Math.random() * 256)}.${Math.floor(Math.random() * 256)}`;
// nodejsicle
this.ws = new WebSocket(this.uri, {
headers: {
"origin": `https://${new URL(this.uri).host}`,
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36"
}
});
this.ws = new WebSocket(this.uri, {headers});
} else {
// browseroni
this.ws = new WebSocket(this.uri);