This repository was archived by the owner on May 26, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,13 @@ export default {
8585 lng: coords .x
8686 }
8787 },
88+ hostname (isSocket ) {
89+ if (isSocket) {
90+ return this .isDevelopment ? ' ws://' + window .location .hostname + ' :8080/' : ' wss://' + window .location .hostname + ' :8443/' ;
91+ } else {
92+ return this .isDevelopment ? ' http://' + window .location .hostname + ' :8080/' : ' https://' + window .location .hostname + ' :8443/' ;
93+ }
94+ },
8895 async doMapRefresh (server ) {
8996 const _this = this ;
9097
@@ -93,7 +100,7 @@ export default {
93100 }
94101
95102 try {
96- this .connection = new WebSocket (( this .isDevelopment ? " ws:// " : " wss:// " ) + window . location . hostname + " :8080 /map/go/socket?server=" + encodeURIComponent (server));
103+ this .connection = new WebSocket (this .hostname ( true ) + " /map/go/socket?server=" + encodeURIComponent (server));
97104
98105 this .connection .onmessage = function (event ) {
99106 try {
@@ -257,7 +264,8 @@ export default {
257264
258265 L .Map .addInitHook (" addHandler" , " gestureHandling" , GestureHandling);
259266
260- const _this = this ;
267+ const _this = this ,
268+ url = this .hostname (false );
261269 L .TileLayer .GTA = L .TileLayer .extend ({
262270 getTileUrl : function (coords ) {
263271 coords .x = coords .x < 0 ? 0 : coords .x ;
@@ -292,7 +300,7 @@ export default {
292300 break ;
293301 }
294302
295- return ( _this . isDevelopment ? ' http:// ' : ' https:// ' ) + window . location . hostname + ' :8080 /map/go/tiles/' + coords .z + ' _' + coords .x + ' _' + coords .y + ' .jpg' ;
303+ return url + ' /map/go/tiles/' + coords .z + ' _' + coords .x + ' _' + coords .y + ' .jpg' ;
296304 }
297305 });
298306
You can’t perform that action at this time.
0 commit comments