证书上传时可以选择输入文本内容

This commit is contained in:
GoEdgeLab
2021-10-09 17:30:05 +08:00
parent 8e9cc733fd
commit 615e873d07
9 changed files with 2617 additions and 902 deletions

View File

@@ -44,7 +44,7 @@
<tr v-for="(cert, index) in certs">
<td><keyword :v-word="keyword">{{cert.name}}</keyword>
<div v-if="cert.isCA" style="margin-top:0.5em">
<micro-basic-label :class="olive">CA</micro-basic-label>
<micro-basic-label class="olive">CA</micro-basic-label>
</div>
<div v-if="cert.isACME" style="margin-top: 0.5em">
<micro-basic-label class="olive" title="通过ACME协议免费申请">ACME</micro-basic-label>

View File

@@ -2,7 +2,7 @@ Tea.context(function () {
// 上传证书
this.uploadCert = function () {
teaweb.popup("/servers/certs/uploadPopup", {
height: "28em",
height: "30em",
callback: function () {
teaweb.success("上传成功", function () {
window.location.reload()
@@ -34,7 +34,7 @@ Tea.context(function () {
// 修改证书
this.updateCert = function (certId) {
teaweb.popup("/servers/certs/updatePopup?certId=" + certId, {
height: "28em",
height: "30em",
callback: function () {
teaweb.success("上传成功", function () {
window.location.reload()

View File

@@ -4,6 +4,7 @@
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="certId" :value="certConfig.id"/>
<input type="hidden" name="textMode" :value="textMode ? 1 : 0"/>
<table class="ui table definition selectable">
<tr>
<td class="title">证书说明 *</td>
@@ -24,15 +25,17 @@
<tr>
<td>选择证书文件</td>
<td>
<input type="file" name="certFile" accept="application/x-pem-file, application/pkcs10, application/x-pkcs12, application/x-x509-user-cert, application/x-x509-ca-cert, application/pkix-cert"/>
<p class="comment">内容中通常含有"-----BEGIN CERTIFICATE-----"类似的信息。</p>
<input type="file" name="certFile" accept="application/x-pem-file, application/pkcs10, application/x-pkcs12, application/x-x509-user-cert, application/x-x509-ca-cert, application/pkix-cert" v-if="!textMode"/>
<textarea name="certText" placeholder="-----BEGIN CERTIFICATE-----" v-if="textMode"></textarea>
<p class="comment"><a href="" @click.prevent="switchTextMode">[<span v-if="!textMode">输入内容</span><span v-else>上传文件</span>]</a>。文件内容中通常含有"-----BEGIN CERTIFICATE-----"类似的信息。</p>
</td>
</tr>
<tr v-show="isCA == 0">
<td>选择私钥文件</td>
<td>
<input type="file" name="keyFile" accept="application/pkcs8"/>
<p class="comment">内容中通常含有"-----BEGIN RSA PRIVATE KEY-----"类似的信息。</p>
<input type="file" name="keyFile" accept="application/pkcs8" v-if="!textMode"/>
<textarea name="keyText" placeholder="-----BEGIN RSA PRIVATE KEY-----" v-if="textMode"></textarea>
<p class="comment"><a href="" @click.prevent="switchTextMode">[<span v-if="!textMode">输入内容</span><span v-else>上传文件</span>]</a>。文件内容中通常含有"-----BEGIN RSA PRIVATE KEY-----"类似的信息。</p>
</td>
</tr>
<tr>

View File

@@ -1,4 +1,9 @@
Tea.context(function () {
this.success = NotifyPopup
this.isCA = this.certConfig.isCA ? 1 : 0
this.textMode = false
this.switchTextMode = function () {
this.textMode = !this.textMode
}
})

View File

@@ -3,6 +3,7 @@
<h3>上传证书</h3>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="textMode" :value="textMode ? 1 : 0"/>
<table class="ui table definition selectable">
<tr>
<td class="title">证书说明 *</td>
@@ -23,15 +24,17 @@
<tr>
<td>选择证书文件 *</td>
<td>
<input type="file" name="certFile" accept="application/x-pem-file, application/pkcs10, application/x-pkcs12, application/x-x509-user-cert, application/x-x509-ca-cert, application/pkix-cert"/>
<p class="comment">内容中通常含有"-----BEGIN CERTIFICATE-----"类似的信息。</p>
<input type="file" name="certFile" accept="application/x-pem-file, application/pkcs10, application/x-pkcs12, application/x-x509-user-cert, application/x-x509-ca-cert, application/pkix-cert" v-if="!textMode"/>
<textarea name="certText" placeholder="-----BEGIN CERTIFICATE-----" v-if="textMode"></textarea>
<p class="comment"><a href="" @click.prevent="switchTextMode">[<span v-if="!textMode">输入内容</span><span v-else>上传文件</span>]</a>。文件内容中通常含有"-----BEGIN CERTIFICATE-----"类似的信息。</p>
</td>
</tr>
<tr v-show="isCA == 0">
<td>选择私钥文件 *</td>
<td>
<input type="file" name="keyFile" accept="application/pkcs8"/>
<p class="comment">内容中通常含有"-----BEGIN RSA PRIVATE KEY-----"类似的信息。</p>
<input type="file" name="keyFile" accept="application/pkcs8" v-if="!textMode"/>
<textarea name="keyText" placeholder="-----BEGIN RSA PRIVATE KEY-----" v-if="textMode"></textarea>
<p class="comment"><a href="" @click.prevent="switchTextMode">[<span v-if="!textMode">输入内容</span><span v-else>上传文件</span>]</a>。文件内容中通常含有"-----BEGIN RSA PRIVATE KEY-----"类似的信息。</p>
</td>
</tr>
<tr>

View File

@@ -1,4 +1,9 @@
Tea.context(function () {
this.success = NotifyPopup
this.isCA = 0
this.textMode = false
this.switchTextMode = function () {
this.textMode = !this.textMode
}
})