From 8aacbc7bc5658d7c3bcc9176993b1f4701349341 Mon Sep 17 00:00:00 2001 From: yisier <1340976576@qq.com> Date: Sat, 4 Jul 2026 23:10:14 -0600 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=96=B0=E5=A2=9E=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E9=9A=A7=E9=81=93=E6=97=B6=E9=87=8D=E5=A4=8D=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/changelog/index.md | 3 +++ web/static/js/language.js | 17 ++++++++++++++--- web/views/index/edit.html | 26 ++++++++++++++++++++++++-- web/views/index/hedit.html | 25 ++++++++++++++++++++++++- 4 files changed, 65 insertions(+), 6 deletions(-) diff --git a/docs/changelog/index.md b/docs/changelog/index.md index 043e428..d16c4f6 100644 --- a/docs/changelog/index.md +++ b/docs/changelog/index.md @@ -2,6 +2,9 @@ - 2026-07-04 v0.26.35 - 修复: - HTTP 代理在 SVN 客户端无法正常检出 [#336](https://github.com/yisier/nps/issues/336) + - 新增/编辑隧道时无提示且不跳转,重复点击会产生多条记录 [#334](https://github.com/yisier/nps/issues/334) + - 优化: + - 隧道、域名解析编辑页的客户端 ID 改为下拉选择 [#334](https://github.com/yisier/nps/issues/334) - 2026-06-04 v0.26.34 - 新增: diff --git a/web/static/js/language.js b/web/static/js/language.js index cf432ee..b75259d 100644 --- a/web/static/js/language.js +++ b/web/static/js/language.js @@ -132,25 +132,29 @@ var chartdatas = {}; var postsubmit; function langreply(langstr) { + if (!languages || !languages['content'] || !languages['content']['reply']) return langstr; var langobj = languages['content']['reply'][langstr.replace(/[\s,\.\?]*/g,"").toLowerCase()]; if ($.type(langobj) == 'undefined') return langstr langobj = (langobj[languages['current']] || langobj[languages['default']] || langstr); return langobj } +var nps_submitting = false; function submitform(action, url, postdata) { + if (nps_submitting) return; postsubmit = false; switch (action) { case 'start': case 'stop': case 'delete': case 'copy': - var langobj = languages['content']['confirm'][action]; - action = (langobj[languages['current']] || langobj[languages['default']] || 'Are you sure you want to ' + action + ' it?'); - if (! confirm(action)) return; + var confirmObj = (languages && languages['content'] && languages['content']['confirm']) ? languages['content']['confirm'][action] : null; + var confirmMsg = (confirmObj && (confirmObj[languages['current']] || confirmObj[languages['default']])) || ('Are you sure you want to ' + action + ' it?'); + if (! confirm(confirmMsg)) return; postsubmit = true; case 'add': case 'edit': + nps_submitting = true; $.ajax({ type: "POST", url: url, @@ -164,10 +168,14 @@ function submitform(action, url, postdata) { window.location.href= document.referrer } } + }, + complete: function () { + nps_submitting = false; } }); return; case 'global': + nps_submitting = true; $.ajax({ type: "POST", url: url, @@ -177,6 +185,9 @@ function submitform(action, url, postdata) { if (res.status) { document.location.reload(); } + }, + complete: function () { + nps_submitting = false; } }); } diff --git a/web/views/index/edit.html b/web/views/index/edit.html index 57eae59..9ea1529 100644 --- a/web/views/index/edit.html +++ b/web/views/index/edit.html @@ -35,8 +35,8 @@