diff --git a/Dockerfile b/Dockerfile index 9a270f3..8b1f962 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,8 @@ FROM golang:1.21-alpine AS builder LABEL authors="Nite07" +RUN apk add --no-cache git + WORKDIR /app COPY go.mod go.sum ./ RUN go mod download @@ -9,7 +11,10 @@ COPY . . RUN go install github.com/swaggo/swag/cmd/swag@latest RUN swag init ARG version=dev -RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X pcgamedb/constant.Version=${version}" -o pcgamedb . +RUN if [ "$version" = "dev" ]; then \ + version=$(git describe --tags --always); \ + fi && \ + CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X github.com/nitezs/pcgamedb/constant.Version=${version}" -o pcgamedb . FROM alpine:latest WORKDIR /app diff --git a/build.sh b/build.sh index 1d0d44f..e125816 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ go install github.com/swaggo/swag/cmd/swag@latest swag init CGO_ENABLED=0 -go build -o gamedb . +go build -o pcgamedb -ldflags "-s -w -X github.com/nitezs/pcgamedb/constant.Version=$(git describe --tags --always)" . diff --git a/cache/redis.go b/cache/redis.go index c04145f..6e528e2 100644 --- a/cache/redis.go +++ b/cache/redis.go @@ -3,11 +3,12 @@ package cache import ( "context" "fmt" - "pcgamedb/config" - "pcgamedb/log" "sync" "time" + "github.com/nitezs/pcgamedb/config" + "github.com/nitezs/pcgamedb/log" + "github.com/redis/go-redis/v9" ) diff --git a/cmd/clean.go b/cmd/clean.go index fad92ae..370b341 100644 --- a/cmd/clean.go +++ b/cmd/clean.go @@ -1,8 +1,8 @@ package cmd import ( - "pcgamedb/log" - "pcgamedb/task" + "github.com/nitezs/pcgamedb/log" + "github.com/nitezs/pcgamedb/task" "github.com/spf13/cobra" ) diff --git a/cmd/crawl.go b/cmd/crawl.go index 1232854..35e5a85 100644 --- a/cmd/crawl.go +++ b/cmd/crawl.go @@ -3,12 +3,13 @@ package cmd import ( "errors" "fmt" - "pcgamedb/crawler" - "pcgamedb/log" - "pcgamedb/utils" "strconv" "strings" + "github.com/nitezs/pcgamedb/crawler" + "github.com/nitezs/pcgamedb/log" + "github.com/nitezs/pcgamedb/utils" + "github.com/spf13/cobra" "go.uber.org/zap" ) diff --git a/cmd/format.go b/cmd/format.go index 6a1a7e7..dcd90c0 100644 --- a/cmd/format.go +++ b/cmd/format.go @@ -1,11 +1,12 @@ package cmd import ( - "pcgamedb/crawler" - "pcgamedb/db" - "pcgamedb/log" "strings" + "github.com/nitezs/pcgamedb/crawler" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/log" + "github.com/spf13/cobra" "go.uber.org/zap" ) diff --git a/cmd/list.go b/cmd/list.go index 0be4c2b..0af5609 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -1,8 +1,8 @@ package cmd import ( - "pcgamedb/db" - "pcgamedb/log" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/log" "github.com/spf13/cobra" "go.uber.org/zap" diff --git a/cmd/organize.go b/cmd/organize.go index dcfcd6b..4b62432 100644 --- a/cmd/organize.go +++ b/cmd/organize.go @@ -1,9 +1,9 @@ package cmd import ( - "pcgamedb/crawler" - "pcgamedb/db" - "pcgamedb/log" + "github.com/nitezs/pcgamedb/crawler" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/log" "github.com/spf13/cobra" "go.uber.org/zap" diff --git a/cmd/organize_manually.go b/cmd/organize_manually.go index d6984ee..ce6b3eb 100644 --- a/cmd/organize_manually.go +++ b/cmd/organize_manually.go @@ -3,9 +3,10 @@ package cmd import ( "encoding/json" "os" - "pcgamedb/crawler" - "pcgamedb/db" - "pcgamedb/log" + + "github.com/nitezs/pcgamedb/crawler" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/log" "github.com/spf13/cobra" "go.mongodb.org/mongo-driver/bson/primitive" diff --git a/cmd/server.go b/cmd/server.go index a9fb40b..06b0df5 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -1,8 +1,8 @@ package cmd import ( - "pcgamedb/config" - "pcgamedb/server" + "github.com/nitezs/pcgamedb/config" + "github.com/nitezs/pcgamedb/server" "github.com/spf13/cobra" ) diff --git a/cmd/task.go b/cmd/task.go index 84ac44e..16b1264 100644 --- a/cmd/task.go +++ b/cmd/task.go @@ -1,8 +1,8 @@ package cmd import ( - "pcgamedb/log" - "pcgamedb/task" + "github.com/nitezs/pcgamedb/log" + "github.com/nitezs/pcgamedb/task" "github.com/robfig/cron/v3" "github.com/spf13/cobra" diff --git a/cmd/update.go b/cmd/update.go index 258eaa2..80d50ea 100644 --- a/cmd/update.go +++ b/cmd/update.go @@ -1,9 +1,9 @@ package cmd import ( - "pcgamedb/crawler" - "pcgamedb/db" - "pcgamedb/log" + "github.com/nitezs/pcgamedb/crawler" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/log" "github.com/spf13/cobra" "go.mongodb.org/mongo-driver/bson/primitive" diff --git a/cmd/version.go b/cmd/version.go index 9d5e4bc..82f64ef 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -2,9 +2,10 @@ package cmd import ( "fmt" - "pcgamedb/constant" "runtime" + "github.com/nitezs/pcgamedb/constant" + "github.com/spf13/cobra" ) diff --git a/constant/version.go b/constant/version.go index 43dc7e0..990e714 100644 --- a/constant/version.go +++ b/constant/version.go @@ -1,5 +1,5 @@ package constant -const ( +var ( Version = "dev" ) diff --git a/crawler/1337x.go b/crawler/1337x.go index 515d33e..29d3ac8 100644 --- a/crawler/1337x.go +++ b/crawler/1337x.go @@ -8,10 +8,10 @@ import ( "strconv" "strings" - "pcgamedb/constant" - "pcgamedb/db" - "pcgamedb/model" - "pcgamedb/utils" + "github.com/nitezs/pcgamedb/constant" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" + "github.com/nitezs/pcgamedb/utils" "github.com/PuerkitoBio/goquery" "go.uber.org/zap" diff --git a/crawler/armgddn.go b/crawler/armgddn.go index c32997a..9959ce0 100644 --- a/crawler/armgddn.go +++ b/crawler/armgddn.go @@ -6,14 +6,15 @@ import ( "fmt" "io" "net/url" - "pcgamedb/db" - "pcgamedb/model" - "pcgamedb/utils" "regexp" "strconv" "strings" "time" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" + "github.com/nitezs/pcgamedb/utils" + "github.com/jlaffaye/ftp" "go.uber.org/zap" ) diff --git a/crawler/chovka.go b/crawler/chovka.go index 84d0aa2..fe92c95 100644 --- a/crawler/chovka.go +++ b/crawler/chovka.go @@ -4,13 +4,14 @@ import ( "bytes" "errors" "fmt" - "pcgamedb/constant" - "pcgamedb/db" - "pcgamedb/model" - "pcgamedb/utils" "strconv" "strings" + "github.com/nitezs/pcgamedb/constant" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" + "github.com/nitezs/pcgamedb/utils" + "github.com/PuerkitoBio/goquery" "go.uber.org/zap" ) diff --git a/crawler/crawler.go b/crawler/crawler.go index fcbad8d..b882def 100644 --- a/crawler/crawler.go +++ b/crawler/crawler.go @@ -1,7 +1,7 @@ package crawler import ( - "pcgamedb/model" + "github.com/nitezs/pcgamedb/model" "go.uber.org/zap" ) diff --git a/crawler/dodi.go b/crawler/dodi.go index e369c83..8fe3dd3 100644 --- a/crawler/dodi.go +++ b/crawler/dodi.go @@ -1,11 +1,12 @@ package crawler import ( - "pcgamedb/model" - "pcgamedb/utils" "regexp" "strings" + "github.com/nitezs/pcgamedb/model" + "github.com/nitezs/pcgamedb/utils" + "go.uber.org/zap" ) diff --git a/crawler/fitgirl.go b/crawler/fitgirl.go index 5fc42a1..de8696b 100644 --- a/crawler/fitgirl.go +++ b/crawler/fitgirl.go @@ -4,14 +4,15 @@ import ( "bytes" "errors" "fmt" - "pcgamedb/constant" - "pcgamedb/db" - "pcgamedb/model" - "pcgamedb/utils" "regexp" "strconv" "strings" + "github.com/nitezs/pcgamedb/constant" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" + "github.com/nitezs/pcgamedb/utils" + "github.com/PuerkitoBio/goquery" "go.uber.org/zap" ) diff --git a/crawler/freegog.go b/crawler/freegog.go index 825c083..1dc552e 100644 --- a/crawler/freegog.go +++ b/crawler/freegog.go @@ -4,13 +4,14 @@ import ( "bytes" "encoding/base64" "html" - "pcgamedb/constant" - "pcgamedb/db" - "pcgamedb/model" - "pcgamedb/utils" "regexp" "strings" + "github.com/nitezs/pcgamedb/constant" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" + "github.com/nitezs/pcgamedb/utils" + "github.com/PuerkitoBio/goquery" "go.uber.org/zap" ) diff --git a/crawler/game.go b/crawler/game.go index 9c7c018..1338f47 100644 --- a/crawler/game.go +++ b/crawler/game.go @@ -2,13 +2,14 @@ package crawler import ( "errors" - "pcgamedb/db" - "pcgamedb/model" - "pcgamedb/utils" "regexp" "strings" "time" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" + "github.com/nitezs/pcgamedb/utils" + "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" ) diff --git a/crawler/gnarly.go b/crawler/gnarly.go index c18c13d..82727c4 100644 --- a/crawler/gnarly.go +++ b/crawler/gnarly.go @@ -2,13 +2,14 @@ package crawler import ( "bytes" - "pcgamedb/constant" - "pcgamedb/db" - "pcgamedb/model" - "pcgamedb/utils" "regexp" "strings" + "github.com/nitezs/pcgamedb/constant" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" + "github.com/nitezs/pcgamedb/utils" + "github.com/PuerkitoBio/goquery" "go.uber.org/zap" ) diff --git a/crawler/goggames.go b/crawler/goggames.go index a5ebff3..5ac89d0 100644 --- a/crawler/goggames.go +++ b/crawler/goggames.go @@ -4,14 +4,15 @@ import ( "bytes" "errors" "fmt" - "pcgamedb/constant" - "pcgamedb/db" - "pcgamedb/model" - "pcgamedb/utils" "regexp" "strconv" "strings" + "github.com/nitezs/pcgamedb/constant" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" + "github.com/nitezs/pcgamedb/utils" + "github.com/PuerkitoBio/goquery" "go.uber.org/zap" ) diff --git a/crawler/igdb.go b/crawler/igdb.go index a0ba5ec..270c695 100644 --- a/crawler/igdb.go +++ b/crawler/igdb.go @@ -5,16 +5,17 @@ import ( "errors" "fmt" "net/url" - "pcgamedb/cache" - "pcgamedb/config" - "pcgamedb/constant" - "pcgamedb/db" - "pcgamedb/model" - "pcgamedb/utils" "regexp" "runtime/debug" "strconv" "strings" + + "github.com/nitezs/pcgamedb/cache" + "github.com/nitezs/pcgamedb/config" + "github.com/nitezs/pcgamedb/constant" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" + "github.com/nitezs/pcgamedb/utils" ) var TwitchToken string diff --git a/crawler/kaoskrew.go b/crawler/kaoskrew.go index c363655..ca7d340 100644 --- a/crawler/kaoskrew.go +++ b/crawler/kaoskrew.go @@ -1,10 +1,11 @@ package crawler import ( - "pcgamedb/model" "regexp" "strings" + "github.com/nitezs/pcgamedb/model" + "go.uber.org/zap" ) diff --git a/crawler/onlinefix.go b/crawler/onlinefix.go index f670633..e6d0d2b 100644 --- a/crawler/onlinefix.go +++ b/crawler/onlinefix.go @@ -7,15 +7,16 @@ import ( "fmt" "net/url" "os" - "pcgamedb/config" - "pcgamedb/constant" - "pcgamedb/db" - "pcgamedb/model" - "pcgamedb/utils" "regexp" "strconv" "strings" + "github.com/nitezs/pcgamedb/config" + "github.com/nitezs/pcgamedb/constant" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" + "github.com/nitezs/pcgamedb/utils" + "github.com/PuerkitoBio/goquery" "go.uber.org/zap" ) diff --git a/crawler/steam.go b/crawler/steam.go index c0d71e3..980ec59 100644 --- a/crawler/steam.go +++ b/crawler/steam.go @@ -5,15 +5,16 @@ import ( "errors" "fmt" "net/url" - "pcgamedb/cache" - "pcgamedb/config" - "pcgamedb/constant" - "pcgamedb/db" - "pcgamedb/model" - "pcgamedb/utils" "regexp" "strconv" "strings" + + "github.com/nitezs/pcgamedb/cache" + "github.com/nitezs/pcgamedb/config" + "github.com/nitezs/pcgamedb/constant" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" + "github.com/nitezs/pcgamedb/utils" ) func _GetSteamID(name string) (int, error) { diff --git a/crawler/steam250.go b/crawler/steam250.go index a7bab20..906e646 100644 --- a/crawler/steam250.go +++ b/crawler/steam250.go @@ -4,16 +4,17 @@ import ( "bytes" "encoding/json" "fmt" - "pcgamedb/cache" - "pcgamedb/config" - "pcgamedb/constant" - "pcgamedb/db" - "pcgamedb/model" - "pcgamedb/utils" "regexp" "strconv" "time" + "github.com/nitezs/pcgamedb/cache" + "github.com/nitezs/pcgamedb/config" + "github.com/nitezs/pcgamedb/constant" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" + "github.com/nitezs/pcgamedb/utils" + "github.com/PuerkitoBio/goquery" ) diff --git a/crawler/steamrip.go b/crawler/steamrip.go index 504814d..73701d5 100644 --- a/crawler/steamrip.go +++ b/crawler/steamrip.go @@ -4,13 +4,14 @@ import ( "bytes" "errors" "fmt" - "pcgamedb/constant" - "pcgamedb/db" - "pcgamedb/model" - "pcgamedb/utils" "regexp" "strings" + "github.com/nitezs/pcgamedb/constant" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" + "github.com/nitezs/pcgamedb/utils" + "github.com/PuerkitoBio/goquery" "go.uber.org/zap" ) diff --git a/crawler/xatab.go b/crawler/xatab.go index 42fb720..114eecf 100644 --- a/crawler/xatab.go +++ b/crawler/xatab.go @@ -4,14 +4,15 @@ import ( "bytes" "errors" "fmt" - "pcgamedb/constant" - "pcgamedb/db" - "pcgamedb/model" - "pcgamedb/utils" "regexp" "strconv" "strings" + "github.com/nitezs/pcgamedb/constant" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" + "github.com/nitezs/pcgamedb/utils" + "github.com/PuerkitoBio/goquery" "go.uber.org/zap" ) diff --git a/db/1337x.go b/db/1337x.go index d2bd444..4ab1a3e 100644 --- a/db/1337x.go +++ b/db/1337x.go @@ -1,7 +1,7 @@ package db import ( - "pcgamedb/model" + "github.com/nitezs/pcgamedb/model" ) func GetDODIGameDownloads() ([]*model.GameDownload, error) { diff --git a/db/armgddn.go b/db/armgddn.go index e1fd53d..c181e62 100644 --- a/db/armgddn.go +++ b/db/armgddn.go @@ -1,6 +1,6 @@ package db -import "pcgamedb/model" +import "github.com/nitezs/pcgamedb/model" func IsARMGDDNCrawled(flag string) bool { return IsGameCrawled(flag, "armgddn") diff --git a/db/custom_collection.go b/db/custom_collection.go index 1e38a9c..abac750 100644 --- a/db/custom_collection.go +++ b/db/custom_collection.go @@ -2,7 +2,8 @@ package db import ( "context" - "pcgamedb/config" + + "github.com/nitezs/pcgamedb/config" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" diff --git a/db/db.go b/db/db.go index 8018f24..3a68710 100644 --- a/db/db.go +++ b/db/db.go @@ -3,11 +3,12 @@ package db import ( "context" "fmt" - "pcgamedb/config" - "pcgamedb/log" "sync" "time" + "github.com/nitezs/pcgamedb/config" + "github.com/nitezs/pcgamedb/log" + "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" diff --git a/db/fitgirl.go b/db/fitgirl.go index 1dd32fa..e41a2a4 100644 --- a/db/fitgirl.go +++ b/db/fitgirl.go @@ -1,6 +1,6 @@ package db -import "pcgamedb/model" +import "github.com/nitezs/pcgamedb/model" func GetFitgirlAllGameDownloads() ([]*model.GameDownload, error) { return GetGameDownloadsByAuthor("fitgirl") diff --git a/db/freegog.go b/db/freegog.go index c1fd8bc..7407f40 100644 --- a/db/freegog.go +++ b/db/freegog.go @@ -1,7 +1,7 @@ package db import ( - "pcgamedb/model" + "github.com/nitezs/pcgamedb/model" ) func GetFreeGOGGameDownloads() ([]*model.GameDownload, error) { diff --git a/db/game.go b/db/game.go index a94bb5f..e158f9d 100644 --- a/db/game.go +++ b/db/game.go @@ -5,14 +5,15 @@ import ( "encoding/json" "errors" "fmt" - "pcgamedb/cache" - "pcgamedb/config" - "pcgamedb/model" "regexp" "slices" "strings" "time" + "github.com/nitezs/pcgamedb/cache" + "github.com/nitezs/pcgamedb/config" + "github.com/nitezs/pcgamedb/model" + "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" diff --git a/db/onlinefix.go b/db/onlinefix.go index db84166..5625228 100644 --- a/db/onlinefix.go +++ b/db/onlinefix.go @@ -1,7 +1,7 @@ package db import ( - "pcgamedb/model" + "github.com/nitezs/pcgamedb/model" ) func GetOnlineFixGameDownloads() ([]*model.GameDownload, error) { diff --git a/db/xatab.go b/db/xatab.go index 4d737a9..a3afbef 100644 --- a/db/xatab.go +++ b/db/xatab.go @@ -1,7 +1,7 @@ package db import ( - "pcgamedb/model" + "github.com/nitezs/pcgamedb/model" ) func GetXatabGameDownloads() ([]*model.GameDownload, error) { diff --git a/go.mod b/go.mod index a9a04a1..658a982 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module pcgamedb +module github.com/nitezs/pcgamedb go 1.21.5 diff --git a/log/log.go b/log/log.go index 812bf77..f5bb157 100644 --- a/log/log.go +++ b/log/log.go @@ -2,9 +2,10 @@ package log import ( "os" - "pcgamedb/config" "strings" + "github.com/nitezs/pcgamedb/config" + "go.uber.org/zap" "go.uber.org/zap/zapcore" "gopkg.in/natefinch/lumberjack.v2" diff --git a/main.go b/main.go index c00c3da..b8fa9b1 100644 --- a/main.go +++ b/main.go @@ -1,10 +1,11 @@ package main import ( - "pcgamedb/cmd" - "pcgamedb/log" "strings" + "github.com/nitezs/pcgamedb/cmd" + "github.com/nitezs/pcgamedb/log" + "go.uber.org/zap" ) diff --git a/server/handler/clean_game.go b/server/handler/clean_game.go index 50176ab..8987581 100644 --- a/server/handler/clean_game.go +++ b/server/handler/clean_game.go @@ -2,8 +2,9 @@ package handler import ( "net/http" - "pcgamedb/log" - "pcgamedb/task" + + "github.com/nitezs/pcgamedb/log" + "github.com/nitezs/pcgamedb/task" "github.com/gin-gonic/gin" ) diff --git a/server/handler/delete_game_info.go b/server/handler/delete_game_info.go index 2dda0e9..965d516 100644 --- a/server/handler/delete_game_info.go +++ b/server/handler/delete_game_info.go @@ -2,7 +2,8 @@ package handler import ( "net/http" - "pcgamedb/db" + + "github.com/nitezs/pcgamedb/db" "github.com/gin-gonic/gin" "go.mongodb.org/mongo-driver/bson/primitive" diff --git a/server/handler/get_all_authors.go b/server/handler/get_all_authors.go index 2eeb5cd..5da93b2 100644 --- a/server/handler/get_all_authors.go +++ b/server/handler/get_all_authors.go @@ -2,7 +2,8 @@ package handler import ( "net/http" - "pcgamedb/db" + + "github.com/nitezs/pcgamedb/db" "github.com/gin-gonic/gin" ) diff --git a/server/handler/get_game_Infos_by_name.go b/server/handler/get_game_Infos_by_name.go index 60c0ccc..e75546e 100644 --- a/server/handler/get_game_Infos_by_name.go +++ b/server/handler/get_game_Infos_by_name.go @@ -2,8 +2,9 @@ package handler import ( "net/http" - "pcgamedb/db" - "pcgamedb/model" + + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" "github.com/gin-gonic/gin" ) diff --git a/server/handler/get_game_download_by_id.go b/server/handler/get_game_download_by_id.go index 95d527a..e969418 100644 --- a/server/handler/get_game_download_by_id.go +++ b/server/handler/get_game_download_by_id.go @@ -2,8 +2,9 @@ package handler import ( "net/http" - "pcgamedb/db" - "pcgamedb/model" + + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" "github.com/gin-gonic/gin" "go.mongodb.org/mongo-driver/bson/primitive" diff --git a/server/handler/get_game_download_by_raw_name.go b/server/handler/get_game_download_by_raw_name.go index a6c6430..27041c9 100644 --- a/server/handler/get_game_download_by_raw_name.go +++ b/server/handler/get_game_download_by_raw_name.go @@ -2,8 +2,9 @@ package handler import ( "net/http" - "pcgamedb/db" - "pcgamedb/model" + + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" "github.com/gin-gonic/gin" "go.mongodb.org/mongo-driver/mongo" diff --git a/server/handler/get_game_downloads_by_author.go b/server/handler/get_game_downloads_by_author.go index 3a9d213..b80b678 100644 --- a/server/handler/get_game_downloads_by_author.go +++ b/server/handler/get_game_downloads_by_author.go @@ -2,8 +2,9 @@ package handler import ( "net/http" - "pcgamedb/db" - "pcgamedb/model" + + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" "github.com/gin-gonic/gin" ) diff --git a/server/handler/get_game_info_by_id.go b/server/handler/get_game_info_by_id.go index 86e97f8..c743cff 100644 --- a/server/handler/get_game_info_by_id.go +++ b/server/handler/get_game_info_by_id.go @@ -2,8 +2,9 @@ package handler import ( "net/http" - "pcgamedb/db" - "pcgamedb/model" + + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" "github.com/gin-gonic/gin" "go.mongodb.org/mongo-driver/bson/primitive" diff --git a/server/handler/get_game_info_by_platform_id.go b/server/handler/get_game_info_by_platform_id.go index cae7148..399c5d1 100644 --- a/server/handler/get_game_info_by_platform_id.go +++ b/server/handler/get_game_info_by_platform_id.go @@ -2,8 +2,9 @@ package handler import ( "net/http" - "pcgamedb/db" - "pcgamedb/model" + + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" "github.com/gin-gonic/gin" "go.mongodb.org/mongo-driver/mongo" diff --git a/server/handler/get_ranking.go b/server/handler/get_ranking.go index 2ed4752..a0d939e 100644 --- a/server/handler/get_ranking.go +++ b/server/handler/get_ranking.go @@ -2,8 +2,9 @@ package handler import ( "net/http" - "pcgamedb/crawler" - "pcgamedb/model" + + "github.com/nitezs/pcgamedb/crawler" + "github.com/nitezs/pcgamedb/model" "github.com/gin-gonic/gin" ) diff --git a/server/handler/get_unorganized_game_downloads.go b/server/handler/get_unorganized_game_downloads.go index 7e1925f..60480a4 100644 --- a/server/handler/get_unorganized_game_downloads.go +++ b/server/handler/get_unorganized_game_downloads.go @@ -2,8 +2,9 @@ package handler import ( "net/http" - "pcgamedb/db" - "pcgamedb/model" + + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" "github.com/gin-gonic/gin" ) diff --git a/server/handler/healthcheck.go b/server/handler/healthcheck.go index 90d99e2..fa666a4 100644 --- a/server/handler/healthcheck.go +++ b/server/handler/healthcheck.go @@ -3,11 +3,12 @@ package handler import ( "fmt" "net/http" - "pcgamedb/config" - "pcgamedb/db" "runtime" "time" + "github.com/nitezs/pcgamedb/config" + "github.com/nitezs/pcgamedb/db" + "github.com/gin-gonic/gin" ) diff --git a/server/handler/organize_game_info.go b/server/handler/organize_game_info.go index 8128353..6dbf120 100644 --- a/server/handler/organize_game_info.go +++ b/server/handler/organize_game_info.go @@ -2,8 +2,9 @@ package handler import ( "net/http" - "pcgamedb/crawler" - "pcgamedb/model" + + "github.com/nitezs/pcgamedb/crawler" + "github.com/nitezs/pcgamedb/model" "github.com/gin-gonic/gin" "go.mongodb.org/mongo-driver/bson/primitive" diff --git a/server/handler/search_games.go b/server/handler/search_games.go index 1a641fa..b3c43eb 100644 --- a/server/handler/search_games.go +++ b/server/handler/search_games.go @@ -2,8 +2,9 @@ package handler import ( "net/http" - "pcgamedb/db" - "pcgamedb/model" + + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" "github.com/gin-gonic/gin" ) diff --git a/server/handler/update_game_info.go b/server/handler/update_game_info.go index 87884bd..fb693dc 100644 --- a/server/handler/update_game_info.go +++ b/server/handler/update_game_info.go @@ -2,11 +2,12 @@ package handler import ( "net/http" - "pcgamedb/crawler" - "pcgamedb/db" - "pcgamedb/model" "strings" + "github.com/nitezs/pcgamedb/crawler" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/model" + "github.com/gin-gonic/gin" "go.mongodb.org/mongo-driver/bson/primitive" ) diff --git a/server/middleware/auth.go b/server/middleware/auth.go index d25a939..962258d 100644 --- a/server/middleware/auth.go +++ b/server/middleware/auth.go @@ -2,9 +2,10 @@ package middleware import ( "net/http" - "pcgamedb/config" "strings" + "github.com/nitezs/pcgamedb/config" + "github.com/gin-gonic/gin" ) diff --git a/server/middleware/log.go b/server/middleware/log.go index ea47dc7..b977dba 100644 --- a/server/middleware/log.go +++ b/server/middleware/log.go @@ -1,11 +1,12 @@ package middleware import ( - "pcgamedb/log" "strconv" "strings" "time" + "github.com/nitezs/pcgamedb/log" + "github.com/gin-gonic/gin" "go.uber.org/zap" ) diff --git a/server/middleware/recover.go b/server/middleware/recover.go index 9296a2f..be8c0f2 100644 --- a/server/middleware/recover.go +++ b/server/middleware/recover.go @@ -2,7 +2,8 @@ package middleware import ( "net/http" - "pcgamedb/log" + + "github.com/nitezs/pcgamedb/log" "github.com/gin-gonic/gin" "go.uber.org/zap" diff --git a/server/route.go b/server/route.go index 09936f4..1747e5d 100644 --- a/server/route.go +++ b/server/route.go @@ -1,13 +1,13 @@ package server import ( - "pcgamedb/server/handler" - "pcgamedb/server/middleware" + "github.com/nitezs/pcgamedb/server/handler" + "github.com/nitezs/pcgamedb/server/middleware" "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" - docs "pcgamedb/docs" + docs "github.com/nitezs/pcgamedb/docs" swaggerfiles "github.com/swaggo/files" ginSwagger "github.com/swaggo/gin-swagger" diff --git a/server/server.go b/server/server.go index 41c6e1e..a199d75 100644 --- a/server/server.go +++ b/server/server.go @@ -2,14 +2,15 @@ package server import ( "io" - "pcgamedb/cache" - "pcgamedb/config" - "pcgamedb/db" - "pcgamedb/log" - "pcgamedb/server/middleware" - "pcgamedb/task" "time" + "github.com/nitezs/pcgamedb/cache" + "github.com/nitezs/pcgamedb/config" + "github.com/nitezs/pcgamedb/db" + "github.com/nitezs/pcgamedb/log" + "github.com/nitezs/pcgamedb/server/middleware" + "github.com/nitezs/pcgamedb/task" + "github.com/gin-gonic/gin" "github.com/robfig/cron/v3" "go.uber.org/zap" diff --git a/task/clean.go b/task/clean.go index a7f193c..a8b58ae 100644 --- a/task/clean.go +++ b/task/clean.go @@ -1,7 +1,7 @@ package task import ( - "pcgamedb/db" + "github.com/nitezs/pcgamedb/db" "go.uber.org/zap" ) diff --git a/task/crawl.go b/task/crawl.go index ca32dfb..1782bcd 100644 --- a/task/crawl.go +++ b/task/crawl.go @@ -3,10 +3,11 @@ package task import ( "net/http" "net/url" - "pcgamedb/config" - "pcgamedb/crawler" - "pcgamedb/model" - "pcgamedb/utils" + + "github.com/nitezs/pcgamedb/config" + "github.com/nitezs/pcgamedb/crawler" + "github.com/nitezs/pcgamedb/model" + "github.com/nitezs/pcgamedb/utils" "go.uber.org/zap" ) @@ -19,13 +20,13 @@ func Crawl(logger *zap.Logger) { if c, ok := item.(crawler.PagedCrawler); ok { g, err := c.CrawlMulti([]int{1, 2, 3}) if err != nil { - logger.Error("Failed to crawl games", zap.String("crawler", c.Name()), zap.Error(err)) + logger.Warn("Failed to crawl games", zap.String("crawler", c.Name()), zap.Error(err)) } games = append(games, g...) } else if c, ok := item.(crawler.SimpleCrawler); ok { g, err := c.CrawlAll() if err != nil { - logger.Error("Failed to crawl games", zap.String("crawler", c.Name()), zap.Error(err)) + logger.Warn("Failed to crawl games", zap.String("crawler", c.Name()), zap.Error(err)) } games = append(games, g...) }