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,14 @@
{$layout "layout_popup"}
<h3>创建分组</h3>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<table class="ui table definition selectable">
<tr>
<td class="title">分组名称 *</td>
<td>
<input type="text" name="name" maxlength="50" ref="focus"/>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,7 @@
<first-menu>
<menu-item href="/servers/groups">分组列表</menu-item>
<span class="item disabled">|</span>
<menu-item :href="'/servers/groups/group?groupId=' + group.id" code="group.index">"{{group.name}}"详情</menu-item>
<menu-item :href="'/servers/groups/group/settings?groupId=' + group.id" :active="!firstMenuItem.startsWith('group.')">全局设置 &nbsp;<tip-icon content="这里添加的设置将会自动应用到当前分组下的所有网站。"></tip-icon></menu-item>
<menu-item :href="'/servers/groups/group/update?groupId=' + group.id" code="group.update">修改</menu-item>
</first-menu>

View File

@@ -0,0 +1,84 @@
{$layout}
{$template "menu"}
<table class="ui table definition selectable">
<tr>
<td class="title">分组名称</td>
<td>
{{group.name}}
</td>
</tr>
</table>
<h3>网站</h3>
<p class="comment" v-if="servers.length == 0">暂时还没有网站。</p>
<table class="ui table selectable celled" v-if="servers.length > 0">
<thead>
<tr>
<th>网站名称</th>
<th>所属用户</th>
<th>部署集群</th>
<th>域名</th>
<th>端口</th>
<th class="two wide center">状态</th>
<th class="two op">操作</th>
</tr>
</thead>
<tr v-for="server in servers">
<td><a :href="'/servers/server?serverId=' + server.id"><keyword :v-word="keyword">{{server.name}}</keyword></a>
<div style="margin-top:0.4em">
<grey-label>{{server.serverTypeName}}</grey-label>
</div>
</td>
<td>
<span v-if="server.user != null">{{server.user.fullname}}<link-icon v-if="canVisitUser" :href="'/users/user?userId=' + server.user.id"></link-icon></span>
<span v-else>-</span>
</td>
<td>{{server.cluster.name}}</td>
<td>
<span v-if="server.serverNames.length > 0">
<span v-if="server.serverNames[0].subNames == null || server.serverNames[0].subNames.length == 0"><keyword :v-word="keyword">{{server.serverNames[0].name}}</keyword></span>
<span v-else><keyword :v-word="keyword">{{server.serverNames[0].subNames[0]}}</keyword></span>
<span v-if="server.countServerNames > 1">等{{server.countServerNames}}个域名 <popup-icon :href="'/servers/serverNamesPopup?serverId=' + server.id" height="20em"></popup-icon></span>
</span>
<span v-else class="disabled">-</span>
<!-- 审核中 -->
<div v-if="server.isAuditing" style="margin-top: 0.5em">
<a class="ui label basic tiny red" title="点击跳到审核页面" :href="'/servers/server/settings/serverNames?serverId=' + server.id">审核中 &nbsp;<i class="icon long arrow right alternate"></i></a>
</div>
<!-- 审核失败 -->
<div v-if="!server.auditingIsOk" style="margin-top: 0.5em">
<a class="ui label basic tiny red" title="点击跳到审核页面" :href="'/servers/server/settings/serverNames?serverId=' + server.id">审核不通过 &nbsp;<i class="icon long arrow right alternate"></i></a>
</div>
</td>
<td>
<span v-if="server.ports.length == 0">-</span>
<div v-for="port in server.ports">
<tiny-basic-label><keyword :v-word="keyword">{{port.portRange}}</keyword><span class="small">{{port.protocol}}</span></tiny-basic-label>
</div>
</td>
<td class="center">
<div v-if="!checkDNS">
<label-on :v-is-on="server.isOn"></label-on>
</div>
<div v-else>
<span v-if="!server.isOn" class="grey">停用中</span>
<span v-else-if="server.status.isOk" class="green">正常</span>
<span v-else-if="server.status.message.length == 0">检查中</span>
<span v-else class="red">{{server.status.message}}
<tip-icon :content="server.status.todo"></tip-icon>
</span>
</div>
</td>
<td>
<a :href="'/servers/server?serverId=' + server.id">详情</a> &nbsp;
<a :href="'/servers/server/settings?serverId=' + server.id">设置</a>
</td>
</tr>
</table>
<div class="page" v-html="page"></div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.checkDNS = false
})

View File

@@ -0,0 +1,15 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<http-access-log-config-box
:v-access-log-config="accessLogConfig"
:v-fields="fields"
:v-default-field-codes="defaultFieldCodes"
:v-is-group="true"></http-access-log-config-box>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,5 @@
<first-menu>
<menu-item :href="'.?serverId=' + serverId" code="index">设置</menu-item>
<menu-item :href="'.purge?serverId=' + serverId" code="purge">刷新</menu-item>
<menu-item :href="'.fetch?serverId=' + serverId" code="fetch">预热</menu-item>
</first-menu>

View File

@@ -0,0 +1,13 @@
{$layout "layout_popup"}
<h3 v-if="!isReverse && cacheRef == null">添加缓存设置</h3>
<h3 v-if="!isReverse && cacheRef != null">修改缓存设置</h3>
<h3 v-if="isReverse && cacheRef == null">添加不缓存设置</h3>
<h3 v-if="isReverse && cacheRef != null">添加不缓存设置</h3>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<table class="ui table definition selectable">
<tbody is="http-cache-ref-box" :v-cache-ref="cacheRef" :v-is-reverse="isReverse"></tbody>
</table>
<p class="comment" v-if="isReverse">如果请求满足当前添加的条件,则不缓存。</p>
<submit-btn>确定</submit-btn>
</form>

View File

@@ -0,0 +1,9 @@
Tea.context(function () {
this.success = NotifyPopup
this.cacheRef = null
if (window.parent.UPDATING_CACHE_REF != null) {
this.cacheRef = window.parent.UPDATING_CACHE_REF
this.isReverse = this.cacheRef.isReverse
}
})

View File

