mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-05 13:10:07 +00:00
✨ 优化忽略规则配置和 Agent 获取 IP
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 9.6 KiB |
@@ -41,61 +41,53 @@ function showFormModal(modelSelector, formID, URL, getData) {
|
||||
const data = getData
|
||||
? getData()
|
||||
: $(formID)
|
||||
.serializeArray()
|
||||
.reduce(function (obj, item) {
|
||||
// ID 类的数据
|
||||
if (
|
||||
item.name.endsWith("_id") ||
|
||||
item.name === "id" ||
|
||||
item.name === "ID" ||
|
||||
item.name === "RequestType" ||
|
||||
item.name === "RequestMethod" ||
|
||||
item.name === "DisplayIndex" ||
|
||||
item.name === "Type"
|
||||
) {
|
||||
obj[item.name] = parseInt(item.value);
|
||||
} else {
|
||||
obj[item.name] = item.value;
|
||||
}
|
||||
.serializeArray()
|
||||
.reduce(function (obj, item) {
|
||||
// ID 类的数据
|
||||
if (
|
||||
item.name.endsWith("_id") ||
|
||||
item.name === "id" ||
|
||||
item.name === "ID" ||
|
||||
item.name === "RequestType" ||
|
||||
item.name === "RequestMethod" ||
|
||||
item.name === "DisplayIndex" ||
|
||||
item.name === "Type" ||
|
||||
item.name === "Cover"
|
||||
) {
|
||||
obj[item.name] = parseInt(item.value);
|
||||
} else {
|
||||
obj[item.name] = item.value;
|
||||
}
|
||||
|
||||
if (item.name.endsWith("ServersRaw")) {
|
||||
if (item.value.length > 2) {
|
||||
obj[item.name] = JSON.stringify(
|
||||
[...item.value.matchAll(/\d+/gm)].map((k) =>
|
||||
parseInt(k[0])
|
||||
)
|
||||
);
|
||||
}
|
||||
if (item.name.endsWith("ServersRaw")) {
|
||||
if (item.value.length > 2) {
|
||||
obj[item.name] = JSON.stringify(
|
||||
[...item.value.matchAll(/\d+/gm)].map((k) =>
|
||||
parseInt(k[0])
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}, {});
|
||||
return obj;
|
||||
}, {});
|
||||
$.post(URL, JSON.stringify(data))
|
||||
.done(function (resp) {
|
||||
if (resp.code == 200) {
|
||||
if (resp.message) {
|
||||
$.suiAlert({
|
||||
title: "操作成功",
|
||||
type: "success",
|
||||
description: resp.message,
|
||||
time: "3",
|
||||
position: "top-center",
|
||||
});
|
||||
}
|
||||
window.location.reload();
|
||||
window.location.reload()
|
||||
} else {
|
||||
form.append(
|
||||
`<div class="ui negative message"><div class="header">操作失败</div><p>` +
|
||||
resp.message +
|
||||
`</p></div>`
|
||||
resp.message +
|
||||
`</p></div>`
|
||||
);
|
||||
}
|
||||
})
|
||||
.fail(function (err) {
|
||||
form.append(
|
||||
`<div class="ui negative message"><div class="header">网络错误</div><p>` +
|
||||
err.responseText +
|
||||
`</p></div>`
|
||||
err.responseText +
|
||||
`</p></div>`
|
||||
);
|
||||
})
|
||||
.always(function () {
|
||||
@@ -197,6 +189,7 @@ function addOrEditMonitor(monitor) {
|
||||
modal.find("input[name=Name]").val(monitor ? monitor.Name : null);
|
||||
modal.find("input[name=Target]").val(monitor ? monitor.Target : null);
|
||||
modal.find("select[name=Type]").val(monitor ? monitor.Type : 1);
|
||||
modal.find("select[name=Cover]").val(monitor ? monitor.Cover : 0);
|
||||
if (monitor && monitor.Notify) {
|
||||
modal.find(".ui.nb-notify.checkbox").checkbox("set checked");
|
||||
} else {
|
||||
@@ -210,10 +203,10 @@ function addOrEditMonitor(monitor) {
|
||||
for (let i = 0; i < serverList.length; i++) {
|
||||
node.after(
|
||||
'<a class="ui label transition visible" data-value="' +
|
||||
serverList[i] +
|
||||
'" style="display: inline-block !important;">ID:' +
|
||||
serverList[i] +
|
||||
'<i class="delete icon"></i></a>'
|
||||
serverList[i] +
|
||||
'" style="display: inline-block !important;">ID:' +
|
||||
serverList[i] +
|
||||
'<i class="delete icon"></i></a>'
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -245,10 +238,10 @@ function addOrEditCron(cron) {
|
||||
for (let i = 0; i < serverList.length; i++) {
|
||||
node.after(
|
||||
'<a class="ui label transition visible" data-value="' +
|
||||
serverList[i] +
|
||||
'" style="display: inline-block !important;">ID:' +
|
||||
serverList[i] +
|
||||
'<i class="delete icon"></i></a>'
|
||||
serverList[i] +
|
||||
'" style="display: inline-block !important;">ID:' +
|
||||
serverList[i] +
|
||||
'<i class="delete icon"></i></a>'
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -367,5 +360,5 @@ $(document).ready(() => {
|
||||
cache: false,
|
||||
},
|
||||
});
|
||||
} catch (error) {}
|
||||
} catch (error) { }
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user