Go: add soft fingerprint framework (#17837)

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-08-05 13:54:09 +08:00
committed by GitHub
parent f057544e31
commit 1e78789448
8 changed files with 191 additions and 0 deletions

View File

@@ -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"`