diff --git a/cmd/web/wire.go b/cmd/web/wire.go index 0c68d33687..71c58776a1 100644 --- a/cmd/web/wire.go +++ b/cmd/web/wire.go @@ -3,13 +3,13 @@ package main import ( - "github.com/TheTNB/panel/internal/http/middleware" - "github.com/TheTNB/panel/internal/job" "github.com/google/wire" "github.com/TheTNB/panel/internal/app" "github.com/TheTNB/panel/internal/bootstrap" "github.com/TheTNB/panel/internal/data" + "github.com/TheTNB/panel/internal/http/middleware" + "github.com/TheTNB/panel/internal/job" "github.com/TheTNB/panel/internal/route" "github.com/TheTNB/panel/internal/service" ) diff --git a/internal/biz/database_server.go b/internal/biz/database_server.go index 5ceae4e3ae..f2105a9d9f 100644 --- a/internal/biz/database_server.go +++ b/internal/biz/database_server.go @@ -1,12 +1,12 @@ package biz import ( - "github.com/TheTNB/panel/internal/app" - "github.com/go-rat/utils/crypt" "time" + "github.com/go-rat/utils/crypt" "gorm.io/gorm" + "github.com/TheTNB/panel/internal/app" "github.com/TheTNB/panel/internal/http/request" ) diff --git a/internal/biz/database_user.go b/internal/biz/database_user.go index 7c6efb7a70..2bfb993371 100644 --- a/internal/biz/database_user.go +++ b/internal/biz/database_user.go @@ -1,12 +1,12 @@ package biz import ( - "github.com/TheTNB/panel/internal/app" - "github.com/go-rat/utils/crypt" "time" + "github.com/go-rat/utils/crypt" "gorm.io/gorm" + "github.com/TheTNB/panel/internal/app" "github.com/TheTNB/panel/internal/http/request" ) diff --git a/internal/biz/ssh.go b/internal/biz/ssh.go index 824f9faa0d..93a9ebec4a 100644 --- a/internal/biz/ssh.go +++ b/internal/biz/ssh.go @@ -1,12 +1,12 @@ package biz import ( - "github.com/TheTNB/panel/internal/app" - "github.com/go-rat/utils/crypt" "time" + "github.com/go-rat/utils/crypt" "gorm.io/gorm" + "github.com/TheTNB/panel/internal/app" "github.com/TheTNB/panel/internal/http/request" "github.com/TheTNB/panel/pkg/ssh" ) diff --git a/internal/bootstrap/cron.go b/internal/bootstrap/cron.go index 8cef2f9519..7dfebd0014 100644 --- a/internal/bootstrap/cron.go +++ b/internal/bootstrap/cron.go @@ -1,12 +1,12 @@ package bootstrap import ( - "github.com/TheTNB/panel/internal/job" "log/slog" "github.com/knadh/koanf/v2" "github.com/robfig/cron/v3" + "github.com/TheTNB/panel/internal/job" pkgcron "github.com/TheTNB/panel/pkg/cron" ) diff --git a/internal/bootstrap/db.go b/internal/bootstrap/db.go index 0f5faacb97..86bf0d7a67 100644 --- a/internal/bootstrap/db.go +++ b/internal/bootstrap/db.go @@ -1,12 +1,12 @@ package bootstrap import ( - "github.com/knadh/koanf/v2" "log/slog" "path/filepath" "github.com/glebarez/sqlite" "github.com/go-gormigrate/gormigrate/v2" + "github.com/knadh/koanf/v2" slogGorm "github.com/orandin/slog-gorm" "gorm.io/gorm" diff --git a/internal/bootstrap/http.go b/internal/bootstrap/http.go index 80048956de..225dc991e4 100644 --- a/internal/bootstrap/http.go +++ b/internal/bootstrap/http.go @@ -2,13 +2,14 @@ package bootstrap import ( "crypto/tls" + "log/slog" + "net/http" + "github.com/bddjr/hlfhr" "github.com/go-chi/chi/v5" "github.com/go-rat/sessions" "github.com/knadh/koanf/v2" "gorm.io/gorm" - "log/slog" - "net/http" "github.com/TheTNB/panel/internal/http/middleware" "github.com/TheTNB/panel/internal/route" diff --git a/internal/bootstrap/logger.go b/internal/bootstrap/logger.go index 987808396f..5f8154cd3c 100644 --- a/internal/bootstrap/logger.go +++ b/internal/bootstrap/logger.go @@ -1,12 +1,13 @@ package bootstrap import ( - "github.com/knadh/koanf/v2" "log/slog" "path/filepath" - "github.com/TheTNB/panel/internal/app" + "github.com/knadh/koanf/v2" "gopkg.in/natefinch/lumberjack.v2" + + "github.com/TheTNB/panel/internal/app" ) func NewLog(conf *koanf.Koanf) *slog.Logger { diff --git a/internal/data/app.go b/internal/data/app.go index 461d0f3a8e..efd7f72a1f 100644 --- a/internal/data/app.go +++ b/internal/data/app.go @@ -4,13 +4,13 @@ import ( "encoding/json" "errors" "fmt" - "gorm.io/gorm" "slices" "github.com/expr-lang/expr" "github.com/go-rat/utils/collect" "github.com/hashicorp/go-version" "github.com/spf13/cast" + "gorm.io/gorm" "github.com/TheTNB/panel/internal/app" "github.com/TheTNB/panel/internal/biz" diff --git a/internal/data/backup.go b/internal/data/backup.go index b0d5cb6df1..fb663d34f1 100644 --- a/internal/data/backup.go +++ b/internal/data/backup.go @@ -3,7 +3,6 @@ package data import ( "errors" "fmt" - "gorm.io/gorm" "os" "path/filepath" "slices" @@ -11,6 +10,7 @@ import ( "time" "github.com/shirou/gopsutil/disk" + "gorm.io/gorm" "github.com/TheTNB/panel/internal/app" "github.com/TheTNB/panel/internal/biz" diff --git a/internal/data/cert.go b/internal/data/cert.go index 946a45f997..22c2921aad 100644 --- a/internal/data/cert.go +++ b/internal/data/cert.go @@ -4,11 +4,12 @@ import ( "context" "errors" "fmt" - "gorm.io/gorm" "slices" "strings" "time" + "gorm.io/gorm" + "github.com/TheTNB/panel/internal/app" "github.com/TheTNB/panel/internal/biz" "github.com/TheTNB/panel/internal/http/request" diff --git a/internal/data/cert_account.go b/internal/data/cert_account.go index 83ae4bb76d..227e647c61 100644 --- a/internal/data/cert_account.go +++ b/internal/data/cert_account.go @@ -4,14 +4,15 @@ import ( "context" "errors" "fmt" - "gorm.io/gorm" "time" + "github.com/go-resty/resty/v2" + "gorm.io/gorm" + "github.com/TheTNB/panel/internal/biz" "github.com/TheTNB/panel/internal/http/request" "github.com/TheTNB/panel/pkg/acme" "github.com/TheTNB/panel/pkg/cert" - "github.com/go-resty/resty/v2" ) type certAccountRepo struct { diff --git a/internal/data/container.go b/internal/data/container.go index 320a11870b..450e9a14d8 100644 --- a/internal/data/container.go +++ b/internal/data/container.go @@ -6,12 +6,13 @@ import ( "strings" "time" + "github.com/go-resty/resty/v2" + "github.com/TheTNB/panel/internal/biz" "github.com/TheTNB/panel/internal/http/request" "github.com/TheTNB/panel/pkg/shell" "github.com/TheTNB/panel/pkg/types" "github.com/TheTNB/panel/pkg/types/docker/container" - "github.com/go-resty/resty/v2" ) type containerRepo struct { diff --git a/internal/data/container_image.go b/internal/data/container_image.go index 959eea47e2..2d935188bd 100644 --- a/internal/data/container_image.go +++ b/internal/data/container_image.go @@ -6,13 +6,14 @@ import ( "strings" "time" + "github.com/go-resty/resty/v2" + "github.com/TheTNB/panel/internal/biz" "github.com/TheTNB/panel/internal/http/request" "github.com/TheTNB/panel/pkg/shell" "github.com/TheTNB/panel/pkg/tools" "github.com/TheTNB/panel/pkg/types" "github.com/TheTNB/panel/pkg/types/docker/image" - "github.com/go-resty/resty/v2" ) type containerImageRepo struct { diff --git a/internal/data/container_network.go b/internal/data/container_network.go index f6f7057d0a..5040f395ab 100644 --- a/internal/data/container_network.go +++ b/internal/data/container_network.go @@ -6,12 +6,13 @@ import ( "strings" "time" + "github.com/go-resty/resty/v2" + "github.com/TheTNB/panel/internal/biz" "github.com/TheTNB/panel/internal/http/request" "github.com/TheTNB/panel/pkg/shell" "github.com/TheTNB/panel/pkg/types" "github.com/TheTNB/panel/pkg/types/docker/network" - "github.com/go-resty/resty/v2" ) type containerNetworkRepo struct { diff --git a/internal/data/container_volume.go b/internal/data/container_volume.go index 7084d0daf7..8579280b81 100644 --- a/internal/data/container_volume.go +++ b/internal/data/container_volume.go @@ -6,13 +6,14 @@ import ( "strings" "time" + "github.com/go-resty/resty/v2" + "github.com/TheTNB/panel/internal/biz" "github.com/TheTNB/panel/internal/http/request" "github.com/TheTNB/panel/pkg/shell" "github.com/TheTNB/panel/pkg/tools" "github.com/TheTNB/panel/pkg/types" "github.com/TheTNB/panel/pkg/types/docker/volume" - "github.com/go-resty/resty/v2" ) type containerVolumeRepo struct { diff --git a/internal/data/cron.go b/internal/data/cron.go index c54068aec4..05f8477d67 100644 --- a/internal/data/cron.go +++ b/internal/data/cron.go @@ -3,11 +3,13 @@ package data import ( "errors" "fmt" - "gorm.io/gorm" "path/filepath" "strconv" "time" + "github.com/go-rat/utils/str" + "gorm.io/gorm" + "github.com/TheTNB/panel/internal/app" "github.com/TheTNB/panel/internal/biz" "github.com/TheTNB/panel/internal/http/request" @@ -15,7 +17,6 @@ import ( "github.com/TheTNB/panel/pkg/os" "github.com/TheTNB/panel/pkg/shell" "github.com/TheTNB/panel/pkg/systemctl" - "github.com/go-rat/utils/str" ) type cronRepo struct { diff --git a/internal/data/database_server.go b/internal/data/database_server.go index c183bb66ff..16b644112b 100644 --- a/internal/data/database_server.go +++ b/internal/data/database_server.go @@ -2,11 +2,12 @@ package data import ( "fmt" - "github.com/TheTNB/panel/internal/app" - "gorm.io/gorm" "log/slog" "slices" + "gorm.io/gorm" + + "github.com/TheTNB/panel/internal/app" "github.com/TheTNB/panel/internal/biz" "github.com/TheTNB/panel/internal/http/request" "github.com/TheTNB/panel/pkg/db" diff --git a/internal/data/monitor.go b/internal/data/monitor.go index 1410c3a2e7..abbb2205a6 100644 --- a/internal/data/monitor.go +++ b/internal/data/monitor.go @@ -2,10 +2,10 @@ package data import ( "errors" - "gorm.io/gorm" "time" "github.com/spf13/cast" + "gorm.io/gorm" "github.com/TheTNB/panel/internal/app" "github.com/TheTNB/panel/internal/biz" diff --git a/internal/data/safe.go b/internal/data/safe.go index ba4f5a21e3..debdbe056b 100644 --- a/internal/data/safe.go +++ b/internal/data/safe.go @@ -2,13 +2,13 @@ package data import ( "fmt" - "github.com/TheTNB/panel/pkg/os" "strings" "github.com/spf13/cast" "github.com/TheTNB/panel/internal/biz" "github.com/TheTNB/panel/pkg/firewall" + "github.com/TheTNB/panel/pkg/os" "github.com/TheTNB/panel/pkg/shell" "github.com/TheTNB/panel/pkg/systemctl" ) diff --git a/internal/data/setting.go b/internal/data/setting.go index 533999ef70..31489b1199 100644 --- a/internal/data/setting.go +++ b/internal/data/setting.go @@ -4,12 +4,13 @@ import ( "context" "errors" "fmt" + "path/filepath" + "github.com/go-rat/utils/hash" "github.com/knadh/koanf/v2" "github.com/spf13/cast" "gopkg.in/yaml.v3" "gorm.io/gorm" - "path/filepath" "github.com/TheTNB/panel/internal/app" "github.com/TheTNB/panel/internal/biz" diff --git a/internal/data/ssh.go b/internal/data/ssh.go index d0792b55d1..44fc2f4192 100644 --- a/internal/data/ssh.go +++ b/internal/data/ssh.go @@ -2,6 +2,7 @@ package data import ( "fmt" + "gorm.io/gorm" "github.com/TheTNB/panel/internal/biz" diff --git a/internal/data/task.go b/internal/data/task.go index b45f3b5663..c3afcf0e78 100644 --- a/internal/data/task.go +++ b/internal/data/task.go @@ -2,13 +2,14 @@ package data import ( "fmt" - "github.com/TheTNB/panel/pkg/queue" - "gorm.io/gorm" "log/slog" + "gorm.io/gorm" + "github.com/TheTNB/panel/internal/app" "github.com/TheTNB/panel/internal/biz" "github.com/TheTNB/panel/internal/queuejob" + "github.com/TheTNB/panel/pkg/queue" ) type taskRepo struct { diff --git a/internal/data/website.go b/internal/data/website.go index 6b7853f666..0e42277db1 100644 --- a/internal/data/website.go +++ b/internal/data/website.go @@ -5,7 +5,6 @@ import ( "encoding/json" "errors" "fmt" - "gorm.io/gorm" "path/filepath" "slices" "strings" @@ -13,6 +12,7 @@ import ( "github.com/samber/lo" "github.com/spf13/cast" + "gorm.io/gorm" "github.com/TheTNB/panel/internal/app" "github.com/TheTNB/panel/internal/biz" diff --git a/internal/http/middleware/entrance.go b/internal/http/middleware/entrance.go index 110a087630..d8792c3fa6 100644 --- a/internal/http/middleware/entrance.go +++ b/internal/http/middleware/entrance.go @@ -1,12 +1,12 @@ package middleware import ( - "github.com/go-rat/sessions" - "github.com/knadh/koanf/v2" "net/http" "strings" "github.com/go-rat/chix" + "github.com/go-rat/sessions" + "github.com/knadh/koanf/v2" "github.com/spf13/cast" ) diff --git a/internal/http/middleware/middleware.go b/internal/http/middleware/middleware.go index 6abd23a64a..198d85ca25 100644 --- a/internal/http/middleware/middleware.go +++ b/internal/http/middleware/middleware.go @@ -1,17 +1,18 @@ package middleware import ( - "github.com/TheTNB/panel/internal/biz" - "github.com/go-chi/chi/v5" - "github.com/go-rat/sessions" - "github.com/google/wire" - "github.com/knadh/koanf/v2" "log/slog" "net/http" + "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" + "github.com/go-rat/sessions" sessionmiddleware "github.com/go-rat/sessions/middleware" "github.com/golang-cz/httplog" + "github.com/google/wire" + "github.com/knadh/koanf/v2" + + "github.com/TheTNB/panel/internal/biz" ) var ProviderSet = wire.NewSet(NewMiddlewares) diff --git a/internal/http/middleware/must_install.go b/internal/http/middleware/must_install.go index c873d1cb42..a947fc3dd3 100644 --- a/internal/http/middleware/must_install.go +++ b/internal/http/middleware/must_install.go @@ -2,11 +2,12 @@ package middleware import ( "fmt" - "github.com/TheTNB/panel/internal/biz" "net/http" "strings" "github.com/go-rat/chix" + + "github.com/TheTNB/panel/internal/biz" ) // MustInstall 确保已安装应用 @@ -33,7 +34,7 @@ func MustInstall(app biz.AppRepo) func(next http.Handler) http.Handler { flag := false for _, s := range slugs { - if installed, _ := app.IsInstalled("slug = ?", s); installed { // TODO 优化实现 + if installed, _ := app.IsInstalled("slug = ?", s); installed { flag = true break } diff --git a/internal/http/middleware/must_login.go b/internal/http/middleware/must_login.go index 02e6425782..8c02b27681 100644 --- a/internal/http/middleware/must_login.go +++ b/internal/http/middleware/must_login.go @@ -4,13 +4,13 @@ import ( "context" "crypto/sha256" "fmt" - "github.com/go-rat/sessions" "net" "net/http" "slices" "strings" "github.com/go-rat/chix" + "github.com/go-rat/sessions" "github.com/spf13/cast" ) diff --git a/internal/job/cert_renew.go b/internal/job/cert_renew.go index 21c9dacd0b..43185f9910 100644 --- a/internal/job/cert_renew.go +++ b/internal/job/cert_renew.go @@ -1,10 +1,11 @@ package job import ( - "gorm.io/gorm" "log/slog" "time" + "gorm.io/gorm" + "github.com/TheTNB/panel/internal/app" "github.com/TheTNB/panel/internal/biz" pkgcert "github.com/TheTNB/panel/pkg/cert" diff --git a/internal/job/job.go b/internal/job/job.go index 914020508b..64b924c08a 100644 --- a/internal/job/job.go +++ b/internal/job/job.go @@ -1,11 +1,13 @@ package job import ( - "github.com/TheTNB/panel/internal/biz" + "log/slog" + "github.com/google/wire" "github.com/robfig/cron/v3" "gorm.io/gorm" - "log/slog" + + "github.com/TheTNB/panel/internal/biz" ) var ProviderSet = wire.NewSet(NewJobs) diff --git a/internal/job/monitoring.go b/internal/job/monitoring.go index 5e8e7b3bb3..98c3a4058c 100644 --- a/internal/job/monitoring.go +++ b/internal/job/monitoring.go @@ -1,11 +1,11 @@ package job import ( - "gorm.io/gorm" "log/slog" "time" "github.com/spf13/cast" + "gorm.io/gorm" "github.com/TheTNB/panel/internal/app" "github.com/TheTNB/panel/internal/biz" diff --git a/internal/job/panel_task.go b/internal/job/panel_task.go index 00213390e8..4dd5a642d4 100644 --- a/internal/job/panel_task.go +++ b/internal/job/panel_task.go @@ -1,13 +1,14 @@ package job import ( - "gorm.io/gorm" "log/slog" "math/rand/v2" "runtime" "runtime/debug" "time" + "gorm.io/gorm" + "github.com/TheTNB/panel/internal/app" "github.com/TheTNB/panel/internal/biz" ) diff --git a/internal/service/cli.go b/internal/service/cli.go index 4557538e38..f71f1768c6 100644 --- a/internal/service/cli.go +++ b/internal/service/cli.go @@ -4,13 +4,13 @@ import ( "context" "errors" "fmt" - "github.com/knadh/koanf/v2" "path/filepath" "time" "github.com/go-rat/utils/collect" "github.com/go-rat/utils/hash" "github.com/go-rat/utils/str" + "github.com/knadh/koanf/v2" "github.com/spf13/cast" "github.com/urfave/cli/v3" "gopkg.in/yaml.v3" diff --git a/internal/service/dashboard.go b/internal/service/dashboard.go index a6bc5660a9..184323a480 100644 --- a/internal/service/dashboard.go +++ b/internal/service/dashboard.go @@ -2,7 +2,6 @@ package service import ( "fmt" - "github.com/knadh/koanf/v2" "net" "net/http" "regexp" @@ -11,6 +10,7 @@ import ( "github.com/go-rat/chix" "github.com/go-rat/utils/collect" "github.com/hashicorp/go-version" + "github.com/knadh/koanf/v2" "github.com/shirou/gopsutil/disk" "github.com/shirou/gopsutil/host" "github.com/spf13/cast" diff --git a/internal/service/user.go b/internal/service/user.go index 29020ecfd2..91bee6e8c8 100644 --- a/internal/service/user.go +++ b/internal/service/user.go @@ -4,13 +4,13 @@ import ( "crypto/rsa" "encoding/gob" "fmt" - "github.com/go-rat/sessions" - "github.com/knadh/koanf/v2" "net" "net/http" "strings" "github.com/go-rat/chix" + "github.com/go-rat/sessions" + "github.com/knadh/koanf/v2" "github.com/spf13/cast" "golang.org/x/crypto/sha3" diff --git a/internal/service/ws.go b/internal/service/ws.go index de5e8785a6..e1783f67d0 100644 --- a/internal/service/ws.go +++ b/internal/service/ws.go @@ -3,11 +3,11 @@ package service import ( "bufio" "context" - "github.com/knadh/koanf/v2" "net/http" "sync" "github.com/gorilla/websocket" + "github.com/knadh/koanf/v2" "github.com/TheTNB/panel/internal/biz" "github.com/TheTNB/panel/internal/http/request" diff --git a/pkg/tools/logger.go b/pkg/tools/logger.go index 4c0efffe0f..89d4a09540 100644 --- a/pkg/tools/logger.go +++ b/pkg/tools/logger.go @@ -4,5 +4,7 @@ package tools type NoopLogger struct{} func (NoopLogger) Errorf(format string, v ...any) {} -func (NoopLogger) Warnf(format string, v ...any) {} + +func (NoopLogger) Warnf(format string, v ...any) {} + func (NoopLogger) Debugf(format string, v ...any) {}