1.4.5.2
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
<first-menu>
|
||||
<menu-item href="/servers/certs/acme" code="task">所有任务</menu-item>
|
||||
<span class="disabled item">|</span>
|
||||
<menu-item href="/servers/certs/acme/create" code="create">[新申请]</menu-item>
|
||||
<span class="disabled item">|</span>
|
||||
<menu-item href="/servers/certs/acme/users" code="user">ACME用户</menu-item>
|
||||
<menu-item href="/servers/certs/acme/accounts" code="account">服务商账号</menu-item>
|
||||
</first-menu>
|
||||
@@ -0,0 +1,42 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>添加账号</h3>
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td>账号名称 *</td>
|
||||
<td>
|
||||
<input type="text" name="name" maxlength="50" ref="focus" tabindex="1"/>
|
||||
<p class="comment">为当前账号起一个容易识别的名称。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">证书服务商 *</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="providerCode" v-model="providerCode" @change="changeProvider" tabindex="2">
|
||||
<option value="">[选择服务商]</option>
|
||||
<option v-for="provider in providers" :value="provider.code">{{provider.name}}</option>
|
||||
</select>
|
||||
<p class="comment" v-if="selectedProvider != null" v-html="selectedProvider.description"></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tbody v-show="selectedProvider != null && selectedProvider.requireEAB">
|
||||
<tr>
|
||||
<td>EAB Kid *</td>
|
||||
<td>
|
||||
<input type="text" name="eabKid" maxlength="100" tabindex="3"/>
|
||||
<p class="comment" v-if="selectedProvider != null" v-html="selectedProvider.eabDescription"></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>EAB HMAC Key *</td>
|
||||
<td>
|
||||
<input type="text" name="eabKey" maxlength="300" tabindex="4"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -0,0 +1,16 @@
|
||||
Tea.context(function () {
|
||||
this.selectedProvider = null
|
||||
this.changeProvider = function () {
|
||||
if (this.providerCode.length == 0) {
|
||||
this.selectedProvider = null
|
||||
return
|
||||
}
|
||||
|
||||
let that = this
|
||||
this.selectedProvider = this.providers.$find(function (k, v) {
|
||||
return v.code == that.providerCode
|
||||
})
|
||||
}
|
||||
|
||||
this.changeProvider()
|
||||
})
|
||||
@@ -0,0 +1,46 @@
|
||||
{$layout}
|
||||
{$template "/left_menu_top"}
|
||||
|
||||
<div class="right-box without-tabbar">
|
||||
{$template "../menu"}
|
||||
|
||||
<second-menu>
|
||||
<menu-item @click.prevent="createAccount">[创建账号]</menu-item>
|
||||
</second-menu>
|
||||
|
||||
<p class="comment" v-if="accounts.length == 0">暂时还没有服务商账号。</p>
|
||||
|
||||
<table class="ui table selectable celled" v-if="accounts.length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>名称</th>
|
||||
<th>证书服务商</th>
|
||||
<th class="four wide">EAB Kid</th>
|
||||
<th class="four wide">EBA HMAC Key</th>
|
||||
<th class="two wide">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="account in accounts">
|
||||
<td>
|
||||
<a href="" @click.prevent="updateAccount(account.id)">{{account.name}} <i class="icon expand small"></i></a>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="account.provider != null">{{account.provider.name}}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="account.eabKid.length > 0">{{account.eabKid}}</span>
|
||||
<span v-else class="disabled">-</span>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="account.eabKey.length > 0">{{account.eabKey}}</span>
|
||||
<span v-else class="disabled">-</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href="" @click.prevent="updateAccount(account.id)">修改</a>
|
||||
<a href="" @click.prevent="deleteAccount(account.id)">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="page" v-html="page"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,33 @@
|
||||
Tea.context(function () {
|
||||
this.createAccount = function () {
|
||||
teaweb.popup(".createPopup", {
|
||||
height: "24em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.updateAccount = function (accountId) {
|
||||
teaweb.popup(".updatePopup?accountId=" + accountId, {
|
||||
height: "24em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.deleteAccount = function (accountId) {
|
||||
teaweb.confirm("确定要删除此账号吗?", function () {
|
||||
this.$post(".delete")
|
||||
.params({
|
||||
accountId: accountId
|
||||
})
|
||||
.refresh()
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,41 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>修改账号</h3>
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
|
||||
<input type="hidden" name="accountId" :value="account.id"/>
|
||||
<input type="hidden" name="providerCode" :value="account.providerCode"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td>账号名称 *</td>
|
||||
<td>
|
||||
<input type="text" name="name" maxlength="50" ref="focus" v-model="account.name" tabindex="1"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">证书服务商 *</td>
|
||||
<td>
|
||||
<span v-if="account.provider != null">{{account.provider.name}}</span>
|
||||
<span v-else class="disabled">服务商已失效</span>
|
||||
<p class="comment" v-if="account.provider != null" v-html="account.provider.description"></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tbody v-show="account.provider != null && account.provider.requireEAB">
|
||||
<tr>
|
||||
<td>EAB Kid *</td>
|
||||
<td>
|
||||
<input type="text" name="eabKid" maxlength="100" v-model="account.eabKid" tabindex="3"/>
|
||||
<p class="comment" v-if="account.provider != null" v-html="account.provider.eabDescription"></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>EAB HMAC Key *</td>
|
||||
<td>
|
||||
<input type="text" name="eabKey" maxlength="300" v-model="account.eabKey" tabindex="4"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
|
||||
})
|
||||
15
EdgeAdmin/web/views/@default/servers/certs/acme/create.css
Normal file
15
EdgeAdmin/web/views/@default/servers/certs/acme/create.css
Normal file
@@ -0,0 +1,15 @@
|
||||
.button-group {
|
||||
margin-top: 4em;
|
||||
z-index: 1;
|
||||
}
|
||||
.button-group .button.primary {
|
||||
float: right;
|
||||
}
|
||||
.success-box {
|
||||
text-align: center;
|
||||
padding-top: 2em;
|
||||
}
|
||||
.success-box p {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
/*# sourceMappingURL=create.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["create.less"],"names":[],"mappings":"AAAA;EACC,eAAA;EACA,UAAA;;AAFD,aAIC,QAAO;EACN,YAAA;;AAIF;EACC,kBAAA;EACA,gBAAA;;AAFD,YAIC;EACC,gBAAA","file":"create.css"}
|
||||
170
EdgeAdmin/web/views/@default/servers/certs/acme/create.html
Normal file
170
EdgeAdmin/web/views/@default/servers/certs/acme/create.html
Normal file
@@ -0,0 +1,170 @@
|
||||
{$layout}
|
||||
{$template "/left_menu_top"}
|
||||
|
||||
<div class="right-box without-tabbar">
|
||||
{$template "menu"}
|
||||
|
||||
<div class="margin"></div>
|
||||
|
||||
<form class="ui form">
|
||||
<div class="ui steps fluid small">
|
||||
<div class="ui step" :class="{active:step == 'prepare'}">
|
||||
选择申请方式
|
||||
</div>
|
||||
<div class="ui step" :class="{active:step == 'user'}">
|
||||
选择ACME用户
|
||||
</div>
|
||||
<div class="ui step" :class="{active:step == 'dns'}">
|
||||
填写域名信息
|
||||
</div>
|
||||
<div class="ui step" :class="{active:step == 'finish'}">
|
||||
完成
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 准备工作 -->
|
||||
<div v-show="step == 'prepare'">
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">认证方式 *</td>
|
||||
<td>
|
||||
<div style="margin-bottom: 1em">
|
||||
<radio name="authType" :v-value="'http'" v-model="authType">使用HTTP认证</radio>
|
||||
<radio name="authType" :v-value="'dns'" v-model="authType">使用DNS认证</radio>
|
||||
</div>
|
||||
<div v-if="authType == 'http'">
|
||||
<p class="comment">使用HTTP认证的方式请求网址<code-label>/.well-known/acme-challenge/令牌</code-label>校验,该方式要求需要实现将域名解析到集群上,之后系统会自动生成网址信息;这种方式不支持泛域名证书的申请。</p>
|
||||
</div>
|
||||
<div v-if="authType == 'dns'">
|
||||
<p class="comment">我们在申请免费证书的过程中需要自动增加或修改相关域名的TXT记录,请先确保你已经在"域名解析" -- <a href="/dns/providers" target="_blank">"DNS服务商"</a> 中已经添加了对应的DNS服务商账号。</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>选择平台用户</td>
|
||||
<td>
|
||||
<user-selector @change="changePlatformUser"></user-selector>
|
||||
<p class="comment">可选项,选择证书所属用户,如果没有选择,则视为管理员所有。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<a href="" @click.prevent="showPrepareMoreOptionsVisible">更多选项<i class="icon angle" :class="{up: prepareMoreOptionsVisible, down: !prepareMoreOptionsVisible}"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tbody v-show="prepareMoreOptionsVisible">
|
||||
<tr>
|
||||
<td>回调URL</td>
|
||||
<td>
|
||||
<input type="text" name="authURL" v-model="authURL" maxlength="200"/>
|
||||
<p class="comment">将认证数据以JSON的方式POST到此URL上,可以依此生成认证文件或者设置DNS域名解析;仅适用于未绑定当前CDN系统的域名。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="button-group">
|
||||
<button type="button" class="ui button primary" @click.prevent="doPrepare">下一步</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 选择用户 -->
|
||||
<div v-show="step == 'user'">
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">选择证书服务商 *</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" v-model="providerCode" @change="changeProvider">
|
||||
<option value="">[选择服务商]</option>
|
||||
<option v-for="provider in providers" :value="provider.code">{{provider.name}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="providerCode.length > 0">
|
||||
<td class="title">选择ACME用户 *</td>
|
||||
<td>
|
||||
<div v-if="users.length > 0">
|
||||
<div class="ui fields inline">
|
||||
<div class="ui field">
|
||||
<select class="ui dropdown" v-model="userId">
|
||||
<option value="0">[请选择]</option>
|
||||
<option v-for="user in users" :value="user.id" v-if="user.providerCode == providerCode">{{user.email}}{{user.description}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<a href="" @click.prevent="createUser">[新创建]</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else><a href="" @click.prevent="createUser"><span v-if="platformUserId > 0">当前平台用户下</span>暂时还没有ACME用户,点此创建</a></div>
|
||||
<p class="comment">选择一个作为申请证书的用户。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="button-group">
|
||||
<button type="button" class="ui button" @click.prevent="goPrepare">上一步</button>
|
||||
<button type="button" class="ui button primary" @click.prevent="doUser">下一步</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 设置域名解析 -->
|
||||
<div v-show="step == 'dns'">
|
||||
<table class="ui table definition selectable">
|
||||
<tr v-show="authType == 'dns'">
|
||||
<td class="title">选择DNS服务商 *</td>
|
||||
<td>
|
||||
<div v-if="dnsProviders.length > 0">
|
||||
<select class="ui dropdown auto-width" v-model="dnsProviderId">
|
||||
<option value="0">[请选择]</option>
|
||||
<option v-for="provider in dnsProviders" :value="provider.id">{{provider.name}}({{provider.typeName}})</option>
|
||||
</select>
|
||||
</div>
|
||||
<div v-else>
|
||||
<span>暂时没有DNS服务商,<a href="/dns/providers">[去添加]</a>。</span>
|
||||
</div>
|
||||
<p class="comment">用于自动创建域名解析记录。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="authType == 'dns'">
|
||||
<td>顶级域名 *</td>
|
||||
<td>
|
||||
<input type="text" maxlength="100" v-model="dnsDomain"/>
|
||||
<p class="comment">用于在DNS服务商账号中操作解析记录的域名,比如 example.com,不要输入二级或别的多级域名。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">证书域名列表 *</td>
|
||||
<td>
|
||||
<domains-box :v-support-wildcard="authType == 'dns'" @change="changeDomains"></domains-box>
|
||||
<p class="comment">需要申请的证书中包含的域名列表<span v-if="authType == 'dns'">,所有域名必须是同一个顶级域名</span><span v-if="authType == 'http'">使用HTTP认证方式时,域名中不能含有通配符</span>。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>自动续期</td>
|
||||
<td>
|
||||
<checkbox v-model="autoRenew"></checkbox>
|
||||
<p class="comment">选中后,表示在免费证书临近到期之前尝试自动续期。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="button-group">
|
||||
<button type="button" class="ui button" @click.prevent="goUser">上一步</button>
|
||||
<button type="button" class="ui button primary" @click.prevent="doDNS" v-if="!isRequesting">下一步</button>
|
||||
<button type="button" class="ui button primary disabled" v-if="isRequesting">提交中,要花费的时间较长,请耐心等待...</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 完成 -->
|
||||
<div v-show="step == 'finish'">
|
||||
<div class="success-box">
|
||||
<p><span class="green">恭喜,证书申请成功!</span>你可以在证书列表里看到刚申请的证书,也可以 <a href="" @click.prevent="viewCert">点击这里</a> 查看证书详情。</p>
|
||||
</div>
|
||||
|
||||
<div class="button-group">
|
||||
<button type="button" class="ui button primary" @click.prevent="doFinish">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
165
EdgeAdmin/web/views/@default/servers/certs/acme/create.js
Normal file
165
EdgeAdmin/web/views/@default/servers/certs/acme/create.js
Normal file
@@ -0,0 +1,165 @@
|
||||
Tea.context(function () {
|
||||
this.step = "prepare"
|
||||
|
||||
/**
|
||||
* 选择平台用户
|
||||
*/
|
||||
this.platformUserId = 0
|
||||
|
||||
this.changePlatformUser = function (platformUserId) {
|
||||
this.platformUserId = platformUserId
|
||||
}
|
||||
|
||||
/**
|
||||
* 准备工作
|
||||
*/
|
||||
this.authType = "http"
|
||||
this.users = []
|
||||
|
||||
this.doPrepare = function () {
|
||||
this.step = "user"
|
||||
|
||||
this.$post(".userOptions")
|
||||
.params({
|
||||
platformUserId: this.platformUserId
|
||||
})
|
||||
.success(function (resp) {
|
||||
this.users = resp.data.users
|
||||
})
|
||||
}
|
||||
|
||||
this.prepareMoreOptionsVisible = false
|
||||
this.authURL = ""
|
||||
this.showPrepareMoreOptionsVisible = function () {
|
||||
this.prepareMoreOptionsVisible = !this.prepareMoreOptionsVisible
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择ACME用户
|
||||
*/
|
||||
this.userId = 0
|
||||
|
||||
this.goPrepare = function () {
|
||||
this.step = "prepare"
|
||||
}
|
||||
|
||||
this.createUser = function () {
|
||||
let that = this
|
||||
teaweb.popup("/servers/certs/acme/users/createPopup?providerCode=" + this.providerCode + "&platformUserId=" + this.platformUserId, {
|
||||
height: "30em",
|
||||
width: "44em",
|
||||
callback: function (resp) {
|
||||
teaweb.successToast("创建成功")
|
||||
|
||||
let acmeUser = resp.data.acmeUser
|
||||
let description = acmeUser.description
|
||||
if (description.length > 0) {
|
||||
description = "(" + description + ")"
|
||||
}
|
||||
that.userId = acmeUser.id
|
||||
that.users.unshift({
|
||||
id: acmeUser.id,
|
||||
description: description,
|
||||
email: acmeUser.email,
|
||||
providerCode: acmeUser.providerCode
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.providerCode = ""
|
||||
this.changeProvider = function () {
|
||||
this.userId = 0
|
||||
}
|
||||
|
||||
this.doUser = function () {
|
||||
if (this.providerCode.length == 0) {
|
||||
teaweb.warn("请选择一个证书服务商")
|
||||
return
|
||||
}
|
||||
if (this.userId == 0) {
|
||||
teaweb.warn("请选择一个申请证书的用户")
|
||||
return
|
||||
}
|
||||
this.step = "dns"
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置DNS解析
|
||||
*/
|
||||
this.dnsProviderId = 0
|
||||
this.dnsDomain = ""
|
||||
this.autoRenew = true
|
||||
this.domains = []
|
||||
this.taskId = 0
|
||||
this.isRequesting = false
|
||||
|
||||
this.goUser = function () {
|
||||
this.step = "user"
|
||||
}
|
||||
|
||||
this.changeDomains = function (v) {
|
||||
this.domains = v
|
||||
}
|
||||
|
||||
this.doDNS = function () {
|
||||
this.isRequesting = true
|
||||
let that = this
|
||||
let taskCreated = false
|
||||
this.$post("$")
|
||||
.params({
|
||||
platformUserId: this.platformUserId,
|
||||
authType: this.authType,
|
||||
acmeUserId: this.userId,
|
||||
dnsProviderId: this.dnsProviderId,
|
||||
dnsDomain: this.dnsDomain,
|
||||
domains: this.domains,
|
||||
autoRenew: this.autoRenew ? 1 : 0,
|
||||
taskId: this.taskId,
|
||||
authURL: this.authURL
|
||||
})
|
||||
.success(function (resp) {
|
||||
this.taskId = resp.data.taskId
|
||||
taskCreated = true
|
||||
|
||||
this.isRequesting = true
|
||||
this.$post(".run")
|
||||
.timeout(300)
|
||||
.params({
|
||||
taskId: this.taskId
|
||||
})
|
||||
.success(function (resp) {
|
||||
that.certId = resp.data.certId
|
||||
that.step = "finish"
|
||||
})
|
||||
.done(function () {
|
||||
that.isRequesting = false
|
||||
})
|
||||
})
|
||||
.done(function () {
|
||||
if (!taskCreated) {
|
||||
this.isRequesting = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成
|
||||
*/
|
||||
this.certId = 0
|
||||
|
||||
this.goDNS = function () {
|
||||
this.step = "dns"
|
||||
}
|
||||
|
||||
this.doFinish = function () {
|
||||
window.location = "/servers/certs/acme"
|
||||
}
|
||||
|
||||
this.viewCert = function () {
|
||||
teaweb.popup("/servers/certs/certPopup?certId=" + this.certId, {
|
||||
height: "28em",
|
||||
width: "48em"
|
||||
})
|
||||
}
|
||||
})
|
||||
17
EdgeAdmin/web/views/@default/servers/certs/acme/create.less
Normal file
17
EdgeAdmin/web/views/@default/servers/certs/acme/create.less
Normal file
@@ -0,0 +1,17 @@
|
||||
.button-group {
|
||||
margin-top: 4em;
|
||||
z-index: 1;
|
||||
|
||||
.button.primary {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
.success-box {
|
||||
text-align: center;
|
||||
padding-top: 2em;
|
||||
|
||||
p {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
}
|
||||
108
EdgeAdmin/web/views/@default/servers/certs/acme/index.html
Normal file
108
EdgeAdmin/web/views/@default/servers/certs/acme/index.html
Normal file
@@ -0,0 +1,108 @@
|
||||
{$layout}
|
||||
{$template "/left_menu_top"}
|
||||
|
||||
<div class="right-box without-tabbar">
|
||||
{$template "menu"}
|
||||
|
||||
<second-menu>
|
||||
<menu-item :href="'/servers/certs/acme?userType=' + userType + '&keyword=' + keyword + '&userId=' + searchingUserId" :active="type == ''">所有任务({{countAll}})</menu-item>
|
||||
<menu-item :href="'/servers/certs/acme?userType=' + userType + '&type=available&keyword=' + keyword + '&userId=' + searchingUserId" :active="type == 'available'">有效证书({{countAvailable}})</menu-item>
|
||||
<menu-item :href="'/servers/certs/acme?userType=' + userType + '&type=expired&keyword=' + keyword + '&userId=' + searchingUserId" :active="type == 'expired'">过期证书<span :class="{red: countExpired > 0}">({{countExpired}})</span></menu-item>
|
||||
<menu-item :href="'/servers/certs/acme?userType=' + userType + '&type=7days&keyword=' + keyword + '&userId=' + searchingUserId" :active="type == '7days'">7天内过期<span :class="{red: count7Days > 0}">({{count7Days}})</span></menu-item>
|
||||
<menu-item :href="'/servers/certs/acme?userType=' + userType + '&type=30days&keyword=' + keyword + '&userId=' + searchingUserId" :active="type == '30days'">30天内过期({{count30Days}})</menu-item>
|
||||
</second-menu>
|
||||
|
||||
<form class="ui form">
|
||||
<input type="hidden" name="userType" :value="userType"/>
|
||||
<div class="ui fields inline">
|
||||
<div class="ui field">
|
||||
<input type="text" name="keyword" placeholder="域名等关键词" style="width:12em" v-model="keyword"/>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<user-selector :v-user-id="searchingUserId"></user-selector>
|
||||
</div>
|
||||
<div class="ui field"></div>
|
||||
<div class="ui field">
|
||||
<button type="submit" class="ui button">搜索</button>
|
||||
|
||||
<a :href="Tea.url('.', {userType:userType})" v-if="keyword.length > 0 || searchingUserId > 0">[清除条件]</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div v-if="searchingUserId == 0">
|
||||
<div class="ui menu text basic tiny blue" style="margin-bottom:0">
|
||||
<a :href="'/servers/certs/acme?userType=&type=' + type + '&keyword=' + keyword + '&userId=' + searchingUserId" class="item" :class="{active: userType == ''}">管理员证书</a>
|
||||
<a :href="'/servers/certs/acme?userType=user&type=' + type + '&keyword=' + keyword + '&userId=' + searchingUserId" class="item" :class="{active: userType == 'user'}">用户证书</a>
|
||||
</div>
|
||||
<div class="ui divider" style="margin-top:0"></div>
|
||||
</div>
|
||||
|
||||
<p class="comment" v-if="tasks.length == 0"><span v-if="searchingUserId > 0">当前用户下</span>暂时还没有证书申请任务。</p>
|
||||
|
||||
<div class="ui message blue" v-if="isRunning">有任务在执行中,可能需要的时间较长,请耐心等待。</div>
|
||||
|
||||
<table class="ui table selectable celled" v-if="tasks.length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ACME用户</th>
|
||||
<th>证书域名</th>
|
||||
<th>到期时间</th>
|
||||
<th>更新时间</th>
|
||||
<th class="center" style="width:6em">自动续期</th>
|
||||
<th class="center" style="width:6em">关联证书</th>
|
||||
<th>所属用户</th>
|
||||
<th class="three op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="(task, index) in tasks" :class="{warning: runningIndex == index}">
|
||||
<td>{{task.acmeUser.email}}
|
||||
<div>
|
||||
<grey-label class="olive" v-if="task.authType == 'dns'">DNS</grey-label>
|
||||
<grey-label class="olive" v-if="task.authType == 'http'">HTTP</grey-label>
|
||||
<grey-label v-if="task.acmeUser.provider != null">{{task.acmeUser.provider.name}}</grey-label>
|
||||
<grey-label v-if="task.acmeUser.account != null">{{task.acmeUser.account.name}}</grey-label>
|
||||
</div>
|
||||
</td>
|
||||
<td nowrap="">
|
||||
<div v-for="domain in task.domains">
|
||||
<span class="ui label small basic">{{domain}}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td nowrap="">
|
||||
<div v-if="task.cert != null">
|
||||
{{task.cert.endTime}}
|
||||
</div>
|
||||
<span class="disabled" v-else>-</span>
|
||||
</td>
|
||||
<td nowrap="">
|
||||
<div v-if="task.log != null">
|
||||
<span class="green" v-if="task.log.isOk">{{task.log.createdTime}}</span>
|
||||
<link-red v-if="!task.log.isOk" title="任务执行失败,点击查看详情" @click.prevent="showError(task.log.error)">{{task.log.createdTime}}</link-red>
|
||||
</div>
|
||||
<span v-else class="disabled">尚未执行</span>
|
||||
</td>
|
||||
<td class="center">
|
||||
<span class="green" v-if="task.autoRenew">Y</span>
|
||||
<span v-else class="disabled">N</span>
|
||||
</td>
|
||||
<td class="center">
|
||||
<div v-if="task.cert != null">
|
||||
<a href="" @click.prevent="viewCert(task.cert.id)"><link-icon title="查看关联证书"></link-icon></a>
|
||||
</div>
|
||||
<span class="disabled" v-else="">-</span>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="task.user != null && task.user.id > 0"><user-link :v-user="task.user"></user-link></span>
|
||||
<span v-else class="disabled">管理员</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href="" @click.prevent="updateTask(task.id)" :class="{disabled: isRunning}">修改</a>
|
||||
<a href="" @click.prevent="runTask(index, task)" :class="{disabled: isRunning}">执行</a>
|
||||
<a href="" @click.prevent="deleteTask(task.id)" :class="{disabled: isRunning}">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="page" v-html="page"></div>
|
||||
</div>
|
||||
63
EdgeAdmin/web/views/@default/servers/certs/acme/index.js
Normal file
63
EdgeAdmin/web/views/@default/servers/certs/acme/index.js
Normal file
@@ -0,0 +1,63 @@
|
||||
Tea.context(function () {
|
||||
this.viewCert = function (certId) {
|
||||
teaweb.popup("/servers/certs/certPopup?certId=" + certId, {
|
||||
height: "28em",
|
||||
width: "48em"
|
||||
})
|
||||
}
|
||||
|
||||
this.updateTask = function (taskId) {
|
||||
teaweb.popup("/servers/certs/acme/updateTaskPopup?taskId=" + taskId, {
|
||||
width: "45em",
|
||||
height: "26em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功,如果证书域名发生了改变,请重新执行生成新证书", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.deleteTask = function (taskId) {
|
||||
let that = this
|
||||
teaweb.confirm("确定要删除此任务吗?", function () {
|
||||
that.$post("/servers/certs/acme/deleteTask")
|
||||
.params({
|
||||
taskId: taskId
|
||||
})
|
||||
.refresh()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
this.isRunning = false
|
||||
this.runningIndex = -1
|
||||
|
||||
this.runTask = function (index, task) {
|
||||
let that = this
|
||||
|
||||
teaweb.confirm("html:确定要立即执行此任务吗?<br/>将会重新发起证书申请。", function () {
|
||||
that.isRunning = true
|
||||
that.runningIndex = index
|
||||
|
||||
that.$post(".run")
|
||||
.timeout(300)
|
||||
.params({
|
||||
taskId: task.id
|
||||
})
|
||||
.success(function (resp) {
|
||||
teaweb.success("任务执行成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
})
|
||||
.done(function () {
|
||||
that.isRunning = false
|
||||
that.runningIndex = -1
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.showError = function (err) {
|
||||
teaweb.popupTip("任务执行失败:" + err)
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,59 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>修改申请任务</h3>
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
<input type="hidden" name="taskId" :value="task.id"/>
|
||||
<input type="hidden" name="acmeUserId" :value="task.acmeUser.id"/>
|
||||
<input type="hidden" name="authType" :value="task.authType"/>
|
||||
|
||||
<table class="ui table definition selectable">
|
||||
<tr v-if="task.authType == 'dns'">
|
||||
<td class="title">选择DNS服务商 *</td>
|
||||
<td>
|
||||
<div v-if="providers.length > 0">
|
||||
<select class="ui dropdown auto-width" name="dnsProviderId" v-model="task.dnsProvider.id">
|
||||
<option value="0">[请选择]</option>
|
||||
<option v-for="provider in providers" :value="provider.id">{{provider.name}}({{provider.typeName}})</option>
|
||||
</select>
|
||||
</div>
|
||||
<p class="comment">用于自动创建域名解析记录。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="task.authType == 'dns'">
|
||||
<td class="title">顶级域名 *</td>
|
||||
<td>
|
||||
<input type="text" maxlength="100" name="dnsDomain" v-model="task.dnsDomain"/>
|
||||
<p class="comment">用于在DNS服务商账号中操作解析记录的域名,比如 example.com,不要输入二级或别的多级域名。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">证书域名列表 *</td>
|
||||
<td>
|
||||
<domains-box name="domainsJSON" :v-domains="task.domains" :v-support-wildcard="task.authType == 'dns'"></domains-box>
|
||||
<p class="comment">需要申请的证书中包含的域名列表<span v-if="task.authType == 'dns'">,所有域名必须是同一个顶级域名</span><span v-if="task.authType == 'http'">使用HTTP认证方式时,域名中不能含有通配符</span>。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>自动续期</td>
|
||||
<td>
|
||||
<checkbox name="autoRenew" v-model="task.autoRenew"></checkbox>
|
||||
<p class="comment">选中后,表示在免费证书临近到期之前尝试自动续期。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||
</tr>
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td>回调URL</td>
|
||||
<td>
|
||||
<input type="text" name="authURL" v-model="task.authURL" maxlength="200"/>
|
||||
<p class="comment">将认证数据以JSON的方式POST到此URL上,可以依此生成认证文件或者设置DNS域名解析;仅适用于未绑定当前CDN系统的域名。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -0,0 +1,52 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>创建ACME用户</h3>
|
||||
<form method="post" class="ui form" data-tea-success="success" data-tea-action="$">
|
||||
<csrf-token></csrf-token>
|
||||
<input type="hidden" name="platformUserId" :value="platformUserId"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr v-if="platformUser != null">
|
||||
<td>所属平台用户</td>
|
||||
<td><user-link :v-user="platformUser"></user-link></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">用户邮箱 *</td>
|
||||
<td>
|
||||
<input type="text" name="email" maxlength="100" ref="focus"/>
|
||||
<p class="comment">用于自动注册用户的邮箱。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>所属证书服务商 *</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="providerCode" v-model="providerCode" @change="changeProvider">
|
||||
<option value="">[选择服务商]</option>
|
||||
<option v-for="provider in providers" :value="provider.code">{{provider.name}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="selectedProvider != null">
|
||||
<td>所属服务商账号 <span v-if="selectedProvider.requireEAB">*</span><em v-else>(可选)</em></td>
|
||||
<td>
|
||||
<div class="ui fields inline">
|
||||
<div class="ui field" v-if="accounts.length > 0">
|
||||
<select class="ui dropdown auto-width" name="accountId" v-model="accountId">
|
||||
<option value="0">[选择账号]</option>
|
||||
<option v-for="account in accounts" :value="account.id">{{account.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<a href="" @click.prevent="addAccount">[添加]</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>备注</td>
|
||||
<td>
|
||||
<textarea name="description" rows="3" maxlength="100"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -0,0 +1,57 @@
|
||||
Tea.context(function () {
|
||||
this.selectedProvider = null
|
||||
this.accounts = []
|
||||
this.accountId = 0
|
||||
|
||||
this.changeProvider = function () {
|
||||
this.accountId = 0
|
||||
|
||||
if (this.providerCode.length == 0) {
|
||||
return
|
||||
}
|
||||
|
||||
let that = this
|
||||
let provider = this.providers.$find(function (k, v) {
|
||||
return v.code == that.providerCode
|
||||
})
|
||||
if (provider == null) {
|
||||
return
|
||||
}
|
||||
|
||||
this.selectedProvider = provider
|
||||
|
||||
this.$post(".accountsWithCode")
|
||||
.params({
|
||||
code: provider.code
|
||||
})
|
||||
.success(function (resp) {
|
||||
this.accounts = resp.data.accounts
|
||||
})
|
||||
}
|
||||
|
||||
if (this.providerCode.length > 0) {
|
||||
this.changeProvider()
|
||||
}
|
||||
|
||||
this.addAccount = function () {
|
||||
let that = this
|
||||
teaweb.popup("/servers/certs/acme/accounts/createPopup?providerCode=" + this.providerCode, {
|
||||
height: "24em",
|
||||
callback: function () {
|
||||
teaweb.successToast("创建成功,已自动选中", 1500, function () {
|
||||
that.$post(".accountsWithCode")
|
||||
.params({
|
||||
code: that.providerCode
|
||||
})
|
||||
.success(function (resp) {
|
||||
that.accounts = resp.data.accounts
|
||||
|
||||
if (that.accounts.length > 0) {
|
||||
that.accountId = that.accounts[0].id
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,42 @@
|
||||
{$layout}
|
||||
{$template "/left_menu_top"}
|
||||
|
||||
<div class="right-box without-tabbar">
|
||||
{$template "../menu"}
|
||||
|
||||
<second-menu>
|
||||
<menu-item @click.prevent="createUser">[创建用户]</menu-item>
|
||||
<menu-item><tip-icon content="这里管理用于申请免费证书的用户信息"></tip-icon></menu-item>
|
||||
</second-menu>
|
||||
|
||||
<p class="comment" v-if="users.length == 0">暂时还没有用户。</p>
|
||||
|
||||
<table class="ui table selectable" v-if="users.length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>用户Email</th>
|
||||
<th>备注</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="user in users">
|
||||
<td>
|
||||
<a href="" @click.prevent="updateUser(user.id)">{{user.email}} <i class="icon expand small"></i></a>
|
||||
<div>
|
||||
<grey-label v-if="user.provider != null">{{user.provider.name}}</grey-label>
|
||||
<grey-label v-if="user.account != null">{{user.account.name}}</grey-label>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="user.description.length > 0">{{user.description}}</span>
|
||||
<span v-else class="disabled">-</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href="" @click.prevent="updateUser(user.id)">修改</a>
|
||||
<a href="" @click.prevent="deleteUser(user.id)">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="page" v-html="page"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,36 @@
|
||||
Tea.context(function () {
|
||||
this.createUser = function () {
|
||||
teaweb.popup(Tea.url(".createPopup"), {
|
||||
height: "27em",
|
||||
width: "44em",
|
||||
callback: function () {
|
||||
teaweb.success("创建成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.updateUser = function (userId) {
|
||||
teaweb.popup("/servers/certs/acme/users/updatePopup?userId=" + userId, {
|
||||
height: "27em",
|
||||
width: "44em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.deleteUser = function (userId) {
|
||||
let that = this
|
||||
teaweb.confirm("确定要删除此用户吗?", function () {
|
||||
that.$post(".delete")
|
||||
.params({
|
||||
userId: userId
|
||||
})
|
||||
.refresh()
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,31 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>修改ACME用户</h3>
|
||||
<form method="post" class="ui form" data-tea-success="success" data-tea-action="$">
|
||||
<csrf-token></csrf-token>
|
||||
<input type="hidden" name="userId" :value="user.id"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">用户邮箱 *</td>
|
||||
<td>
|
||||
{{user.email}}
|
||||
<p class="comment">用于自动注册用户的邮箱,不允许修改。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="user.provider != null">
|
||||
<td>所属证书服务商</td>
|
||||
<td>{{user.provider.name}}</td>
|
||||
</tr>
|
||||
<tr v-if="user.account != null">
|
||||
<td>所属服务商账号</td>
|
||||
<td>{{user.account.name}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>备注</td>
|
||||
<td>
|
||||
<textarea name="description" rows="3" maxlength="100" v-model="user.description" ref="focus"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
Reference in New Issue
Block a user