Add token + 2.0.4

This commit is contained in:
Soph :3 2024-12-28 02:47:56 +02:00
parent b9aa613e1d
commit f3c87e1c84
Signed by: sophie
GPG key ID: EDA5D222A0C270F2
2 changed files with 3 additions and 3 deletions

View file

@ -124,12 +124,12 @@ export class Client extends (EventEmitter as new () => TypedEmitter<MessageEvent
}).toBinary()
);
}
constructor(url: string) {
constructor(url: string, token?: string) {
super();
this.ws = new WebSocket(url.replace("http", "ws"), {
//@ts-expect-error
headers: {
Origin: url,
Origin: url + (token ? ("?t=" + token) : ""),
"User-Agent": new UserAgent().toString(),
},
protocol: "pianoverse",

View file

@ -2,7 +2,7 @@
"name": "pianoverse",
"module": "index.ts",
"type": "module",
"version": "v2.0.3",
"version": "v2.0.4",
"license": "GPL-3.0-only",
"homepage": "https://git.sad.ovh/sophie/pianoverse",
"bugs": "https://git.sad.ovh/sophie/pianoverse/issues",