Initial commit (code only without large binaries)

This commit is contained in:
robin
2026-02-15 18:58:44 +08:00
commit 35df75498f
9442 changed files with 1495866 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
{$layout "layout_popup"}
<h3>创建用户</h3>
<form method="post" class="ui form" data-tea-success="success" data-tea-action="$">
<csrf-token></csrf-token>
<table class="ui table definition selectable">
<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>

View File

@@ -0,0 +1,53 @@
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
})
}
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
}
})
})
}
})
}
})

View File

@@ -0,0 +1,39 @@
{$layout}
{$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> &nbsp;
<a href="" @click.prevent="deleteUser(user.id)">删除</a>
</td>
</tr>
</table>
<div class="page" v-html="page"></div>

View File

@@ -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()
})
}
})

View File

@@ -0,0 +1,31 @@
{$layout "layout_popup"}
<h3>修改用户</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>