mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-08 00:18:12 +08:00
Go: add soft fingerprint framework (#17837)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -823,6 +823,47 @@ func (h *Handler) UpdateSystemLicenseConfig(c *gin.Context) {
|
||||
common.SuccessWithData(c, result, "System license config updated successfully")
|
||||
}
|
||||
|
||||
type SetSoftFingerprintRequest struct {
|
||||
SoftFingerprint string `json:"fingerprint" binding:"required"`
|
||||
}
|
||||
|
||||
func (h *Handler) SetSoftFingerprint(c *gin.Context) {
|
||||
var req SetSoftFingerprintRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
println("JSON bind error: %v (type: %T)", err, err)
|
||||
common.ErrorWithCode(c, common.CodeBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
err := h.service.SetSoftFingerprint(req.SoftFingerprint)
|
||||
if err != nil {
|
||||
common.ErrorWithCode(c, common.CodeServerError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
common.SuccessNoData(c, "SUCCESS")
|
||||
}
|
||||
|
||||
func (h *Handler) ShowSoftFingerprint(c *gin.Context) {
|
||||
softFingerprint, err := h.service.GetSoftFingerprint()
|
||||
if err != nil {
|
||||
common.ErrorWithCode(c, common.CodeServerError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
common.SuccessWithData(c, softFingerprint, "")
|
||||
}
|
||||
|
||||
func (h *Handler) DeleteSoftFingerprint(c *gin.Context) {
|
||||
err := h.service.DeleteSoftFingerprint()
|
||||
if err != nil {
|
||||
common.ErrorWithCode(c, common.CodeServerError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
common.SuccessNoData(c, "SUCCESS")
|
||||
}
|
||||
|
||||
type ShowUserActivityRequest struct {
|
||||
Days int `json:"days"`
|
||||
Email string `json:"email"`
|
||||
|
||||
Reference in New Issue
Block a user