lejianwen 1 year ago
parent
commit
29d6e36d50
1 changed files with 10 additions and 0 deletions
  1. 10 0
      resources/web/js/src/connection.ts

+ 10 - 0
resources/web/js/src/connection.ts

@@ -753,12 +753,22 @@ function getDefaultUri(isRelay: Boolean = false): string {
753
   const host = localStorage.getItem("custom-rendezvous-server");
753
   const host = localStorage.getItem("custom-rendezvous-server");
754
   return getrUriFromRs(host || HOST, isRelay);
754
   return getrUriFromRs(host || HOST, isRelay);
755
 }
755
 }
756
+/*
757
+function isHttps() {
758
+  return window.location.protocol === "https:"
759
+}
760
+
761
+function domain(uri: string) {
762
+    return uri.indexOf(":") > 0 ? uri.split(":")[0] : uri
763
+}*/
756
 
764
 
757
 function getrUriFromRs(
765
 function getrUriFromRs(
758
   uri: string,
766
   uri: string,
759
   isRelay: Boolean = false,
767
   isRelay: Boolean = false,
760
   roffset: number = 0
768
   roffset: number = 0
761
 ): string {
769
 ): string {
770
+    //v2
771
+  //if (isHttps()) return "wss://" + domain(uri) + "/ws/" + (isRelay ? "relay" : "id");
762
   if (uri.indexOf(":") > 0) {
772
   if (uri.indexOf(":") > 0) {
763
     const tmp = uri.split(":");
773
     const tmp = uri.split(":");
764
     const port = parseInt(tmp[1]);
774
     const port = parseInt(tmp[1]);