@@ -0,0 +1,40 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "menu"}
<div class="margin"></div>
<div v-show="webConfig.cache == null || !webConfig.cache.isOn">
<p class="comment">没有开启缓存,不需要清理。</p>
</div>
<div v-show="webConfig.cache != null && webConfig.cache.isOn">
<p class="comment">可以在这里批量预热一组缓存URL。</p>
<form method="post" class="ui form" data-tea-action="$" data-tea-before="before" data-tea-success="success" data-tea-fail="fail" data-tea-done="done" data-tea-timeout="3600">
<input type="hidden" name="serverId" :value="serverId"/>
<input type="hidden" name="webId" :value="webId"/>
<table class="ui table definition selectable">
<tr>
<td>URL列表</td>
<td>
<textarea name="keys" rows="10" ref="focus"></textarea>
<p class="comment">每行一个URL。</p>
</td>
</tr>
<tr>
<td class="title">操作结果</td>
<td>
<div v-if="isRequesting">数据发送中...</div>
<span class="red" v-if="!isRequesting && !isOk && message.length > 0">失败:{{message}}</span>
<div v-if="!isRequesting && !isOk && failKeys.length > 0" class="fail-keys-box">
<div v-for="failKey in failKeys">
<span class="red">{{failKey.key}}: {{failKey.reason}}</span>
</div>
</div>
</td>
</tr>
</table>
<submit-btn v-if="!isRequesting">提交</submit-btn>
</form>
</div>
</div>

View File

@@ -0,0 +1,32 @@
Tea.context(function () {
this.isRequesting = false
this.isOk = false
this.message = ""
this.failKeys = []
this.before = function () {
this.isRequesting = true
this.isOk = false
this.message = ""
this.failKeys = []
}
this.success = function (resp) {
this.isOk = true
let f = NotifyReloadSuccess("任务提交成功")
f()
}
this.fail = function (resp) {
this.message = resp.message
if (resp.data.failKeys != null) {
this.failKeys = resp.data.failKeys
}
}
this.done = function () {
this.isRequesting = false
}
});

View File

@@ -0,0 +1,16 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<http-cache-config-box
:v-cache-config="cacheConfig"
:v-cache-policy="cachePolicy"
:v-is-group="true"
></http-cache-config-box>
<submit-btn></submit-btn>
<p class="comment">修改条件设置后请记得保存。</p>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,52 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "menu"}
<div class="margin"></div>
<div v-show="webConfig.cache == null || !webConfig.cache.isOn">
<p class="comment">没有开启缓存,不需要清理。</p>
</div>
<div v-show="webConfig.cache != null && webConfig.cache.isOn">
<p class="comment">可以在这里批量删除一组Key。</p>
<form method="post" class="ui form" data-tea-action="$" data-tea-before="before" data-tea-success="success" data-tea-fail="fail" data-tea-done="done" data-tea-timeout="300">
<input type="hidden" name="serverId" :value="serverId"/>
<input type="hidden" name="webId" :value="webId"/>
<table class="ui table definition selectable">
<tr>
<td class="title">操作类型</td>
<td>
<radio name="keyType" :v-value="'key'" v-model="keyType">URL</radio> &nbsp;
<radio name="keyType" :v-value="'prefix'" v-model="keyType">目录</radio>
</td>
</tr>
<tr>
<td>
<span v-if="keyType == 'key'">URL</span>
<span v-if="keyType == 'prefix'">目录</span>
</td>
<td>
<textarea name="keys" rows="10" ref="keysBox"></textarea>
<p class="comment" v-if="keyType == 'key'">每行一个URL比如<code-label>https://example.com/hello/world.html</code-label></p>
<p class="comment" v-if="keyType == 'prefix'">每行一个URL目录比如<code-label>https://example.com/hello/</code-label>;如果只填写域名部分,表示清理全站,比如<code-label>https://example.com/</code-label></p>
</td>
</tr>
<tr>
<td>操作结果</td>
<td>
<div v-if="isRequesting">数据发送中...</div>
<span class="red" v-if="!isRequesting && !isOk && message.length > 0">失败:{{message}}</span>
<div v-if="!isRequesting && !isOk && failKeys.length > 0" class="fail-keys-box">
<div v-for="failKey in failKeys">
<span class="red">{{failKey.key}}: {{failKey.reason}}</span>
</div>
</div>
</td>
</tr>
</table>
<submit-btn v-if="!isRequesting">提交</submit-btn>
</form>
</div>
</div>

View File

@@ -0,0 +1,43 @@
Tea.context(function () {
this.isRequesting = false
this.isOk = false
this.message = ""
this.failKeys = []
this.$delay(function () {
this.$refs.keysBox.focus()
this.$watch("keyType", function () {
this.$refs.keysBox.focus()
})
})
this.before = function () {
this.isRequesting = true
this.isOk = false
this.message = ""
this.failKeys = []
}
this.success = function () {
this.isOk = true
let f = NotifyReloadSuccess("任务提交成功")
f()
}
this.fail = function (resp) {
this.message = resp.message
if (resp.data.failKeys != null) {
this.failKeys = resp.data.failKeys
}
}
this.done = function () {
this.isRequesting = false
}
/**
* 操作类型
*/
this.keyType = "key" // key | prefix
})

View File

@@ -0,0 +1,11 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<http-charsets-box :v-usual-charsets="usualCharsets" :v-all-charsets="allCharsets" :v-charset-config="charsetConfig" :v-is-group="true"></http-charsets-box>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,15 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
<form method="post" class="ui form" data-tea-success="success" data-tea-action="$">
<input type="hidden" name="webId" :value="webId"/>
<input type="hidden" name="gzipId" :value="gzipConfig.id"/>
<http-gzip-box :v-gzip-ref="gzipRef" :v-gzip-config="gzipConfig"></http-gzip-box>
<div class="margin"></div>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,13 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<input type="hidden" name="webId" :value="webId"/>
<http-compression-config-box :v-compression-config="compressionConfig" :v-is-group="true"></http-compression-config-box>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,17 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
<div class="margin"></div>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<http-header-policy-box
:v-request-header-policy="requestHeaderPolicy"
:v-request-header-ref="requestHeaderRef"
:v-response-header-policy="responseHeaderPolicy"
:v-response-header-ref="responseHeaderRef"
:v-params="'groupId=' + group.id"
:v-is-group="true"></http-header-policy-box>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,5 @@
<second-menu>
<menu-item :href="Tea.url('.', {groupId: group.id})" code="index">源站列表</menu-item>
<menu-item :href="Tea.url('.scheduling', {groupId: group.id})" code="scheduling">调度算法</menu-item>
<menu-item :href="Tea.url('.setting', {groupId: group.id})" code="setting">更多设置</menu-item>
</second-menu>

