]> git.bitcoin.ninja Git - satsto.me/commitdiff
Support satsto.me/HRN directly
authorMatt Corallo <git@bluematt.me>
Sat, 7 Sep 2024 17:28:44 +0000 (17:28 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 7 Sep 2024 17:28:44 +0000 (17:28 +0000)
index.html

index 788bb2f319710c3ccc965ffa86651770f9f5d024..f66e9228a8fb0055943ff8d4745d4f19a1aa57de 100644 (file)
                        // Do this before we load the modules to get the default value up quickly
                        window.default_hrn = 'send.some@satsto.me';
                        window.url_set_hrn = 'send.some@satsto.me';
-                       if (document.getElementById("address").value === '') {
-                               if (window.location.search.length > 1 && window.location.search[0] === "?") {
-                                       for (const pair of window.location.search.substring(1).split("&")) {
-                                               const key_value = pair.split("=");
-                                               if (key_value.length === 2 && key_value[0] === "name") {
-                                                       window.url_set_hrn = key_value[1];
-                                               }
+                       if (window.location.pathname.length > 1 && window.location.pathname.indexOf("@") != -1) {
+                               window.url_set_hrn = window.location.pathname.substring(1);
+                       } else if (window.location.search.length > 1 && window.location.search[0] === "?") {
+                               for (const pair of window.location.search.substring(1).split("&")) {
+                                       const key_value = pair.split("=");
+                                       if (key_value.length === 2 && key_value[0] === "name") {
+                                               window.url_set_hrn = key_value[1];
                                        }
                                }
+                       }
+                       if (document.getElementById("address").value === '') {
                                document.getElementById("address").value = window.url_set_hrn;
                        }
                </script>