]> www.average.org Git - loctrkd.git/commitdiff
allow imei as the document path
authorEugene Crosser <crosser@average.org>
Mon, 23 May 2022 20:23:22 +0000 (22:23 +0200)
committerEugene Crosser <crosser@average.org>
Mon, 23 May 2022 20:23:22 +0000 (22:23 +0200)
webdemo/index.html

index d0af1ac9f940d067148ea5c940520fdcb56dbd96..681ebbf2d44658d8bb6d70b9350bc553381094a6 100644 (file)
        const urlParams = new URLSearchParams(window.location.search);
        const qimei = urlParams.get("imei");
 
-       const ourl = new URL(window.location);
-       const wsproto = ourl.protocol === "https" ? "wss" : "ws";
-       const wshost = ourl.hostname ? ourl.hostname : "localhost";
-       const wsport = ourl.port ? ourl.port : 5049;
+       const wsproto = window.location.protocol === "https" ? "wss" : "ws";
+       const wshost = window.location.hostname ? window.location.hostname
+                                               : "localhost";
+       const wsport = window.location.port ? window.location.port : 5049;
+       const limei = window.location.pathname.substring(1)
 
        const imeis = new Set();
        const locations = new Array();
@@ -47,6 +48,8 @@
                tstamp = document.getElementById("tstamp");
                if (qimei) {
                        imei.value = qimei;
+               } else if (limei) {
+                       imei.value = limei;
                }
                open_ws();
        }