fix 403
This commit is contained in:
parent
41a1f0533f
commit
6b29918703
|
@ -74,13 +74,13 @@ Client.prototype.connect = function() {
|
|||
return;
|
||||
this.emit("status", "Connecting...");
|
||||
if(typeof module !== "undefined") {
|
||||
// nodejsicle
|
||||
this.ws = new WebSocket(this.uri, {
|
||||
headers: {
|
||||
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});
|
||||
} else {
|
||||
// browseroni
|
||||
this.ws = new WebSocket(this.uri);
|
||||
|
|
Loading…
Reference in New Issue