mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-06 21:50:05 +00:00
ddns: store configuation in database (#435)
* ddns: store configuation in database Co-authored-by: nap0o <144927971+nap0o@users.noreply.github.com> * feat: split domain with soa lookup * switch to libdns interface * ddns: add unit test * ddns: skip TestSplitDomainSOA on ci network is not steady * fix error handling * fix error handling --------- Co-authored-by: nap0o <144927971+nap0o@users.noreply.github.com>
This commit is contained in:
51
resource/l10n/en-US.toml
vendored
51
resource/l10n/en-US.toml
vendored
@@ -622,20 +622,59 @@ other = "Network"
|
||||
[EnableShowInService]
|
||||
other = "Enable Show in Service"
|
||||
|
||||
[DDNS]
|
||||
other = "Dynamic DNS"
|
||||
|
||||
[DDNSProfiles]
|
||||
other = "DDNS Profiles"
|
||||
|
||||
[AddDDNSProfile]
|
||||
other = "New Profile"
|
||||
|
||||
[EnableDDNS]
|
||||
other = "Enable DDNS"
|
||||
|
||||
[EnableIPv4]
|
||||
other = "Enable DDNS IPv4"
|
||||
other = "IPv4 Enabled"
|
||||
|
||||
[EnableIpv6]
|
||||
other = "Enable DDNS IPv6"
|
||||
[EnableIPv6]
|
||||
other = "IPv6 Enabled"
|
||||
|
||||
[DDNSDomain]
|
||||
other = "DDNS Domain"
|
||||
other = "Domains"
|
||||
|
||||
[DDNSProfile]
|
||||
other = "DDNS Profile Name"
|
||||
[DDNSDomains]
|
||||
other = "Domains (separate with comma)"
|
||||
|
||||
[DDNSProvider]
|
||||
other = "DDNS Provider"
|
||||
|
||||
[MaxRetries]
|
||||
other = "Maximum retry attempts"
|
||||
|
||||
[DDNSAccessID]
|
||||
other = "Credential 1"
|
||||
|
||||
[DDNSAccessSecret]
|
||||
other = "Credential 2"
|
||||
|
||||
[DDNSTokenID]
|
||||
other = "Token ID"
|
||||
|
||||
[DDNSTokenSecret]
|
||||
other = "Token Secret"
|
||||
|
||||
[WebhookURL]
|
||||
other = "Webhook URL"
|
||||
|
||||
[WebhookMethod]
|
||||
other = "Webhook Request Method"
|
||||
|
||||
[WebhookHeaders]
|
||||
other = "Webhook Request Headers"
|
||||
|
||||
[WebhookRequestBody]
|
||||
other = "Webhook Request Body"
|
||||
|
||||
[Feature]
|
||||
other = "Feature"
|
||||
|
||||
51
resource/l10n/es-ES.toml
vendored
51
resource/l10n/es-ES.toml
vendored
@@ -622,20 +622,59 @@ other = "Red"
|
||||
[EnableShowInService]
|
||||
other = "Mostrar en servicio"
|
||||
|
||||
[DDNS]
|
||||
other = "DNS Dinámico"
|
||||
|
||||
[DDNSProfiles]
|
||||
other = "Perfiles DDNS"
|
||||
|
||||
[AddDDNSProfile]
|
||||
other = "Nuevo Perfil"
|
||||
|
||||
[EnableDDNS]
|
||||
other = "Habilitar DDNS"
|
||||
|
||||
[EnableIPv4]
|
||||
other = "Habilitar DDNS IPv4"
|
||||
other = "IPv4 Activado"
|
||||
|
||||
[EnableIpv6]
|
||||
other = "Habilitar DDNS IPv6"
|
||||
[EnableIPv6]
|
||||
other = "IPv6 Activado"
|
||||
|
||||
[DDNSDomain]
|
||||
other = "Dominio DDNS"
|
||||
other = "Dominios"
|
||||
|
||||
[DDNSProfile]
|
||||
other = "Nombre del perfil de DDNS"
|
||||
[DDNSDomains]
|
||||
other = "Dominios (separados por comas)"
|
||||
|
||||
[DDNSProvider]
|
||||
other = "Proveedor DDNS"
|
||||
|
||||
[MaxRetries]
|
||||
other = "Número máximo de intentos de reintento"
|
||||
|
||||
[DDNSAccessID]
|
||||
other = "Credencial 1"
|
||||
|
||||
[DDNSAccessSecret]
|
||||
other = "Credencial 2"
|
||||
|
||||
[DDNSTokenID]
|
||||
other = "ID del Token"
|
||||
|
||||
[DDNSTokenSecret]
|
||||
other = "Secreto del Token"
|
||||
|
||||
[WebhookURL]
|
||||
other = "URL del Webhook"
|
||||
|
||||
[WebhookMethod]
|
||||
other = "Método de Solicitud del Webhook"
|
||||
|
||||
[WebhookHeaders]
|
||||
other = "Encabezados de Solicitud del Webhook"
|
||||
|
||||
[WebhookRequestBody]
|
||||
other = "Cuerpo de Solicitud del Webhook"
|
||||
|
||||
[Feature]
|
||||
other = "Característica"
|
||||
|
||||
45
resource/l10n/zh-CN.toml
vendored
45
resource/l10n/zh-CN.toml
vendored
@@ -622,20 +622,59 @@ other = "网络"
|
||||
[EnableShowInService]
|
||||
other = "在服务中显示"
|
||||
|
||||
[DDNS]
|
||||
other = "动态 DNS"
|
||||
|
||||
[DDNSProfiles]
|
||||
other = "DDNS配置"
|
||||
|
||||
[AddDDNSProfile]
|
||||
other = "新配置"
|
||||
|
||||
[EnableDDNS]
|
||||
other = "启用DDNS"
|
||||
|
||||
[EnableIPv4]
|
||||
other = "启用DDNS IPv4"
|
||||
|
||||
[EnableIpv6]
|
||||
[EnableIPv6]
|
||||
other = "启用DDNS IPv6"
|
||||
|
||||
[DDNSDomain]
|
||||
other = "DDNS域名"
|
||||
|
||||
[DDNSProfile]
|
||||
other = "DDNS配置名"
|
||||
[DDNSDomains]
|
||||
other = "域名(逗号分隔)"
|
||||
|
||||
[DDNSProvider]
|
||||
other = "DDNS供应商"
|
||||
|
||||
[MaxRetries]
|
||||
other = "最大重试次数"
|
||||
|
||||
[DDNSAccessID]
|
||||
other = "DDNS 凭据 1"
|
||||
|
||||
[DDNSAccessSecret]
|
||||
other = "DDNS 凭据 2"
|
||||
|
||||
[DDNSTokenID]
|
||||
other = "令牌 ID"
|
||||
|
||||
[DDNSTokenSecret]
|
||||
other = "令牌 Secret"
|
||||
|
||||
[WebhookURL]
|
||||
other = "Webhook 地址"
|
||||
|
||||
[WebhookMethod]
|
||||
other = "Webhook 请求方式"
|
||||
|
||||
[WebhookHeaders]
|
||||
other = "Webhook 请求头"
|
||||
|
||||
[WebhookRequestBody]
|
||||
other = "Webhook 请求体"
|
||||
|
||||
[Feature]
|
||||
other = "功能"
|
||||
|
||||
47
resource/l10n/zh-TW.toml
vendored
47
resource/l10n/zh-TW.toml
vendored
@@ -622,20 +622,59 @@ other = "網路"
|
||||
[EnableShowInService]
|
||||
other = "在服務中顯示"
|
||||
|
||||
[DDNS]
|
||||
other = "動態 DNS"
|
||||
|
||||
[DDNSProfiles]
|
||||
other = "DDNS配置"
|
||||
|
||||
[AddDDNSProfile]
|
||||
other = "新增配置"
|
||||
|
||||
[EnableDDNS]
|
||||
other = "啟用DDNS"
|
||||
|
||||
[EnableIPv4]
|
||||
other = "啟用DDNS IPv4"
|
||||
|
||||
[EnableIpv6]
|
||||
[EnableIPv6]
|
||||
other = "啟用DDNS IPv6"
|
||||
|
||||
[DDNSDomain]
|
||||
other = "DDNS網域"
|
||||
other = "DDNS域名"
|
||||
|
||||
[DDNSProfile]
|
||||
other = "DDNS設定名"
|
||||
[DDNSDomains]
|
||||
other = "域名(逗號分隔)"
|
||||
|
||||
[DDNSProvider]
|
||||
other = "DDNS供應商"
|
||||
|
||||
[MaxRetries]
|
||||
other = "最大重試次數"
|
||||
|
||||
[DDNSAccessID]
|
||||
other = "DDNS憑據1"
|
||||
|
||||
[DDNSAccessSecret]
|
||||
other = "DDNS憑據2"
|
||||
|
||||
[DDNSTokenID]
|
||||
other = "令牌ID"
|
||||
|
||||
[DDNSTokenSecret]
|
||||
other = "令牌Secret"
|
||||
|
||||
[WebhookURL]
|
||||
other = "Webhook地址"
|
||||
|
||||
[WebhookMethod]
|
||||
other = "Webhook請求方式"
|
||||
|
||||
[WebhookHeaders]
|
||||
other = "Webhook請求頭"
|
||||
|
||||
[WebhookRequestBody]
|
||||
other = "Webhook請求體"
|
||||
|
||||
[Feature]
|
||||
other = "功能"
|
||||
|
||||
@@ -99,7 +99,10 @@ function showFormModal(modelSelector, formID, URL, getData) {
|
||||
item.name === "DisplayIndex" ||
|
||||
item.name === "Type" ||
|
||||
item.name === "Cover" ||
|
||||
item.name === "Duration"
|
||||
item.name === "Duration" ||
|
||||
item.name === "MaxRetries" ||
|
||||
item.name === "Provider" ||
|
||||
item.name === "WebhookMethod"
|
||||
) {
|
||||
obj[item.name] = parseInt(item.value);
|
||||
} else if (item.name.endsWith("Latency")) {
|
||||
@@ -128,6 +131,16 @@ function showFormModal(modelSelector, formID, URL, getData) {
|
||||
}
|
||||
}
|
||||
|
||||
if (item.name.endsWith("DDNSProfilesRaw")) {
|
||||
if (item.value.length > 2) {
|
||||
obj[item.name] = JSON.stringify(
|
||||
[...item.value.matchAll(/\d+/gm)].map((k) =>
|
||||
parseInt(k[0])
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}, {});
|
||||
$.post(URL, JSON.stringify(data))
|
||||
@@ -207,6 +220,7 @@ function addOrEditAlertRule(rule) {
|
||||
);
|
||||
}
|
||||
}
|
||||
// 需要在 showFormModal 进一步拼接数组
|
||||
modal
|
||||
.find("input[name=FailTriggerTasksRaw]")
|
||||
.val(rule ? "[]," + failTriggerTasks.substr(1, failTriggerTasks.length - 2) : "[]");
|
||||
@@ -256,6 +270,52 @@ function addOrEditNotification(notification) {
|
||||
);
|
||||
}
|
||||
|
||||
function addOrEditDDNS(ddns) {
|
||||
const modal = $(".ddns.modal");
|
||||
modal.children(".header").text((ddns ? LANG.Edit : LANG.Add));
|
||||
modal
|
||||
.find(".nezha-primary-btn.button")
|
||||
.html(
|
||||
ddns
|
||||
? LANG.Edit + '<i class="edit icon"></i>'
|
||||
: LANG.Add + '<i class="add icon"></i>'
|
||||
);
|
||||
modal.find("input[name=ID]").val(ddns ? ddns.ID : null);
|
||||
modal.find("input[name=Name]").val(ddns ? ddns.Name : null);
|
||||
modal.find("input[name=DomainsRaw]").val(ddns ? ddns.DomainsRaw : null);
|
||||
modal.find("input[name=AccessID]").val(ddns ? ddns.AccessID : null);
|
||||
modal.find("input[name=AccessSecret]").val(ddns ? ddns.AccessSecret : null);
|
||||
modal.find("input[name=MaxRetries]").val(ddns ? ddns.MaxRetries : 3);
|
||||
modal.find("input[name=WebhookURL]").val(ddns ? ddns.WebhookURL : null);
|
||||
modal
|
||||
.find("textarea[name=WebhookHeaders]")
|
||||
.val(ddns ? ddns.WebhookHeaders : null);
|
||||
modal
|
||||
.find("textarea[name=WebhookRequestBody]")
|
||||
.val(ddns ? ddns.WebhookRequestBody : null);
|
||||
modal
|
||||
.find("select[name=Provider]")
|
||||
.val(ddns ? ddns.Provider : 0);
|
||||
modal
|
||||
.find("select[name=WebhookMethod]")
|
||||
.val(ddns ? ddns.WebhookMethod : 1);
|
||||
if (ddns && ddns.EnableIPv4) {
|
||||
modal.find(".ui.enableipv4.checkbox").checkbox("set checked");
|
||||
} else {
|
||||
modal.find(".ui.enableipv4.checkbox").checkbox("set unchecked");
|
||||
}
|
||||
if (ddns && ddns.EnableIPv6) {
|
||||
modal.find(".ui.enableipv6.checkbox").checkbox("set checked");
|
||||
} else {
|
||||
modal.find(".ui.enableipv6.checkbox").checkbox("set unchecked");
|
||||
}
|
||||
showFormModal(
|
||||
".ddns.modal",
|
||||
"#ddnsForm",
|
||||
"/api/ddns"
|
||||
);
|
||||
}
|
||||
|
||||
function addOrEditNAT(nat) {
|
||||
const modal = $(".nat.modal");
|
||||
modal.children(".header").text((nat ? LANG.Edit : LANG.Add));
|
||||
@@ -325,8 +385,33 @@ function addOrEditServer(server, conf) {
|
||||
modal.find("input[name=id]").val(server ? server.ID : null);
|
||||
modal.find("input[name=name]").val(server ? server.Name : null);
|
||||
modal.find("input[name=Tag]").val(server ? server.Tag : null);
|
||||
modal.find("input[name=DDNSDomain]").val(server ? server.DDNSDomain : null);
|
||||
modal.find("input[name=DDNSProfile]").val(server ? server.DDNSProfile : null);
|
||||
modal.find("a.ui.label.visible").each((i, el) => {
|
||||
el.remove();
|
||||
});
|
||||
var ddns;
|
||||
if (server) {
|
||||
ddns = server.DDNSProfilesRaw;
|
||||
let serverList;
|
||||
try {
|
||||
serverList = JSON.parse(ddns);
|
||||
} catch (error) {
|
||||
serverList = "[]";
|
||||
}
|
||||
const node = modal.find("i.dropdown.icon.ddnsProfiles");
|
||||
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>'
|
||||
);
|
||||
}
|
||||
}
|
||||
// 需要在 showFormModal 进一步拼接数组
|
||||
modal
|
||||
.find("input[name=DDNSProfilesRaw]")
|
||||
.val(server ? "[]," + ddns.substr(1, ddns.length - 2) : "[]");
|
||||
modal
|
||||
.find("input[name=DisplayIndex]")
|
||||
.val(server ? server.DisplayIndex : null);
|
||||
@@ -342,26 +427,17 @@ function addOrEditServer(server, conf) {
|
||||
modal.find(".command.field").attr("style", "display:none");
|
||||
modal.find("input[name=secret]").val("");
|
||||
}
|
||||
if (server && server.HideForGuest) {
|
||||
modal.find(".ui.hideforguest.checkbox").checkbox("set checked");
|
||||
} else {
|
||||
modal.find(".ui.hideforguest.checkbox").checkbox("set unchecked");
|
||||
}
|
||||
if (server && server.EnableDDNS) {
|
||||
modal.find(".ui.enableddns.checkbox").checkbox("set checked");
|
||||
} else {
|
||||
modal.find(".ui.enableddns.checkbox").checkbox("set unchecked");
|
||||
}
|
||||
if (server && server.EnableIPv4) {
|
||||
modal.find(".ui.enableipv4.checkbox").checkbox("set checked");
|
||||
if (server && server.HideForGuest) {
|
||||
modal.find(".ui.hideforguest.checkbox").checkbox("set checked");
|
||||
} else {
|
||||
modal.find(".ui.enableipv4.checkbox").checkbox("set unchecked");
|
||||
}
|
||||
if (server && server.EnableIpv6) {
|
||||
modal.find(".ui.enableipv6.checkbox").checkbox("set checked");
|
||||
} else {
|
||||
modal.find(".ui.enableipv6.checkbox").checkbox("set unchecked");
|
||||
modal.find(".ui.hideforguest.checkbox").checkbox("set unchecked");
|
||||
}
|
||||
|
||||
showFormModal(".server.modal", "#serverForm", "/api/server");
|
||||
}
|
||||
|
||||
@@ -447,6 +523,7 @@ function addOrEditMonitor(monitor) {
|
||||
);
|
||||
}
|
||||
}
|
||||
// 需要在 showFormModal 进一步拼接数组
|
||||
modal
|
||||
.find("input[name=FailTriggerTasksRaw]")
|
||||
.val(monitor ? "[]," + failTriggerTasks.substr(1, failTriggerTasks.length - 2) : "[]");
|
||||
@@ -492,6 +569,7 @@ function addOrEditCron(cron) {
|
||||
);
|
||||
}
|
||||
}
|
||||
// 需要在 showFormModal 进一步拼接数组
|
||||
modal
|
||||
.find("input[name=ServersRaw]")
|
||||
.val(cron ? "[]," + servers.substr(1, servers.length - 2) : "[]");
|
||||
@@ -621,3 +699,15 @@ $(document).ready(() => {
|
||||
});
|
||||
} catch (error) { }
|
||||
});
|
||||
|
||||
$(document).ready(() => {
|
||||
try {
|
||||
$(".ui.ddns.search.dropdown").dropdown({
|
||||
clearable: true,
|
||||
apiSettings: {
|
||||
url: "/api/search-ddns?word={query}",
|
||||
cache: false,
|
||||
},
|
||||
});
|
||||
} catch (error) { }
|
||||
});
|
||||
|
||||
2
resource/template/common/footer.html
vendored
2
resource/template/common/footer.html
vendored
@@ -10,7 +10,7 @@
|
||||
<script src="https://unpkg.com/semantic-ui@2.4.0/dist/semantic.min.js"></script>
|
||||
<script src="/static/semantic-ui-alerts.min.js"></script>
|
||||
<script src="https://unpkg.com/vue@2.6.14/dist/vue.min.js"></script>
|
||||
<script src="/static/main.js?v2024927"></script>
|
||||
<script src="/static/main.js?v20241011"></script>
|
||||
<script>
|
||||
(function () {
|
||||
updateLang({{.LANG }});
|
||||
|
||||
1
resource/template/common/menu.html
vendored
1
resource/template/common/menu.html
vendored
@@ -9,6 +9,7 @@
|
||||
<a class='item{{if eq .MatchedPath "/monitor"}} active{{end}}' href="/monitor"><i class="rss icon"></i>{{tr "Services"}}</a>
|
||||
<a class='item{{if eq .MatchedPath "/cron"}} active{{end}}' href="/cron"><i class="clock icon"></i>{{tr "Task"}}</a>
|
||||
<a class='item{{if eq .MatchedPath "/notification"}} active{{end}}' href="/notification"><i class="bell icon"></i>{{tr "Notification"}}</a>
|
||||
<a class='item{{if eq .MatchedPath "/ddns"}} active{{end}}' href="/ddns"><i class="globe icon"></i>{{tr "DDNS"}}</a>
|
||||
<a class='item{{if eq .MatchedPath "/nat"}} active{{end}}' href="/nat"><i class="exchange icon"></i>{{tr "NAT"}}</a>
|
||||
<a class='item{{if eq .MatchedPath "/setting"}} active{{end}}' href="/setting">
|
||||
<i class="settings icon"></i>{{tr "Settings"}}
|
||||
|
||||
79
resource/template/component/ddns.html
vendored
Normal file
79
resource/template/component/ddns.html
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
{{define "component/ddns"}}
|
||||
<div class="ui tiny ddns modal transition hidden">
|
||||
<div class="header">Add</div>
|
||||
<div class="content">
|
||||
<form id="ddnsForm" class="ui form">
|
||||
<input type="hidden" name="ID">
|
||||
<div class="field">
|
||||
<label>{{tr "Name"}}</label>
|
||||
<input type="text" name="Name">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{tr "DDNSProvider"}}</label>
|
||||
<select name="Provider" class="ui fluid dropdown" id="providerSelect" onchange="toggleFields()">
|
||||
{{ range $provider := .ProviderList }}
|
||||
<option value="{{ $provider.ID }}">
|
||||
{{ $provider.Name }}
|
||||
</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{tr "DDNSDomains"}}</label>
|
||||
<input type="text" name="DomainsRaw" placeholder="www.example.com">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{tr "DDNSAccessID"}}</label>
|
||||
<input type="text" name="AccessID" placeholder="{{tr "DDNSTokenID"}}">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{tr "DDNSAccessSecret"}}</label>
|
||||
<input type="text" name="AccessSecret" placeholder="{{tr "DDNSTokenSecret"}}">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{tr "MaxRetries"}}</label>
|
||||
<input type="number" name="MaxRetries" placeholder="3">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{tr "WebhookURL"}}</label>
|
||||
<input type="text" name="WebhookURL" placeholder="https://ddns.example.com/?record=#record#">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{tr "WebhookMethod"}}</label>
|
||||
<select name="WebhookMethod" class="ui fluid dropdown">
|
||||
<option value="1">GET</option>
|
||||
<option value="2">POST</option>
|
||||
<option value="3">PATCH</option>
|
||||
<option value="4">DELETE</option>
|
||||
<option value="5">PUT</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{tr "WebhookHeaders"}}</label>
|
||||
<textarea name="WebhookHeaders" placeholder='{"User-Agent":"Nezha-Agent"}'></textarea>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{tr "WebhookRequestBody"}}</label>
|
||||
<textarea name="WebhookRequestBody" placeholder='{ "ip": #ip#, "domain": "#domain#" }'></textarea>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui enableipv4 checkbox">
|
||||
<input name="EnableIPv4" type="checkbox" tabindex="0" class="hidden">
|
||||
<label>{{tr "EnableIPv4"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui enableipv6 checkbox">
|
||||
<input name="EnableIPv6" type="checkbox" tabindex="0" class="hidden">
|
||||
<label>{{tr "EnableIPv6"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="ui negative button">{{tr "Cancel"}}</div>
|
||||
<button class="ui positive nezha-primary-btn right labeled icon button">{{tr "Confirm"}}<i class="checkmark icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
31
resource/template/component/server.html
vendored
31
resource/template/component/server.html
vendored
@@ -21,37 +21,26 @@
|
||||
<input type="text" name="secret">
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui hideforguest checkbox">
|
||||
<input name="HideForGuest" type="checkbox" tabindex="0" class="hidden" />
|
||||
<label>{{tr "HideForGuest"}}</label>
|
||||
<label>{{tr "DDNSProfiles"}}</label>
|
||||
<div class="ui fluid multiple ddns search selection dropdown">
|
||||
<input type="hidden" name="DDNSProfilesRaw">
|
||||
<i class="dropdown icon ddnsProfiles"></i>
|
||||
<div class="default text">{{tr "EnterIdAndNameToSearch"}}</div>
|
||||
<div class="menu"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui enableddns checkbox">
|
||||
<input name="EnableDDNS" type="checkbox" tabindex="0" />
|
||||
<input name="EnableDDNS" type="checkbox" tabindex="0" class="hidden" />
|
||||
<label>{{tr "EnableDDNS"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui enableipv4 checkbox">
|
||||
<input name="EnableIPv4" type="checkbox" tabindex="0" />
|
||||
<label>{{tr "EnableIPv4"}}</label>
|
||||
<div class="ui hideforguest checkbox">
|
||||
<input name="HideForGuest" type="checkbox" tabindex="0" class="hidden" />
|
||||
<label>{{tr "HideForGuest"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui enableipv6 checkbox">
|
||||
<input name="EnableIpv6" type="checkbox" tabindex="0" />
|
||||
<label>{{tr "EnableIpv6"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{tr "DDNSDomain"}}</label>
|
||||
<input type="text" name="DDNSDomain" placeholder="{{tr "DDNSDomain"}}">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{tr "DDNSProfile"}}</label>
|
||||
<input type="text" name="DDNSProfile" placeholder="{{tr "DDNSProfile"}}">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{tr "Note"}}</label>
|
||||
<textarea name="Note"></textarea>
|
||||
|
||||
58
resource/template/dashboard-default/ddns.html
vendored
Normal file
58
resource/template/dashboard-default/ddns.html
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
{{define "dashboard-default/ddns"}}
|
||||
{{template "common/header" .}}
|
||||
{{template "common/menu" .}}
|
||||
<div class="nb-container">
|
||||
<div class="ui container">
|
||||
<div class="ui grid">
|
||||
<div class="right floated right aligned twelve wide column">
|
||||
<button class="ui right labeled nezha-primary-btn icon button" onclick="addOrEditDDNS()"><i
|
||||
class="add icon"></i> {{tr "AddDDNSProfile"}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<table class="ui basic table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>{{tr "Name"}}</th>
|
||||
<th>{{tr "EnableIPv4"}}</th>
|
||||
<th>{{tr "EnableIPv6"}}</th>
|
||||
<th>{{tr "DDNSProvider"}}</th>
|
||||
<th>{{tr "DDNSDomain"}}</th>
|
||||
<th>{{tr "MaxRetries"}}</th>
|
||||
<th>{{tr "Administration"}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range $item := .DDNS}}
|
||||
<tr>
|
||||
<td>{{$item.ID}}</td>
|
||||
<td>{{$item.Name}}</td>
|
||||
<td>{{$item.EnableIPv4}}</td>
|
||||
<td>{{$item.EnableIPv6}}</td>
|
||||
<td>{{index $.ProviderMap $item.Provider}}</td>
|
||||
<td>{{$item.DomainsRaw}}</td>
|
||||
<td>{{$item.MaxRetries}}</td>
|
||||
<td>
|
||||
<div class="ui mini icon buttons">
|
||||
<button class="ui button" onclick="addOrEditDDNS({{$item}})">
|
||||
<i class="edit icon"></i>
|
||||
</button>
|
||||
<button class="ui button"
|
||||
onclick="showConfirm('确定删除DDNS配置?','确认删除',deleteRequest,'/api/ddns/'+{{$item.ID}})">
|
||||
<i class="trash alternate outline icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{{template "component/ddns" .}}
|
||||
{{template "common/footer" .}}
|
||||
<script>
|
||||
$('.checkbox').checkbox()
|
||||
</script>
|
||||
{{end}}
|
||||
@@ -28,8 +28,8 @@
|
||||
<th>{{tr "ServerGroup"}}</th>
|
||||
<th>IP</th>
|
||||
<th>{{tr "VersionNumber"}}</th>
|
||||
<th>{{tr "HideForGuest"}}</th>
|
||||
<th>{{tr "EnableDDNS"}}</th>
|
||||
<th>{{tr "HideForGuest"}}</th>
|
||||
<th>{{tr "Secret"}}</th>
|
||||
<th>{{tr "OneKeyInstall"}}</th>
|
||||
<th>{{tr "Note"}}</th>
|
||||
@@ -46,8 +46,8 @@
|
||||
<td>{{$server.Tag}}</td>
|
||||
<td>{{$server.Host.IP}}</td>
|
||||
<td>{{$server.Host.Version}}</td>
|
||||
<td>{{$server.HideForGuest}}</td>
|
||||
<td>{{$server.EnableDDNS}}</td>
|
||||
<td>{{$server.HideForGuest}}</td>
|
||||
<td>
|
||||
<button class="ui icon green mini button" data-clipboard-text="{{$server.Secret}}" data-tooltip="{{tr "ClickToCopy"}}">
|
||||
<i class="copy icon"></i>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/semantic-ui/2.4.1/semantic.min.js"></script>
|
||||
<script src="/static/semantic-ui-alerts.min.js"></script>
|
||||
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/vue/2.6.14/vue.min.js"></script>
|
||||
<script src="/static/main.js?v20240330"></script>
|
||||
<script src="/static/main.js?v20241011"></script>
|
||||
<script src="/static/theme-default/js/mixin.js?v20240302"></script>
|
||||
<script>
|
||||
(function () {
|
||||
|
||||
Reference in New Issue
Block a user