feat: publish sanitized custom.97 source

This commit is contained in:
cneicy committed 2026-10-27 20:43:39 +08:00
1 parent 8e6ed0317b
commit 86c0276156
1022 files changed
+69903 -19207

No files matched your search

+20 -12
View File
@@ -5,11 +5,28 @@ import (
"strconv"
"github.com/QuantumNous/new-api/common"
"github.com/QuantumNous/new-api/i18n"
"github.com/QuantumNous/new-api/model"
"github.com/QuantumNous/new-api/setting/operation_setting"
"github.com/gin-gonic/gin"
)
func limitLogTimeRange(startTimestamp int64, endTimestamp int64) (int64, error) {
maxRange := operation_setting.GetLogSetting().MaxRangeSeconds()
end := common.GetTimestamp()
if endTimestamp != 0 {
end = min(end, endTimestamp)
}
if startTimestamp == 0 {
return end - maxRange, nil
}
if end-startTimestamp > maxRange {
return 0, common.NewMessage("The time range cannot exceed {{days}} days", map[string]any{"days": maxRange / (24 * 60 * 60)})
}
return startTimestamp, nil
}
func GetAllLogs(c *gin.Context) {
pageInfo := common.GetPageQuery(c)
logType, _ := strconv.Atoi(c.Query("type"))
@@ -62,27 +79,18 @@ func GetUserLogs(c *gin.Context) {
// Deprecated: SearchAllLogs 已废弃,前端未使用该接口。
func SearchAllLogs(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "该接口已废弃",
})
common.ApiErrorT(c, "This API is deprecated")
}
// Deprecated: SearchUserLogs 已废弃,前端未使用该接口。
func SearchUserLogs(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "该接口已废弃",
})
common.ApiErrorT(c, "This API is deprecated")
}
func GetLogByKey(c *gin.Context) {
tokenId := c.GetInt("token_id")
if tokenId == 0 {
c.JSON(200, gin.H{
"success": false,
"message": "无效的令牌",
})
common.ApiErrorI18n(c, i18n.MsgTokenInvalid)
return
}
logs, err := model.GetLogByTokenId(tokenId)