2021-06-05 20:27:57 +08:00
|
|
|
|
Tea.context(function () {
|
2021-06-06 09:22:59 +08:00
|
|
|
|
this.addrError = ""
|
|
|
|
|
|
|
|
|
|
|
|
this.$delay(function () {
|
|
|
|
|
|
this.checkPort()
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
this.changeProtocol = function () {
|
|
|
|
|
|
this.checkPort()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-06-05 20:27:57 +08:00
|
|
|
|
this.changeAddr = function () {
|
|
|
|
|
|
if (this.serverType == "httpProxy") {
|
|
|
|
|
|
if (this.origin.addr.startsWith("http://")) {
|
|
|
|
|
|
this.origin.protocol = "http"
|
|
|
|
|
|
} else if (this.origin.addr.startsWith("https://")) {
|
|
|
|
|
|
this.origin.protocol = "https"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-06-06 09:22:59 +08:00
|
|
|
|
|
|
|
|
|
|
this.checkPort()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.checkPort = function () {
|
|
|
|
|
|
this.addrError = ""
|
|
|
|
|
|
|
|
|
|
|
|
// HTTP
|
|
|
|
|
|
if (this.origin.protocol == "http") {
|
|
|
|
|
|
if (this.origin.addr.endsWith(":443")) {
|
|
|
|
|
|
this.addrError = "443通常是HTTPS协议端口,请确认源站协议选择是否正确。"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// HTTPS
|
|
|
|
|
|
if (this.origin.protocol == "https") {
|
|
|
|
|
|
if (this.origin.addr.endsWith(":80")) {
|
|
|
|
|
|
this.addrError = "80通常是HTTP协议端口,请确认源站协议选择是否正确。"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-06-05 20:27:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|