MCPcopy Index your code
hub / github.com/1Panel-dev/1Panel / HandleNotSecurity

Function HandleNotSecurity

core/utils/security/security.go:98–115  ·  view source on GitHub ↗
(c *gin.Context, resType string)

Source from the content-addressed store, hash-verified

96}
97
98func HandleNotSecurity(c *gin.Context, resType string) {
99 code := LoadErrCode()
100 if code == 444 {
101 CloseDirectly(c)
102 return
103 }
104
105 file := fmt.Sprintf("html/%d.html", code)
106 if code == http.StatusOK && resType != "" {
107 file = fmt.Sprintf("html/200_%s.html", resType)
108 }
109 data, err := res.ErrorMsg.ReadFile(file)
110 if err != nil {
111 c.String(http.StatusInternalServerError, "Internal Server Error")
112 return
113 }
114 c.Data(code, "text/html; charset=utf-8", data)
115}
116
117func LoadErrCode() int {
118 settingRepo := repo.NewISettingRepo()

Callers 2

HandleNotRouteFunction · 0.85
CheckSecurityFunction · 0.85

Calls 3

LoadErrCodeFunction · 0.85
CloseDirectlyFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected