优化交互

This commit is contained in:
刘祥超
2021-06-06 09:22:59 +08:00
parent abc5162bca
commit 7cbfa2458b
7 changed files with 66 additions and 6 deletions

View File

@@ -2,10 +2,16 @@ Tea.context(function () {
this.addr = ""
this.protocol = ""
this.addrError = ""
if (this.isHTTP) {
this.protocol = "http"
}
this.changeProtocol = function () {
this.checkPort()
}
this.changeAddr = function () {
if (this.serverType == "httpProxy") {
if (this.addr.startsWith("http://")) {
@@ -14,5 +20,25 @@ Tea.context(function () {
this.protocol = "https"
}
}
this.checkPort()
}
this.checkPort = function () {
this.addrError = ""
// HTTP
if (this.protocol == "http") {
if (this.addr.endsWith(":443")) {
this.addrError = "443通常是HTTPS协议端口请确认源站协议选择是否正确。"
}
}
// HTTPS
if (this.protocol == "https") {
if (this.addr.endsWith(":80")) {
this.addrError = "80通常是HTTP协议端口请确认源站协议选择是否正确。"
}
}
}
})