View File

@@ -0,0 +1,19 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<div v-if="!reverseProxyRef.isPrior || !reverseProxyRef.isOn">
<div class="margin"></div>
<warning-message>当前源站没有启用,可以通过点击 <a :href="Tea.url('.setting', { groupId: group.id })">[更多设置]</a> 开启 。</warning-message>
</div>
<div :class="{'opacity-mask': !reverseProxyRef.isPrior || !reverseProxyRef.isOn}">
<origin-list-box :v-primary-origins="primaryOrigins" :v-backup-origins="backupOrigins"
:v-server-type="serverType"
:v-params="'type=group&groupId=' + group.id + '&reverseProxyId=' + reverseProxyConfig.id + '&serverType=' + serverType"
:v-is-group="true"></origin-list-box>
</div>
</div>

View File

@@ -0,0 +1,9 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<origin-scheduling-view-box :v-scheduling="scheduling" :v-params="'type=group&groupId=' + group.id + '&reverseProxyId=' + reverseProxyId + '&family=' + family"></origin-scheduling-view-box>
</div>

View File

@@ -0,0 +1,15 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<div class="margin"></div>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="groupId" :value="group.id"/>
<input type="hidden" name="reverseProxyRefJSON" :value="JSON.stringify(reverseProxyRef)"/>
<reverse-proxy-box :v-reverse-proxy-ref="reverseProxyRef" :v-reverse-proxy-config="reverseProxyConfig" :v-family="family" :v-is-group="true"></reverse-proxy-box>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,11 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<http-pages-and-shutdown-box :v-pages="pages" :v-shutdown-config="shutdownConfig" :v-enable-global-pages="enableGlobalPages"></http-pages-and-shutdown-box>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,16 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<input type="hidden" name="webId" :value="webId"/>
<http-remote-addr-config-box
:v-remote-addr-config="remoteAddrConfig"
:v-is-group="true"></http-remote-addr-config-box>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,16 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<csrf-token></csrf-token>
<http-request-limit-config-box
:v-request-limit-config="requestLimitConfig"
:v-is-group="true"></http-request-limit-config-box>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,11 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<http-stat-config-box :v-stat-config="statConfig" :v-is-group="true"></http-stat-config-box>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,5 @@
<second-menu>
<menu-item :href="Tea.url('.', {groupId: group.id})" code="index">源站列表</menu-item>
<menu-item :href="Tea.url('.scheduling', {groupId: group.id})" code="scheduling">调度算法</menu-item>
<menu-item :href="Tea.url('.setting', {groupId: group.id})" code="setting">更多设置</menu-item>
</second-menu>

View File

@@ -0,0 +1,19 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<div v-if="!reverseProxyRef.isPrior || !reverseProxyRef.isOn">
<div class="margin"></div>
<warning-message>当前源站没有启用,可以通过点击 <a :href="Tea.url('.setting', { groupId: group.id })">[更多设置]</a> 开启 。</warning-message>
</div>
<div :class="{'opacity-mask': !reverseProxyRef.isPrior || !reverseProxyRef.isOn}">
<origin-list-box :v-primary-origins="primaryOrigins" :v-backup-origins="backupOrigins"
:v-server-type="serverType"
:v-params="'type=group&groupId=' + group.id + '&reverseProxyId=' + reverseProxyConfig.id + '&serverType=' + serverType"
:v-is-group="true"></origin-list-box>
</div>
</div>

View File

@@ -0,0 +1,9 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<origin-scheduling-view-box :v-scheduling="scheduling" :v-params="'type=group&groupId=' + group.id + '&reverseProxyId=' + reverseProxyId + '&family=' + family"></origin-scheduling-view-box>
</div>

View File

@@ -0,0 +1,15 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<div class="margin"></div>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="groupId" :value="group.id"/>
<input type="hidden" name="reverseProxyRefJSON" :value="JSON.stringify(reverseProxyRef)"/>
<reverse-proxy-box :v-reverse-proxy-ref="reverseProxyRef" :v-reverse-proxy-config="reverseProxyConfig" :v-family="family" :v-is-group="true"></reverse-proxy-box>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,5 @@
<second-menu>
<menu-item :href="Tea.url('.', {groupId: group.id})" code="index">源站列表</menu-item>
<menu-item :href="Tea.url('.scheduling', {groupId: group.id})" code="scheduling">调度算法</menu-item>
<menu-item :href="Tea.url('.setting', {groupId: group.id})" code="setting">更多设置</menu-item>
</second-menu>

View File

@@ -0,0 +1,19 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<div v-if="!reverseProxyRef.isPrior || !reverseProxyRef.isOn">
<div class="margin"></div>
<warning-message>当前源站没有启用,可以通过点击 <a :href="Tea.url('.setting', { groupId: group.id })">[更多设置]</a> 开启 。</warning-message>
</div>
<div :class="{'opacity-mask': !reverseProxyRef.isPrior || !reverseProxyRef.isOn}">
<origin-list-box :v-primary-origins="primaryOrigins" :v-backup-origins="backupOrigins"
:v-server-type="serverType"
:v-params="'type=group&groupId=' + group.id + '&reverseProxyId=' + reverseProxyConfig.id + '&serverType=' + serverType"
:v-is-group="true"></origin-list-box>
</div>
</div>

View File

