This commit is contained in:
unknown
2026-02-04 20:27:13 +08:00
commit 3b042d1dad
9410 changed files with 1488147 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
.checkboxes .checkbox {
width: 8em;
margin-bottom: 0.5em;
}
/*# sourceMappingURL=index.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA,WACC;EACC,UAAA;EACA,oBAAA","file":"index.css"}

View File

@@ -0,0 +1,75 @@
{$layout "layout_popup"}
<h3>批量复制配置</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success" data-tea-done="done" data-tea-before="before">
<csrf-token></csrf-token>
<input type="hidden" name="serverId" :value="serverId"/>
<input type="hidden" name="configCode" :value="configCode"/>
<input type="hidden" name="targetsJSON" :value="JSON.stringify(targets)"/>
<table class="ui table definition selectable">
<tbody>
<tr>
<td class="title">将当前配置复制到</td>
<td>
<select class="ui dropdown auto-width" v-model="targetType" @change="changeTargetType">
<option value="">[选择目标]</option>
<option v-for="option in targetOptions" :value="option.code">{{option.name}}</option>
</select>
<p class="comment" v-if="configCode == 'waf'">目前只能同步WAF设置的启用和停用不能复制规则、IP名单等。</p>
</td>
</tr>
</tbody>
<!-- WAF特殊选项 -->
<tbody v-show="configCode == 'waf'">
<tr>
<td>同时拷贝国家/地区/省份封禁</td>
<td>
<checkbox name="wafCopyRegions"></checkbox>
<p class="comment">WAF设置专有选项。</p>
</td>
</tr>
</tbody>
<!-- 选择分组 -->
<tbody v-show="targetType == 'group'">
<tr v-show="userId > 0">
<td>分组</td>
<td>
<div class="checkboxes">
<checkbox v-for="userGroup in userGroups" :v-value="userGroup.id" @input="changeGroupId(userGroup.id)">{{userGroup.name}}</checkbox>
</div>
</td>
</tr>
</tbody>
<!-- 选择网站 -->
<tbody v-show="targetType == 'server'">
<tr>
<td>网站</td>
<td></td>
</tr>
</tbody>
<!-- 网站数量 -->
<tbody>
<tr>
<td>目标网站数量</td>
<td>
<span v-if="countServers < 0">-</span>
<span v-else><strong>{{countServers}}个</strong></span>
</td>
</tr>
<tr v-if="countServers > 0">
<td>提醒</td>
<td><span class="red">此操作无法撤销,请谨慎确认!</span></td>
</tr>
</tbody>
</table>
<submit-btn v-show="!isRequesting">确认复制</submit-btn>
<button class="ui button disabled" type="button" v-show="isRequesting">正在复制...</button>
</form>

View File

@@ -0,0 +1,51 @@
Tea.context(function () {
this.targetType = ""
this.countServers = -1
this.targets = []
this.reloadCountServers = function () {
this.countServers = -1
this.$post(".countServers")
.params({
"targets": this.targets
})
.success(function (resp) {
this.countServers = resp.data.countServers
})
}
this.changeTargetType = function () {
this.targets = []
this.countServers = -1
if (this.targetType.match(/^(user):/)) {
this.targets = [this.targetType]
this.reloadCountServers()
}
}
let groupIds = []
this.changeGroupId = function (groupId) {
if (groupIds.$contains(groupId)) {
groupIds.$removeValue(groupId)
} else {
groupIds.push(groupId)
}
if (groupIds.length > 0) {
this.targets = ["groups:" + groupIds.join(",")]
this.reloadCountServers()
} else {
this.targets = []
this.countServers = -1
}
}
this.isRequesting = false
this.before = function () {
this.isRequesting = true
}
this.done = function () {
this.isRequesting = false
}
})

View File

@@ -0,0 +1,6 @@
.checkboxes {
.checkbox {
width: 8em;
margin-bottom: 0.5em;
}
}