From cb1eb0c4e64b5e41f7260731279e50de3b597e9d Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Sun, 9 Feb 2025 11:34:21 +0330 Subject: [PATCH] Fetch IP on page load --- core/scripts/webpanel/templates/settings.html | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/core/scripts/webpanel/templates/settings.html b/core/scripts/webpanel/templates/settings.html index 9f49953..c384a28 100644 --- a/core/scripts/webpanel/templates/settings.html +++ b/core/scripts/webpanel/templates/settings.html @@ -123,11 +123,11 @@
- +
- +
@@ -338,10 +338,29 @@ $("#normal_stop").on("click", stopNormal); $("#sni_change").on("click", changeSNI); $("#ip_change").on("click", saveIP); + + $.ajax({ + url: "{{ url_for('get_ip_api') }}", + type: "GET", + success: function (data) { + $("#ipv4").val(data.ipv4 || ""); + $("#ipv6").val(data.ipv6 || ""); + + $("#ipv4").attr("placeholder", "Enter IPv4"); + $("#ipv6").attr("placeholder", "Enter IPv6"); + + + }, + error: function () { + console.error("Failed to fetch IP addresses."); + $("#ipv4").attr("placeholder", "Enter IPv4"); + $("#ipv6").attr("placeholder", "Enter IPv6"); + } + }); }); -{% endblock %} \ No newline at end of file +{% endblock %}