@@ -0,0 +1,9 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<origin-scheduling-view-box :v-scheduling="scheduling" :v-params="'type=group&groupId=' + group.id + '&reverseProxyId=' + reverseProxyId + '&family=' + family"></origin-scheduling-view-box>
</div>

View File

@@ -0,0 +1,15 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<div class="margin"></div>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="groupId" :value="group.id"/>
<input type="hidden" name="reverseProxyRefJSON" :value="JSON.stringify(reverseProxyRef)"/>
<reverse-proxy-box :v-reverse-proxy-ref="reverseProxyRef" :v-reverse-proxy-config="reverseProxyConfig" :v-family="family" :v-is-group="true"></reverse-proxy-box>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,11 @@
<first-menu>
<menu-item :href="'/servers/server/settings/waf?serverId=' + serverId" code="index">设置</menu-item>
<menu-item :href="'/servers/server/settings/waf/groups?serverId=' + serverId + '&type=inbound&firewallPolicyId='+firewallPolicyId" code="inbound">入站规则</menu-item>
<menu-item :href="'/servers/server/settings/waf/groups?serverId=' + serverId + '&type=outbound&firewallPolicyId='+firewallPolicyId" code="outbound">出站规则</menu-item>
<span class="item disabled">|</span>
<menu-item :href="'/servers/server/settings/waf/ipadmin/countries?serverId=' + serverId + '&firewallPolicyId='+firewallPolicyId" code="country">国家/地区封禁</menu-item>
<menu-item :href="'/servers/server/settings/waf/ipadmin/provinces?serverId=' + serverId + '&firewallPolicyId='+firewallPolicyId" code="province">省份封禁</menu-item>
<menu-item :href="'/servers/server/settings/waf/ipadmin/allowList?serverId=' + serverId + '&firewallPolicyId='+firewallPolicyId" code="allowList">白名单</menu-item>
<menu-item :href="'/servers/server/settings/waf/ipadmin/denyList?serverId=' + serverId + '&firewallPolicyId='+firewallPolicyId" code="denyList">黑名单</menu-item>
<menu-item :href="'/servers/server/settings/waf/ipadmin/test?serverId=' + serverId + '&firewallPolicyId='+firewallPolicyId" code="test">IP检查</menu-item>
</first-menu>

View File

@@ -0,0 +1,70 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "menu"}
<h3>分组<a href="" @click.prevent="updateGroup(group.id)">[修改]</a></h3>
<table class="ui table selectable definition">
<tr>
<td class="title">名称</td>
<td>{{group.name}}</td>
</tr>
<tr>
<td>描述</td>
<td>
<span v-if="group.description.length == 0" class="disabled">暂时还没有描述。</span>
<span v-if="group.description.length > 0">{{group.description}}</span>
</td>
</tr>
<tr>
<td>启用状态</td>
<td>
<label-on :v-is-on="group.isOn"></label-on>
</td>
</tr>
</table>
<h3 style="padding-top:0.8em">规则集<a href="" @click.prevent="createSet(group.id)">[添加规则集]</a> </h3>
<p class="comment" v-if="sets == null || sets.length == 0">暂时还没有规则。</p>
<table class="ui table selectable celled" id="sortable-table" v-if="sets != null && sets.length > 0">
<thead>
<tr>
<th style="width:3em"></th>
<th nowrap="">规则集名称</th>
<th nowrap="">规则</th>
<th nowrap="" class="center one wide">规则关系</th>
<th nowrap="">动作</th>
<th class="three op">操作</th>
</tr>
</thead>
<tbody v-for="set in sets" :data-set-id="set.id">
<tr>
<td style="text-align: center;"><i class="icon bars handle grey"></i> </td>
<td nowrap=""><a href="" @click.prevent="updateSet(set.id)"><span :class="{disabled:!set.isOn}">{{set.name}}</span> <i class="icon expand small"></i></a>
<p style="margin-top:0.5em">
<label-on :v-is-on="set.isOn"></label-on>
</p>
</td>
<td class="rules-box">
<div v-for="rule in set.rules" style="margin-top: 0.4em;margin-bottom:0.4em">
<http-firewall-rule-label :v-rule="rule"></http-firewall-rule-label>
</div>
<span class="ui disabled" v-if="set.rules.length == 0">暂时还没有规则</span>
</td>
<td class="center">
<span v-if="set.connector.toUpperCase() == 'OR'"></span><span v-else></span>
<span class="small grey">({{set.connector.toUpperCase()}})</span>
</td>
<td nowrap="">
<http-firewall-actions-view :v-actions="set.actions"></http-firewall-actions-view>
</td>
<td>
<a href="" @click.prevent="updateSet(set.id)">修改</a> &nbsp; <a href="" @click.prevent="updateSetOn(set.id, false)" v-if="set.isOn">停用</a><a href="" @click.prevent="updateSetOn(set.id, true)" v-if="!set.isOn"><span class="red">启用</span></a> &nbsp; <a href="" @click.prevent="deleteSet(set.id)">删除</a>
</td>
</tr>
</tbody>
</table>
<p class="comment" v-if="group.sets != null && group.sets.length > 1">所有规则匹配顺序为从上到下,可以拖动左侧的<i class="icon bars"></i>排序。</p>
</div>

View File

