chore(lint): address linter
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
546600db93
commit
db9629a618
@ -300,7 +300,7 @@ func loggingMiddleware(c *gin.Context) {
|
|||||||
logData := log.Fields{
|
logData := log.Fields{
|
||||||
"type": "access",
|
"type": "access",
|
||||||
"ip": c.ClientIP(),
|
"ip": c.ClientIP(),
|
||||||
"latency": fmt.Sprintf("%s", latency),
|
"latency": latency.String(),
|
||||||
"status": c.Writer.Status(),
|
"status": c.Writer.Status(),
|
||||||
"method": c.Request.Method,
|
"method": c.Request.Method,
|
||||||
"path": c.Request.URL.Path,
|
"path": c.Request.URL.Path,
|
||||||
|
@ -206,7 +206,7 @@ func (api *API) appGetAdminLogs(c *gin.Context) {
|
|||||||
rawLog := scanner.Text()
|
rawLog := scanner.Text()
|
||||||
|
|
||||||
// Attempt JSON Pretty
|
// Attempt JSON Pretty
|
||||||
var jsonMap map[string]interface{}
|
var jsonMap map[string]any
|
||||||
err := json.Unmarshal([]byte(rawLog), &jsonMap)
|
err := json.Unmarshal([]byte(rawLog), &jsonMap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logLines = append(logLines, scanner.Text())
|
logLines = append(logLines, scanner.Text())
|
||||||
|
@ -1057,11 +1057,11 @@ func appErrorPage(c *gin.Context, errorCode int, errorMessage string) {
|
|||||||
|
|
||||||
func arrangeUserStatistics(userStatistics []database.GetUserStatisticsRow) gin.H {
|
func arrangeUserStatistics(userStatistics []database.GetUserStatisticsRow) gin.H {
|
||||||
// Item Sorter
|
// Item Sorter
|
||||||
sortItem := func(userStatistics []database.GetUserStatisticsRow, key string, less func(i int, j int) bool) []map[string]interface{} {
|
sortItem := func(userStatistics []database.GetUserStatisticsRow, key string, less func(i int, j int) bool) []map[string]any {
|
||||||
sortedData := append([]database.GetUserStatisticsRow(nil), userStatistics...)
|
sortedData := append([]database.GetUserStatisticsRow(nil), userStatistics...)
|
||||||
sort.SliceStable(sortedData, less)
|
sort.SliceStable(sortedData, less)
|
||||||
|
|
||||||
newData := make([]map[string]interface{}, 0)
|
newData := make([]map[string]any, 0)
|
||||||
for _, item := range sortedData {
|
for _, item := range sortedData {
|
||||||
v := reflect.Indirect(reflect.ValueOf(item))
|
v := reflect.Indirect(reflect.ValueOf(item))
|
||||||
|
|
||||||
@ -1077,7 +1077,7 @@ func arrangeUserStatistics(userStatistics []database.GetUserStatisticsRow) gin.H
|
|||||||
value = niceNumbers(rawVal)
|
value = niceNumbers(rawVal)
|
||||||
}
|
}
|
||||||
|
|
||||||
newData = append(newData, map[string]interface{}{
|
newData = append(newData, map[string]any{
|
||||||
"UserID": item.UserID,
|
"UserID": item.UserID,
|
||||||
"Value": value,
|
"Value": value,
|
||||||
})
|
})
|
||||||
|
@ -118,7 +118,9 @@ func (dbm *DBManager) init() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cache tables
|
// Cache tables
|
||||||
go dbm.CacheTempTables()
|
if err := dbm.CacheTempTables(); err != nil {
|
||||||
|
log.Warn("Refreshing temp table cache failed: ", err)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -188,7 +190,7 @@ func (dbm *DBManager) updateSettings() error {
|
|||||||
|
|
||||||
func (dbm *DBManager) performMigrations(isNew bool) error {
|
func (dbm *DBManager) performMigrations(isNew bool) error {
|
||||||
// Create context
|
// Create context
|
||||||
ctx := context.WithValue(context.Background(), "isNew", isNew)
|
ctx := context.WithValue(context.Background(), "isNew", isNew) // nolint
|
||||||
|
|
||||||
// Set DB migration
|
// Set DB migration
|
||||||
goose.SetBaseFS(migrations)
|
goose.SetBaseFS(migrations)
|
||||||
|
@ -115,7 +115,7 @@ func getSVGBezierControlPoint(currentPoint *SVGGraphPoint, prevPoint *SVGGraphPo
|
|||||||
// Modifiers
|
// Modifiers
|
||||||
var smoothingRatio float64 = 0.2
|
var smoothingRatio float64 = 0.2
|
||||||
var directionModifier float64 = 0
|
var directionModifier float64 = 0
|
||||||
if isReverse == true {
|
if isReverse {
|
||||||
directionModifier = math.Pi
|
directionModifier = math.Pi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ func getGBooksMetadata(metadataSearch MetadataInfo) ([]MetadataInfo, error) {
|
|||||||
func saveGBooksCover(gbid string, coverFilePath string, overwrite bool) error {
|
func saveGBooksCover(gbid string, coverFilePath string, overwrite bool) error {
|
||||||
// Validate File Doesn't Exists
|
// Validate File Doesn't Exists
|
||||||
_, err := os.Stat(coverFilePath)
|
_, err := os.Stat(coverFilePath)
|
||||||
if err == nil && overwrite == false {
|
if err == nil && !overwrite {
|
||||||
log.Warn("File Alreads Exists")
|
log.Warn("File Alreads Exists")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,8 @@ func hookAPI() *details {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert to JSON Response
|
// Convert to JSON Response
|
||||||
var responseData map[string]interface{}
|
var responseData map[string]any
|
||||||
json.Unmarshal([]byte(rawResp), &responseData)
|
_ = json.Unmarshal([]byte(rawResp), &responseData)
|
||||||
|
|
||||||
// Return Response
|
// Return Response
|
||||||
return httpmock.NewJsonResponse(200, responseData)
|
return httpmock.NewJsonResponse(200, responseData)
|
||||||
|
@ -109,6 +109,9 @@ func GetMetadata(filepath string) (*MetadataInfo, error) {
|
|||||||
|
|
||||||
// Acquire Metadata
|
// Acquire Metadata
|
||||||
metadataInfo, err := handler(filepath)
|
metadataInfo, err := handler(filepath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to acquire metadata")
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate MD5 & Partial MD5
|
// Calculate MD5 & Partial MD5
|
||||||
partialMD5, err := utils.CalculatePartialMD5(filepath)
|
partialMD5, err := utils.CalculatePartialMD5(filepath)
|
||||||
|
@ -15,7 +15,7 @@ func parseAnnasArchiveDownloadURL(body io.ReadCloser) (string, error) {
|
|||||||
|
|
||||||
// Return Download URL
|
// Return Download URL
|
||||||
downloadURL, exists := doc.Find("body > table > tbody > tr > td > a").Attr("href")
|
downloadURL, exists := doc.Find("body > table > tbody > tr > td > a").Attr("href")
|
||||||
if exists == false {
|
if !exists {
|
||||||
return "", fmt.Errorf("Download URL not found")
|
return "", fmt.Errorf("Download URL not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ func parseLibGenDownloadURL(body io.ReadCloser) (string, error) {
|
|||||||
// Return Download URL
|
// Return Download URL
|
||||||
// downloadURL, _ := doc.Find("#download [href*=cloudflare]").Attr("href")
|
// downloadURL, _ := doc.Find("#download [href*=cloudflare]").Attr("href")
|
||||||
downloadURL, exists := doc.Find("#download h2 a").Attr("href")
|
downloadURL, exists := doc.Find("#download h2 a").Attr("href")
|
||||||
if exists == false {
|
if !exists {
|
||||||
return "", fmt.Errorf("Download URL not found")
|
return "", fmt.Errorf("Download URL not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user