mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: add provideFeature/getFeature API
This commit is contained in:
5 files changed
+34
-21
No files matched your search
@@ -4,9 +4,9 @@ export default class Sock {
|
||||
sock: ReconnectingWebSocket;
|
||||
interval: NodeJS.Timer;
|
||||
|
||||
constructor(public url: string) {
|
||||
constructor(public url: string, nocookie = false) {
|
||||
const i = new URL(url, window.location.href);
|
||||
if (i.host !== window.location.host) i.searchParams.append('sid', document.cookie.split('sid=')[1].split(';')[0]);
|
||||
if (i.host !== window.location.host && !nocookie) i.searchParams.append('sid', document.cookie.split('sid=')[1].split(';')[0]);
|
||||
i.protocol = i.protocol.replace('http', 'ws');
|
||||
this.url = i.toString();
|
||||
this.sock = new ReconnectingWebSocket(this.url, [], {
|
||||
|
||||
Reference in new issue
Block a user