@@ -0,0 +1,82 @@
Tea.context(function () {
this.$delay(function () {
let that = this
sortTable(function () {
let setIds = []
document
.querySelectorAll("tbody[data-set-id]")
.forEach(function (v) {
setIds.push(v.getAttribute("data-set-id"))
})
that.$post("/servers/components/waf/sortSets")
.params({
groupId: that.group.id,
setIds: setIds
})
.success(function () {
teaweb.successToast("排序保存成功")
})
})
})
// 更改分组
this.updateGroup = function (groupId) {
teaweb.popup("/servers/components/waf/updateGroupPopup?groupId=" + groupId, {
height: "20em",
callback: function () {
teaweb.success("保存成功", function () {
window.location.reload()
})
}
})
}
// 创建规则集
this.createSet = function (groupId) {
teaweb.popup("/servers/components/waf/createSetPopup?firewallPolicyId=" + this.firewallPolicyId + "&groupId=" + groupId + "&type=" + this.type, {
width: "50em",
height: "40em",
callback: function () {
teaweb.success("保存成功", function () {
window.location.reload()
})
}
})
}
// 修改规则集
this.updateSet = function (setId) {
teaweb.popup("/servers/components/waf/updateSetPopup?firewallPolicyId=" + this.firewallPolicyId + "&groupId=" + this.group.id + "&type=" + this.type + "&setId=" + setId, {
width: "50em",
height: "40em",
callback: function () {
teaweb.success("保存成功", function () {
window.location.reload()
})
}
})
}
// 停用|启用规则集
this.updateSetOn = function (setId, isOn) {
this.$post("/servers/components/waf/updateSetOn")
.params({
setId: setId,
isOn: isOn ? 1 : 0
})
.refresh()
}
// 删除规则集
this.deleteSet = function (setId) {
let that = this
teaweb.confirm("确定要删除此规则集吗?", function () {
that.$post("/servers/components/waf/deleteSet")
.params({
groupId: this.group.id,
setId: setId
})
.refresh()
})
}
})

View File

@@ -0,0 +1,50 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "menu"}
<second-menu>
<a href="" class="item" @click.prevent="createGroup(type)">[添加分组]</a>
</second-menu>
<warning-message v-if="!wafIsOn">当前WAF未启用设置将在<a :href="'/servers/server/settings/waf?serverId=' + serverId">[启用Web防火墙]</a>后生效。</warning-message>
<p class="comment" v-if="groups.length == 0">暂时还没有规则分组。</p>
<table class="ui table selectable celled" v-if="groups.length > 0" id="sortable-table">
<thead>
<tr>
<th style="width:3em"></th>
<th>规则分组</th>
<th class="center">规则集</th>
<th class="three op">操作</th>
</tr>
</thead>
<tbody v-for="group in groups" :data-group-id="group.id">
<tr>
<td style="text-align: center;"><i class="icon bars handle grey" title="拖动排序"></i> </td>
<td><a :href="'/servers/server/settings/waf/group?serverId=' + serverId + '&firewallPolicyId=' + firewallPolicyId + '&type=' + type + '&groupId=' + group.id"><span :class="{disabled:!group.isOn}">{{group.name}}</span></a>
<p class="comment" v-if="group.description.length > 0" style="padding-bottom:0">{{group.description}}</p>
<p style="margin-top: 0.5em">
<span v-if="group.isOn" class="ui label tiny basic green">启用</span>
<span v-if="!group.isOn" class="ui label tiny basic red">停用</span>
<span v-if="group.code.length > 0" class="ui label basic tiny">预置</span>
<span v-if="group.code.length == 0" class="ui label basic tiny">自定义</span>
</p>
</td>
<td class="center">
<a :href="'/servers/server/settings/waf/group?serverId=' + serverId + '&firewallPolicyId=' + firewallPolicyId + '&type=' + type + '&groupId=' + group.id">{{group.countSets}}</a>
</td>
<td>
<a :href="'/servers/server/settings/waf/group?serverId=' + serverId + '&firewallPolicyId=' + firewallPolicyId + '&type=' + type + '&groupId=' + group.id">详情</a> &nbsp;
<a href="" v-if="!group.isOn" @click.prevent="enableGroup(group.id)">启用</a><a href="" v-if="group.isOn" @click.prevent="disableGroup(group.id)">停用</a> &nbsp;
<a href="" @click.prevent="deleteGroup(group.id)" v-if="group.canDelete">删除</a>
</td>
</tr>
</tbody>
</table>
<p class="comment" v-if="groups.length > 0">所有规则匹配顺序为从上到下,可以拖动左侧的<i class="icon bars"></i>排序。</p>
</div>

View File

@@ -0,0 +1,67 @@
Tea.context(function () {
// 排序
this.$delay(function () {
let that = this
sortTable(function () {
let groupIds = []
document.querySelectorAll("tbody[data-group-id]")
.forEach(function (v) {
groupIds.push(v.getAttribute("data-group-id"))
})
that.$post("/servers/components/waf/sortGroups")
.params({
firewallPolicyId: that.firewallPolicyId,
type: that.type,
groupIds: groupIds
})
.success(function () {
teaweb.successToast("排序保存成功")
})
})
})
// 启用
this.enableGroup = function (groupId) {
this.$post("/servers/components/waf/updateGroupOn")
.params({
groupId: groupId,
isOn: 1
})
.refresh()
}
// 停用
this.disableGroup = function (groupId) {
this.$post("/servers/components/waf/updateGroupOn")
.params({
groupId: groupId,
isOn: 0
})
.refresh()
}
// 删除
this.deleteGroup = function (groupId) {
teaweb.confirm("确定要删除此规则分组吗?", function () {
this.$post("/servers/components/waf/deleteGroup")
.params({
firewallPolicyId: this.firewallPolicyId,
groupId: groupId
})
.refresh()
})
}
// 添加分组
this.createGroup = function (type) {
teaweb.popup("/servers/components/waf/createGroupPopup?firewallPolicyId=" + this.firewallPolicyId + "&type=" + type, {
callback: function () {
teaweb.success("保存成功", function () {
window.location.reload()
})
}
})
}
})

View File

@@ -0,0 +1,11 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<http-firewall-config-box :v-firewall-config="firewallConfig" :v-firewall-policy="firewallPolicy" :v-is-group="true"></http-firewall-config-box>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,25 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../menu"}
<warning-message v-if="!featureIsOn">尚未为当前用户开通此功能。</warning-message>
{$ if .featureIsOn}
<second-menu>
<menu-item @click.prevent="createIP('white')">添加IP</menu-item>
<span class="item">|</span>
<div class="item"><ip-list-bind-box :v-http-firewall-policy-id="firewallPolicyId" :v-type="'white'"></ip-list-bind-box></div>
<span class="item">|</span>
<span class="item">ID: {{listId}} &nbsp; <tip-icon content="ID可以用于使用API操作此IP名单"></tip-icon></span>
</second-menu>
<warning-message v-if="!wafIsOn">当前WAF未启用设置将在<a :href="'/servers/server/settings/waf?serverId=' + serverId">[启用Web防火墙]</a>后生效。</warning-message>
<p class="comment" v-if="items.length == 0">暂时还没有IP。</p>
<ip-list-table v-if="items.length > 0" :v-items="items" @update-item="updateItem" @delete-item="deleteItem"></ip-list-table>
<div class="page" v-html="page"></div>
{$end}
</div>

