summaryrefslogtreecommitdiff
path: root/router/rule_endpoint.go
diff options
context:
space:
mode:
Diffstat (limited to 'router/rule_endpoint.go')
-rw-r--r--router/rule_endpoint.go30
1 files changed, 29 insertions, 1 deletions
diff --git a/router/rule_endpoint.go b/router/rule_endpoint.go
index d8bc59f..15df06f 100644
--- a/router/rule_endpoint.go
+++ b/router/rule_endpoint.go
@@ -1,7 +1,7 @@
/*
* @Author: EnderByEndera
* @Date: 2021-01-16 08:12:49
- * @LastEditTime: 2021-01-16 08:16:53
+ * @LastEditTime: 2021-02-01 06:26:33
* @LastEditors: Please set LastEditors
* @Description: rule_endpoint has the function for all the command rules' endpoint, including getter and setter
* @FilePath: /commdetection/router/rule_endpoint.go
@@ -135,3 +135,31 @@ func setEvaluationRulesEndpoint(c *gin.Context) {
"message": "ok",
})
}
+
+func getWebsiteRuleEndpoint(c *gin.Context) {
+ ussites, err := model.UnMarshalUnsensitiveWebsiteSetting()
+ if err != nil {
+ handleErr(c, err)
+ return
+ }
+ logger.Debugln("Start to send spaths to the front end")
+ c.JSON(http.StatusOK, gin.H{
+ "message": "ok",
+ "ussites": ussites,
+ })
+}
+
+func setWebsiteRuleEndpoint(c *gin.Context) {
+ ussites := model.Ussites{}
+ if err := c.ShouldBind(&ussites); err != nil {
+ handleErr(c, err)
+ return
+ }
+ if err := model.MarshalUnsensitiveWebsiteSetting(ussites); err != nil {
+ handleErr(c, err)
+ return
+ }
+ c.JSON(http.StatusOK, gin.H{
+ "message": "ok",
+ })
+}