WAF动作增加显示HTML内容

This commit is contained in:
GoEdgeLab
2021-02-26 16:32:07 +08:00
parent 6b132482ca
commit 6eb0accbd5
4 changed files with 49 additions and 0 deletions

View File

@@ -43,6 +43,9 @@ func (this *CreatePopupAction) RunPost(params struct {
// http api
HttpAPIURL string
// html
HtmlContent string
Must *actions.Must
CSRF *actionutils.CSRF
}) {
@@ -90,6 +93,13 @@ func (this *CreatePopupAction) RunPost(params struct {
actionParams = &firewallconfigs.FirewallActionHTTPAPIConfig{
URL: params.HttpAPIURL,
}
case firewallconfigs.FirewallActionTypeHTML:
params.Must.
Field("htmlContent", params.HtmlContent).
Require("请输入HTML内容")
actionParams = &firewallconfigs.FirewallActionHTMLConfig{
Content: params.HtmlContent,
}
default:
this.Fail("选择的类型'" + params.Type + "'暂时不支持")
}

View File

@@ -72,6 +72,9 @@ func (this *UpdatePopupAction) RunPost(params struct {
// http api
HttpAPIURL string
// HTML内容
HtmlContent string
Must *actions.Must
CSRF *actionutils.CSRF
}) {
@@ -119,6 +122,13 @@ func (this *UpdatePopupAction) RunPost(params struct {
actionParams = &firewallconfigs.FirewallActionHTTPAPIConfig{
URL: params.HttpAPIURL,
}
case firewallconfigs.FirewallActionTypeHTML:
params.Must.
Field("htmlContent", params.HtmlContent).
Require("请输入HTML内容")
actionParams = &firewallconfigs.FirewallActionHTMLConfig{
Content: params.HtmlContent,
}
default:
this.Fail("选择的类型'" + params.Type + "'暂时不支持")
}

View File

@@ -92,6 +92,25 @@
</td>
</tr>
</tbody>
<!-- HTML -->
<tbody v-if="type == 'html'">
<tr>
<td>HTML内容 *</td>
<td>
<textarea name="htmlContent" maxlength="128000" placeholder="完整的HTML内容">&lt;!DOCTYPE html&gt;
&lt;html lang=&#34;zh&#34;&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;!-- 这里写提示文字 --&gt;
&lt;/body&gt;
&lt;/html&gt;</textarea>
</td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -92,6 +92,16 @@
</td>
</tr>
</tbody>
<!-- HTML -->
<tbody v-if="type == 'html'">
<tr>
<td>HTML内容 *</td>
<td>
<textarea name="htmlContent" maxlength="128000" placeholder="完整的HTML内容" v-model="action.params.content"></textarea>
</td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>
</form>