View File

@@ -0,0 +1,38 @@
Tea.context(function () {
this.updateItem = function (itemId) {
teaweb.popup(Tea.url(".updateIPPopup?listId=" + this.listId, {itemId: itemId}), {
height: "30em",
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
this.deleteItem = function (itemId) {
let that = this
teaweb.confirm("确定要删除这个IP吗", function () {
that.$post(".deleteIP")
.params({
"listId": this.listId,
"itemId": itemId
})
.refresh()
})
}
/**
* 添加IP名单菜单
*/
this.createIP = function (type) {
teaweb.popup("/servers/iplists/createIPPopup?listId=" + this.listId + '&type=' + type, {
height: "30em",
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
})

View File

@@ -0,0 +1,16 @@
.region-letter-group .item {
padding-left: 1em !important;
padding-right: 1em !important;
}
.country-group {
padding-bottom: 1em;
}
.country-group .country-list .item {
float: left;
width: 12em;
margin-bottom: 0.5em;
}
.country-group .country-list .item .checkbox label {
font-size: 12px !important;
}
/*# sourceMappingURL=countries.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["countries.less"],"names":[],"mappings":"AAAA,oBACC;EACC,4BAAA;EACA,6BAAA;;AAIF;EAaC,mBAAA;;AAbD,cACC,cACC;EACC,WAAA;EACA,WAAA;EACA,oBAAA;;AALH,cACC,cACC,MAKC,UAAU;EACT,0BAAA","file":"countries.css"}

View File

@@ -0,0 +1,54 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../menu"}
<warning-message v-if="!featureIsOn">尚未为当前用户开通此功能。</warning-message>
{$ if .featureIsOn}
<warning-message v-if="!wafIsOn">当前WAF未启用设置将在<a :href="'/servers/server/settings/waf?serverId=' + serverId">[启用Web防火墙]</a>后生效。</warning-message>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="firewallPolicyId" :value="firewallPolicyId"/>
<input type="hidden" name="exceptURLPatternsJSON" :value="JSON.stringify(exceptURLPatterns)"/>
<input type="hidden" name="onlyURLPatternsJSON" :value="JSON.stringify(onlyURLPatterns)"/>
<table class="ui table selectable definition">
<tr>
<td class="title">仅允许的区域</td>
<td>
<http-firewall-region-selector :v-countries="allowedCountries" :v-type="'allow'" @change="changeAllowedCountries"></http-firewall-region-selector>
</td>
</tr>
<tr>
<td class="title">仅封禁的区域</td>
<td>
<p class="comment" v-if="allowedCountries.length > 0">由于你已设置"仅允许的区域",所以不需要再设置封禁区域。</p>
<http-firewall-region-selector :v-countries="deniedCountries" :v-type="'deny'" v-show="allowedCountries.length == 0"></http-firewall-region-selector>
</td>
</tr>
<tr>
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>
<tbody v-show="moreOptionsVisible">
<tr>
<td>例外URL &nbsp;<tip-icon content="对这些URL将不做任何限制。"></tip-icon></td>
<td><url-patterns-box v-model="exceptURLPatterns"></url-patterns-box></td>
</tr>
<tr>
<td>限制URL &nbsp;<tip-icon content="只对这些URL做限制。"></tip-icon></td>
<td><url-patterns-box v-model="onlyURLPatterns"></url-patterns-box></td>
</tr>
<tr>
<td>允许搜索引擎</td>
<td>
<checkbox name="allowSearchEngine" v-model="allowSearchEngine"></checkbox>
<p class="comment">选中后表示如果请求来自常见搜索引擎的IP则不受区域限制。</p>
</td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>
</form>
{$end}
</div>

View File

@@ -0,0 +1,11 @@
Tea.context(function () {
this.success = function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
this.changeAllowedCountries = function (event) {
this.allowedCountries = event.countries
}
})

View File

@@ -0,0 +1,22 @@
.region-letter-group {
.item {
padding-left: 1em !important;
padding-right: 1em !important;
}
}
.country-group {
.country-list {
.item {
float: left;
width: 12em;
margin-bottom: 0.5em;
.checkbox label {
font-size: 12px !important;
}
}
}
padding-bottom: 1em;
}

View File

@@ -0,0 +1,25 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../menu"}
<warning-message v-if="!featureIsOn">尚未为当前用户开通此功能。</warning-message>
{$ if .featureIsOn}
<second-menu>
<menu-item @click.prevent="createIP('black')">添加IP</menu-item>
<span class="item">|</span>
<div class="item"><ip-list-bind-box :v-http-firewall-policy-id="firewallPolicyId" :v-type="'black'"></ip-list-bind-box></div>
<span class="item">|</span>
<span class="item">ID: {{listId}} &nbsp; <tip-icon content="ID可以用于使用API操作此IP名单"></tip-icon></span>
</second-menu>
<warning-message v-if="!wafIsOn">当前WAF未启用设置将在<a :href="'/servers/server/settings/waf?serverId=' + serverId">[启用Web防火墙]</a>后生效。</warning-message>
<p class="comment" v-if="items.length == 0">暂时还没有IP。</p>
<ip-list-table v-if="items.length > 0" :v-items="items" @update-item="updateItem" @delete-item="deleteItem"></ip-list-table>
<div class="page" v-html="page"></div>
{$end}
</div>

View File

@@ -0,0 +1,38 @@
Tea.context(function () {
this.updateItem = function (itemId) {
teaweb.popup(Tea.url(".updateIPPopup?listId=" + this.listId, {itemId: itemId}), {
height: "30em",
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
this.deleteItem = function (itemId) {
let that = this
teaweb.confirm("确定要删除这个IP吗", function () {
that.$post(".deleteIP")
.params({
"listId": this.listId,
"itemId": itemId
})
.refresh()
})
}
/**
* 添加IP名单菜单
*/
this.createIP = function (type) {
teaweb.popup("/servers/iplists/createIPPopup?listId=" + this.listId + '&type=' + type, {
height: "30em",
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
})

View File

@@ -0,0 +1,9 @@
.province-list .item {
float: left;
width: 12em;
margin-bottom: 0.5em;
}
.province-list .item .checkbox label {
font-size: 12px !important;
}
/*# sourceMappingURL=provinces.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["provinces.less"],"names":[],"mappings":"AAAA,cACC;EACC,WAAA;EACA,WAAA;EACA,oBAAA;;AAJF,cACC,MAKC,UAAU;EACT,0BAAA","file":"provinces.css"}

View File

@@ -0,0 +1,47 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../menu"}
<warning-message v-if="!featureIsOn">尚未为当前用户开通此功能。</warning-message>
{$ if .featureIsOn}
<warning-message v-if="!wafIsOn">当前WAF未启用设置将在<a :href="'/servers/server/settings/waf?serverId=' + serverId">[启用Web防火墙]</a>后生效。</warning-message>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="firewallPolicyId" :value="firewallPolicyId"/>
<input type="hidden" name="exceptURLPatternsJSON" :value="JSON.stringify(exceptURLPatterns)"/>
<input type="hidden" name="onlyURLPatternsJSON" :value="JSON.stringify(onlyURLPatterns)"/>
<table class="ui table selectable definition">
<tr>
<td class="title">仅允许的省份</td>
<td>
<http-firewall-province-selector :v-provinces="allowedProvinces" :v-type="'allow'" @change="changeAllowedProvinces"></http-firewall-province-selector>
</td>
</tr>
<tr>
<td class="title">仅封禁的省份</td>
<td>
<p class="comment" v-if="allowedProvinces.length > 0">由于你已设置"仅允许的省份",所以不需要再设置封禁省份。</p>
<http-firewall-province-selector :v-provinces="deniedProvinces" :v-type="'deny'" v-show="allowedProvinces.length == 0"></http-firewall-province-selector>
</td>
</tr>
<tr>
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>
<tbody v-show="moreOptionsVisible">
<tr>
<td>例外URL &nbsp;<tip-icon content="对这些URL将不做任何限制。"></tip-icon></td>
<td><url-patterns-box v-model="exceptURLPatterns"></url-patterns-box></td>
</tr>
<tr>
<td>限制URL &nbsp;<tip-icon content="只对这些URL做限制。"></tip-icon></td>
<td><url-patterns-box v-model="onlyURLPatterns"></url-patterns-box></td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>
</form>
{$end}
</div>

View File

@@ -0,0 +1,11 @@
Tea.context(function () {
this.success = function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
this.changeAllowedProvinces = function (event) {
this.allowedProvinces = event.provinces
}
})

View File

@@ -0,0 +1,11 @@
.province-list {
.item {
float: left;
width: 12em;
margin-bottom: 0.5em;
.checkbox label {
font-size: 12px !important;
}
}
}

View File

@@ -0,0 +1,56 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../menu"}
<warning-message v-if="!featureIsOn">尚未为当前用户开通此功能。</warning-message>
{$ if .featureIsOn}
<warning-message v-if="!wafIsOn">当前WAF未启用设置将在<a :href="'/servers/server/settings/waf?serverId=' + serverId">[启用Web防火墙]</a>后生效。</warning-message>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="firewallPolicyId" :value="firewallPolicyId"/>
<table class="ui table selectable definition">
<tr>
<td class="title">IP *</td>
<td>
<input type="text" name="ip" class="text" maxlength="100" ref="focus" placeholder="x.x.x.x" v-model="ip"/>
<p class="comment">要检查的IP</p>
</td>
</tr>
<tr>
<td>检查结果</td>
<td>
<div v-if="result.isDone">
<div v-if="!result.isOk">
<span class="red">{{result.error}}</span>
</div>
<div v-if="result.isFound">
<div v-if="result.item != null">
<div v-if="result.isAllowed">
<span class="green" v-if="result.item.listType == 'white'">在白名单中 <ip-item-text :v-item="result.item"></ip-item-text>&nbsp;<a href="" @click.prevent="updateItem(result.list.id, result.item.id)" title="查看和修改"><i class="icon pencil small"></i></a></span>
<span class="grey" v-if="result.item.listType == 'grey'">在灰名单中 <ip-item-text :v-item="result.item"></ip-item-text>&nbsp;<a href="" @click.prevent="updateItem(result.list.id, result.item.id)" title="查看和修改"><i class="icon pencil small"></i></a></span>
</div>
<div v-else>
<span class="red">在黑名单中 <ip-item-text :v-item="result.item"></ip-item-text>&nbsp;<a href="" @click.prevent="updateItem(result.list.id, result.item.id)" title="查看和修改"><i class="icon pencil small"></i></a></span>
</div>
</div>
<div v-if="result.province != null">
<span class="red">在省份封禁中 "{{result.province.name}}"</span>
</div>
<div v-if="result.country != null && result.province == null">
<span class="red">在国家/地区封禁中 "{{result.country.name}}"</span>
</div>
</div>
<div v-if="!result.isFound">
没有找到和{{ip}}匹配的配置。
</div>
</div>
</td>
</tr>
</table>
<submit-btn>检查IP状态</submit-btn>
</form>
{$end}
</div>

View File

@@ -0,0 +1,35 @@
Tea.context(function () {
this.ip = ""
this.result = {
isDone: false,
isOk: false,
isFound: false,
isAllowed: false,
error: "",
province: null,
country: null,
ipItem: null,
ipList: null
}
this.$delay(function () {
this.$watch("ip", function () {
this.result.isDone = false
})
})
this.success = function (resp) {
this.result = resp.data.result
}
this.updateItem = function (listId, itemId) {
teaweb.popup(Tea.url(".updateIPPopup?listId=" + listId, {itemId: itemId}), {
height: "30em",
callback: function () {
teaweb.success("保存成功", function () {
})
}
})
}
})

View File

@@ -0,0 +1,59 @@
{$layout "layout_popup"}
<h3>修改IP</h3>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="itemId" :value="item.id"/>
<input type="hidden" name="type" :value="item.type"/>
<csrf-token></csrf-token>
<table class="ui table definition selectable">
<tr>
<td class="title">类型 *</td>
<td>
<!-- 类型不允许修改 -->
<span v-if="item.type == 'ipv4'">IPv4</span>
<span v-if="item.type == 'ipv6'">IPv6</span>
<span v-if="item.type == 'all'">所有IP</span>
<p class="comment" v-if="type == 'ipv4'">单个IPv4或一个IPv4范围。</p>
<p class="comment" v-if="type == 'ipv6'">单个IPv6或一个IPv6范围。</p>
<p class="comment" v-if="type == 'all'">允许或禁用所有的IP。</p>
</td>
</tr>
<tbody v-if="type != 'all'">
<tr>
<td>IP或IP段 *</td>
<td>
<input type="text" name="value" maxlength="64" placeholder="x.x.x.x" ref="focus" v-model="item.value" style="width: 20em"/>
</td>
</tr>
</tbody>
<tr>
<td>过期时间</td>
<td>
<datetime-input :v-name="'expiredAt'" :v-timestamp="item.expiredAt"></datetime-input>
<p class="comment">在加入名单某一段时间后会失效,留空表示永久有效。</p>
</td>
</tr>
<tr>
<td>级别</td>
<td>
<firewall-event-level-options :v-value="item.eventLevel"></firewall-event-level-options>
</td>
</tr>
<tr>
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>
<tbody v-show="moreOptionsVisible">
<tr>
<td>备注</td>
<td><input type="text" name="reason" maxlength="100" v-model="item.reason"/></td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,11 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
<form method="post" class="ui form" data-tea-success="success" data-tea-action="$">
<input type="hidden" name="webId" :value="webId"/>
<http-web-root-box :v-root-config="rootConfig" :v-is-group="true"></http-web-root-box>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,14 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<input type="hidden" name="webId" :value="webId"/>
<http-webp-config-box :v-webp-config="webpConfig" :v-is-group="true"></http-webp-config-box>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,11 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<http-websocket-box :v-websocket-ref="websocketRef" :v-websocket-config="websocketConfig" :v-is-group="true"></http-websocket-box>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,15 @@
{$layout "layout"}
{$template "menu"}
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="groupId" :value="group.id"/>
<table class="ui table definition selectable">
<tr>
<td class="title">分组名称 *</td>
<td>
<input type="text" name="name" maxlength="50" ref="focus" v-model="group.name"/>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,5 @@
Tea.context(function () {
this.success = NotifySuccess("保存成功", ".", {
groupId: this.group.id
})
})

View File

@@ -0,0 +1,39 @@
{$layout}
<first-menu>
<menu-item href="/servers/groups" active="true">列表</menu-item>
<span class="item">|</span>
<a href="" class="item" @click.prevent="createGroup()">[创建]</a>
</first-menu>
<p class="comment" v-if="groups.length == 0">暂时还没有分组。</p>
<div v-show="groups.length > 0">
<div class="margin"></div>
<table class="ui table selectable celled" id="sortable-table">
<thead>
<tr>
<th style="width:3em"></th>
<th>分组名称</th>
<th class="center width10">服务数量</th>
<th class="two op">操作</th>
</tr>
</thead>
<tbody v-for="group in groups" :data-group-id="group.id">
<tr>
<td style="text-align: center;"><i class="icon bars handle grey"></i> </td>
<td>
<a :href="'/servers/groups/group?groupId=' + group.id">{{group.name}}</a>
</td>
<td class="center">
<a :href="'/servers?groupId=' + group.id" v-if="group.countServers > 0">{{group.countServers}}</a>
<span v-else class="disabled">0</span>
</td>
<td>
<a :href="'/servers/groups/group?groupId=' + group.id">详情</a> &nbsp; <a href="" @click.prevent="deleteGroup(group.id)">删除</a>
</td>
</tr>
</tbody>
</table>
</div>
<p v-if="groups.length > 0" class="comment">可以拖动左侧的<i class="icon bars"></i>排序。</p>

View File

@@ -0,0 +1,43 @@
Tea.context(function () {
this.$delay(function () {
let that = this
sortTable(function () {
let groupIds = []
document.querySelectorAll("*[data-group-id]").forEach(function (element) {
groupIds.push(element.getAttribute("data-group-id"))
})
that.$post("/servers/groups/sort")
.params({
groupIds: groupIds
})
.success(function () {
teaweb.successToast("保存成功")
})
})
})
this.createGroup = function () {
teaweb.popup("/servers/groups/createPopup", {
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
this.deleteGroup = function (groupId) {
let that = this
teaweb.confirm("确定要删除这个分组吗?", function () {
that.$post("/servers/groups/group/delete")
.params({
groupId: groupId
})
.success(function () {
teaweb.success("删除成功", function () {
teaweb.reload()
})
})
})
}
})

View File

@@ -0,0 +1,22 @@
{$layout "layout_popup"}
<h3>选择分组</h3>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="groupId" :value="groupId"/>
<table class="ui table definition selectable">
<tr>
<td class="title">选择分组</td>
<td>
<div v-if="groups.length > 0">
<a href="" class="ui label small basic" v-for="group in groups" :class="{blue:group.id == groupId}" style="margin-bottom:0.5em" @click.prevent="selectGroup(group)">{{group.name}}</a>
<p class="comment">点击可已选中要使用的分组。</p>
</div>
<div v-else>
<p class="comment">暂时还没有可以使用的分组。</p>
</div>
</td>
</tr>
</table>
<submit-btn>确定</submit-btn>
</form>

View File

@@ -0,0 +1,8 @@
Tea.context(function () {
this.success = NotifyPopup
this.groupId = 0
this.selectGroup = function (group) {
this.groupId = group.id
}
})