源站支持客户端证书

This commit is contained in:
刘祥超
2022-01-16 19:51:26 +08:00
parent 021dc13ce9
commit 136f0fd4bd
11 changed files with 106 additions and 5 deletions

View File

@@ -92,6 +92,9 @@ Vue.component("origin-list-table", {
<div v-if="origin.domains != null && origin.domains.length > 0">
<grey-label v-for="domain in origin.domains">{{domain}}</grey-label>
</div>
<div v-if="origin.hasCert">
<tiny-basic-label>证书</tiny-basic-label>
</div>
</td>
<td :class="{disabled:!origin.isOn}">{{origin.weight}}</td>
<td>

View File

@@ -1,18 +1,29 @@
Vue.component("ssl-certs-box", {
props: [
"v-certs", // 证书列表
"v-cert", // 单个证书
"v-protocol", // 协议https|tls
"v-view-size", // 弹窗尺寸
"v-single-mode" // 单证书模式
"v-view-size", // 弹窗尺寸normal, mini
"v-single-mode", // 单证书模式
"v-description" // 描述文字
],
data: function () {
let certs = this.vCerts
if (certs == null) {
certs = []
}
if (this.vCert != null) {
certs.push(this.vCert)
}
let description = this.vDescription
if (description == null || typeof (description) != "string") {
description = ""
}
return {
certs: certs
certs: certs,
description: description
}
},
methods: {
@@ -77,13 +88,14 @@ Vue.component("ssl-certs-box", {
template: `<div>
<input type="hidden" name="certIdsJSON" :value="JSON.stringify(certIds())"/>
<div v-if="certs != null && certs.length > 0">
<div class="ui label small" v-for="(cert, index) in certs">
<div class="ui label small basic" v-for="(cert, index) in certs">
{{cert.name}} / {{cert.dnsNames}} / 有效至{{formatTime(cert.timeEndAt)}} &nbsp; <a href="" title="删除" @click.prevent="removeCert(index)"><i class="icon remove"></i></a>
</div>
<div class="ui divider" v-if="buttonsVisible()"></div>
</div>
<div v-else>
<span class="red">选择或上传证书后<span v-if="vProtocol == 'https'">HTTPS</span><span v-if="vProtocol == 'tls'">TLS</span>服务才能生效。</span>
<span class="red" v-if="description.length == 0">选择或上传证书后<span v-if="vProtocol == 'https'">HTTPS</span><span v-if="vProtocol == 'tls'">TLS</span>服务才能生效。</span>
<span class="grey" v-if="description.length > 0">{{description}}</span>
<div class="ui divider" v-if="buttonsVisible()"></div>
</div>
<div v-if="buttonsVisible()">

View File

@@ -39,6 +39,12 @@
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>
<tbody v-show="moreOptionsVisible">
<tr v-if="protocol == 'https' || protocol == 'tls'">
<td>{{protocol.toUpperCase()}}证书</td>
<td>
<ssl-certs-box :v-single-mode="true" :v-view-size="'mini'" :v-description="'可以选择连接源站使用的证书。'"></ssl-certs-box>
</td>
</tr>
<tr v-if="isHTTP">
<td>专属域名</td>
<td>

View File

@@ -40,6 +40,12 @@
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>
<tbody v-show="moreOptionsVisible">
<tr v-if="origin.protocol == 'https' || origin.protocol == 'tls'">
<td>{{origin.protocol.toUpperCase()}}证书</td>
<td>
<ssl-certs-box :v-single-mode="true" :v-cert="origin.cert" :v-view-size="'mini'" :v-description="'可以选择连接源站使用的证书。'"></ssl-certs-box>
</td>
</tr>
<tr v-if="isHTTP">
<td>专属域名</td>
<td>