创建节点时自动从节点名称中提取节点IP

This commit is contained in:
GoEdgeLab
2023-03-18 11:36:10 +08:00
parent 82d71a90c5
commit 352bf9cda2

View File

@@ -174,10 +174,13 @@ Tea.context(function () {
this.defaultIP = ""
this.changeName = function () {
if (this.validateIP(this.name)) {
this.defaultIP = this.name
} else {
this.defaultIP = ""
let matchIP = this.name.match(/(\d{1,3}\.){3}\d{1,3}/)
if (matchIP != null) {
if (this.validateIP(matchIP[0])) {
this.defaultIP = matchIP[0]
} else {
this.defaultIP = ""
}
}
}