From 0e715a75763174f8acd9e2c0367d91be9775e0f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Sat, 13 Jul 2024 15:19:42 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=A7=84=E8=8C=83go=20module?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/console/commands/cert_renew.go | 8 +-- app/console/commands/monitoring.go | 8 +-- app/console/commands/panel.go | 18 +++---- app/console/commands/panel_task.go | 6 +-- app/console/kernel.go | 2 +- app/http/controllers/cert_controller.go | 12 ++--- app/http/controllers/container_controller.go | 6 +-- app/http/controllers/controller.go | 2 +- app/http/controllers/cron_controller.go | 12 ++--- app/http/controllers/file_controller.go | 10 ++-- app/http/controllers/info_controller.go | 14 ++--- app/http/controllers/monitor_controller.go | 6 +-- app/http/controllers/plugin_controller.go | 6 +-- .../plugins/fail2ban_controller.go | 18 +++---- .../controllers/plugins/frp_controller.go | 8 +-- .../controllers/plugins/gitea_controller.go | 8 +-- .../controllers/plugins/mysql_controller.go | 20 +++---- .../plugins/openresty_controller.go | 12 ++--- .../controllers/plugins/php_controller.go | 4 +- .../plugins/phpmyadmin_controller.go | 10 ++-- .../controllers/plugins/podman_controller.go | 8 +-- .../plugins/postgresql_controller.go | 16 +++--- .../plugins/pureftpd_controller.go | 12 ++--- .../controllers/plugins/redis_controller.go | 10 ++-- .../controllers/plugins/rsync_controller.go | 14 ++--- .../controllers/plugins/s3fs_controller.go | 12 ++--- .../plugins/supervisor_controller.go | 10 ++-- .../controllers/plugins/toolbox_controller.go | 8 +-- app/http/controllers/safe_controller.go | 8 +-- app/http/controllers/setting_controller.go | 18 +++---- app/http/controllers/ssh_controller.go | 8 +-- app/http/controllers/swagger_controller.go | 2 +- app/http/controllers/system_controller.go | 2 +- app/http/controllers/task_controller.go | 4 +- app/http/controllers/user_controller.go | 4 +- app/http/controllers/website_controller.go | 18 +++---- app/http/kernel.go | 2 +- app/http/middleware/must_install.go | 2 +- app/http/middleware/static.go | 2 +- app/http/middleware/status.go | 2 +- app/http/requests/cert/dns_store.go | 2 +- app/http/requests/cert/dns_update.go | 2 +- .../requests/container/container_create.go | 2 +- .../requests/container/container_update.go | 2 +- app/http/requests/container/network_create.go | 2 +- app/http/requests/container/volume_create.go | 2 +- app/jobs/process_task.go | 4 +- app/models/cert_dns.go | 2 +- app/models/monitor.go | 2 +- app/providers/console_service_provider.go | 2 +- app/providers/database_service_provider.go | 2 +- app/providers/queue_service_provider.go | 2 +- app/providers/route_service_provider.go | 4 +- app/providers/validation_service_provider.go | 2 +- app/rules/path_exist.go | 2 +- app/rules/path_not_exist.go | 2 +- bootstrap/app.go | 2 +- config/app.go | 2 +- config/panel.go | 2 +- go.mod | 2 +- internal/backup.go | 4 +- internal/cert.go | 6 +-- internal/container.go | 4 +- internal/cron.go | 2 +- internal/php.go | 2 +- internal/plugin.go | 4 +- internal/services/backup.go | 12 ++--- internal/services/cert.go | 14 ++--- internal/services/container.go | 4 +- internal/services/cron.go | 8 +-- internal/services/php.go | 10 ++-- internal/services/plugin.go | 8 +-- internal/services/setting.go | 4 +- internal/services/task.go | 4 +- internal/services/user.go | 2 +- internal/services/website.go | 22 ++++---- internal/user.go | 2 +- internal/website.go | 6 +-- main.go | 2 +- pkg/acme/acme.go | 2 +- pkg/acme/client.go | 2 +- pkg/acme/solvers.go | 4 +- pkg/db/mysql.go | 2 +- pkg/db/mysql_tools.go | 4 +- pkg/db/postgres.go | 8 +-- pkg/migrate/migrations.go | 2 +- pkg/plugins/loader.go | 52 +++++++++++++++++++ pkg/shell/exec.go | 2 +- pkg/ssh/ssh.go | 2 +- pkg/systemctl/service.go | 2 +- pkg/tools/tools.go | 4 +- routes/api.go | 6 +-- routes/plugin.go | 4 +- tests/setting/setting_test.go | 6 +-- tests/test_case.go | 2 +- tests/user/user_test.go | 8 +-- 96 files changed, 340 insertions(+), 288 deletions(-) create mode 100644 pkg/plugins/loader.go diff --git a/app/console/commands/cert_renew.go b/app/console/commands/cert_renew.go index d41cb2f256..a8fce5eea3 100644 --- a/app/console/commands/cert_renew.go +++ b/app/console/commands/cert_renew.go @@ -8,10 +8,10 @@ import ( "github.com/goravel/framework/facades" "github.com/goravel/framework/support/carbon" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal/services" - panelcert "github.com/TheTNB/panel/pkg/cert" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal/services" + panelcert "github.com/TheTNB/panel/v2/pkg/cert" + "github.com/TheTNB/panel/v2/pkg/types" ) // CertRenew 证书续签 diff --git a/app/console/commands/monitoring.go b/app/console/commands/monitoring.go index 3c419fe95f..59a24494d0 100644 --- a/app/console/commands/monitoring.go +++ b/app/console/commands/monitoring.go @@ -10,10 +10,10 @@ import ( "github.com/goravel/framework/support/color" "github.com/spf13/cast" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal/services" - "github.com/TheTNB/panel/pkg/tools" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal/services" + "github.com/TheTNB/panel/v2/pkg/tools" + "github.com/TheTNB/panel/v2/pkg/types" ) // Monitoring 系统监控 diff --git a/app/console/commands/panel.go b/app/console/commands/panel.go index 0167aba759..0acb6c401c 100644 --- a/app/console/commands/panel.go +++ b/app/console/commands/panel.go @@ -15,15 +15,15 @@ import ( "github.com/goravel/framework/support/color" "github.com/spf13/cast" - requests "github.com/TheTNB/panel/app/http/requests/website" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal/services" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/str" - "github.com/TheTNB/panel/pkg/systemctl" - "github.com/TheTNB/panel/pkg/tools" - "github.com/TheTNB/panel/pkg/types" + requests "github.com/TheTNB/panel/v2/app/http/requests/website" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal/services" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/str" + "github.com/TheTNB/panel/v2/pkg/systemctl" + "github.com/TheTNB/panel/v2/pkg/tools" + "github.com/TheTNB/panel/v2/pkg/types" ) // Panel 面板命令行 diff --git a/app/console/commands/panel_task.go b/app/console/commands/panel_task.go index 60ac420038..f055ccc6bd 100644 --- a/app/console/commands/panel_task.go +++ b/app/console/commands/panel_task.go @@ -10,9 +10,9 @@ import ( "github.com/goravel/framework/facades" "github.com/goravel/framework/support/carbon" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/types" ) // PanelTask 面板每日任务 diff --git a/app/console/kernel.go b/app/console/kernel.go index 7ae699968b..42d977ee3e 100644 --- a/app/console/kernel.go +++ b/app/console/kernel.go @@ -5,7 +5,7 @@ import ( "github.com/goravel/framework/contracts/schedule" "github.com/goravel/framework/facades" - "github.com/TheTNB/panel/app/console/commands" + "github.com/TheTNB/panel/v2/app/console/commands" ) type Kernel struct { diff --git a/app/http/controllers/cert_controller.go b/app/http/controllers/cert_controller.go index 374f481141..4beffd6ffb 100644 --- a/app/http/controllers/cert_controller.go +++ b/app/http/controllers/cert_controller.go @@ -4,12 +4,12 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/facades" - requests "github.com/TheTNB/panel/app/http/requests/cert" - commonrequests "github.com/TheTNB/panel/app/http/requests/common" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/internal/services" - "github.com/TheTNB/panel/pkg/acme" + requests "github.com/TheTNB/panel/v2/app/http/requests/cert" + commonrequests "github.com/TheTNB/panel/v2/app/http/requests/common" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/internal/services" + "github.com/TheTNB/panel/v2/pkg/acme" ) type CertController struct { diff --git a/app/http/controllers/container_controller.go b/app/http/controllers/container_controller.go index 214d089e01..6e48c4a169 100644 --- a/app/http/controllers/container_controller.go +++ b/app/http/controllers/container_controller.go @@ -11,9 +11,9 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/support/carbon" - requests "github.com/TheTNB/panel/app/http/requests/container" - "github.com/TheTNB/panel/internal/services" - "github.com/TheTNB/panel/pkg/str" + requests "github.com/TheTNB/panel/v2/app/http/requests/container" + "github.com/TheTNB/panel/v2/internal/services" + "github.com/TheTNB/panel/v2/pkg/str" ) type ContainerController struct { diff --git a/app/http/controllers/controller.go b/app/http/controllers/controller.go index 496fe62e4c..e8d973fae0 100644 --- a/app/http/controllers/controller.go +++ b/app/http/controllers/controller.go @@ -4,7 +4,7 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/facades" - commonrequests "github.com/TheTNB/panel/app/http/requests/common" + commonrequests "github.com/TheTNB/panel/v2/app/http/requests/common" ) // SuccessResponse 通用成功响应 diff --git a/app/http/controllers/cron_controller.go b/app/http/controllers/cron_controller.go index 906c19f25a..b235b0cef0 100644 --- a/app/http/controllers/cron_controller.go +++ b/app/http/controllers/cron_controller.go @@ -9,12 +9,12 @@ import ( "github.com/goravel/framework/support/carbon" "github.com/spf13/cast" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/internal/services" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/str" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/internal/services" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/str" ) type CronController struct { diff --git a/app/http/controllers/file_controller.go b/app/http/controllers/file_controller.go index 14df0eae6d..3e811e4d35 100644 --- a/app/http/controllers/file_controller.go +++ b/app/http/controllers/file_controller.go @@ -12,11 +12,11 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/support/carbon" - requests "github.com/TheTNB/panel/app/http/requests/file" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/os" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/str" + requests "github.com/TheTNB/panel/v2/app/http/requests/file" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/os" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/str" ) type FileController struct { diff --git a/app/http/controllers/info_controller.go b/app/http/controllers/info_controller.go index 077d93025a..2c0209103a 100644 --- a/app/http/controllers/info_controller.go +++ b/app/http/controllers/info_controller.go @@ -10,13 +10,13 @@ import ( "github.com/goravel/framework/facades" "github.com/hashicorp/go-version" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/internal/services" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/systemctl" - "github.com/TheTNB/panel/pkg/tools" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/internal/services" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/systemctl" + "github.com/TheTNB/panel/v2/pkg/tools" + "github.com/TheTNB/panel/v2/pkg/types" ) type MenuItem struct { diff --git a/app/http/controllers/monitor_controller.go b/app/http/controllers/monitor_controller.go index 84c9bb8e7a..1c2565b049 100644 --- a/app/http/controllers/monitor_controller.go +++ b/app/http/controllers/monitor_controller.go @@ -8,9 +8,9 @@ import ( "github.com/goravel/framework/support/carbon" "github.com/spf13/cast" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/internal/services" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/internal/services" ) type MonitorController struct { diff --git a/app/http/controllers/plugin_controller.go b/app/http/controllers/plugin_controller.go index 7dd0562907..c1ef9dcad9 100644 --- a/app/http/controllers/plugin_controller.go +++ b/app/http/controllers/plugin_controller.go @@ -4,9 +4,9 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/facades" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/internal/services" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/internal/services" ) type PluginController struct { diff --git a/app/http/controllers/plugins/fail2ban_controller.go b/app/http/controllers/plugins/fail2ban_controller.go index 0f1b339def..b0e5e531e2 100644 --- a/app/http/controllers/plugins/fail2ban_controller.go +++ b/app/http/controllers/plugins/fail2ban_controller.go @@ -8,15 +8,15 @@ import ( "github.com/goravel/framework/facades" "github.com/spf13/cast" - "github.com/TheTNB/panel/app/http/controllers" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/internal/services" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/os" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/str" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/app/http/controllers" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/internal/services" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/os" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/str" + "github.com/TheTNB/panel/v2/pkg/types" ) type Fail2banController struct { diff --git a/app/http/controllers/plugins/frp_controller.go b/app/http/controllers/plugins/frp_controller.go index 31c27e39d8..fc93745910 100644 --- a/app/http/controllers/plugins/frp_controller.go +++ b/app/http/controllers/plugins/frp_controller.go @@ -5,10 +5,10 @@ import ( "github.com/goravel/framework/contracts/http" - "github.com/TheTNB/panel/app/http/controllers" - requests "github.com/TheTNB/panel/app/http/requests/plugins/frp" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/systemctl" + "github.com/TheTNB/panel/v2/app/http/controllers" + requests "github.com/TheTNB/panel/v2/app/http/requests/plugins/frp" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/systemctl" ) type FrpController struct { diff --git a/app/http/controllers/plugins/gitea_controller.go b/app/http/controllers/plugins/gitea_controller.go index b77c2a1c22..18070a55ea 100644 --- a/app/http/controllers/plugins/gitea_controller.go +++ b/app/http/controllers/plugins/gitea_controller.go @@ -3,10 +3,10 @@ package plugins import ( "github.com/goravel/framework/contracts/http" - "github.com/TheTNB/panel/app/http/controllers" - requests "github.com/TheTNB/panel/app/http/requests/plugins/gitea" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/systemctl" + "github.com/TheTNB/panel/v2/app/http/controllers" + requests "github.com/TheTNB/panel/v2/app/http/requests/plugins/gitea" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/systemctl" ) type GiteaController struct { diff --git a/app/http/controllers/plugins/mysql_controller.go b/app/http/controllers/plugins/mysql_controller.go index 451e77b140..4daeeb8fa4 100644 --- a/app/http/controllers/plugins/mysql_controller.go +++ b/app/http/controllers/plugins/mysql_controller.go @@ -7,16 +7,16 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/spf13/cast" - "github.com/TheTNB/panel/app/http/controllers" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/internal/services" - "github.com/TheTNB/panel/pkg/db" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/str" - "github.com/TheTNB/panel/pkg/systemctl" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/app/http/controllers" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/internal/services" + "github.com/TheTNB/panel/v2/pkg/db" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/str" + "github.com/TheTNB/panel/v2/pkg/systemctl" + "github.com/TheTNB/panel/v2/pkg/types" ) type MySQLController struct { diff --git a/app/http/controllers/plugins/openresty_controller.go b/app/http/controllers/plugins/openresty_controller.go index 5ddc6db441..c8301f9eaf 100644 --- a/app/http/controllers/plugins/openresty_controller.go +++ b/app/http/controllers/plugins/openresty_controller.go @@ -9,12 +9,12 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/spf13/cast" - "github.com/TheTNB/panel/app/http/controllers" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/str" - "github.com/TheTNB/panel/pkg/systemctl" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/app/http/controllers" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/str" + "github.com/TheTNB/panel/v2/pkg/systemctl" + "github.com/TheTNB/panel/v2/pkg/types" ) type OpenRestyController struct { diff --git a/app/http/controllers/plugins/php_controller.go b/app/http/controllers/plugins/php_controller.go index 247051b961..82cb6b7830 100644 --- a/app/http/controllers/plugins/php_controller.go +++ b/app/http/controllers/plugins/php_controller.go @@ -3,8 +3,8 @@ package plugins import ( "github.com/goravel/framework/contracts/http" - "github.com/TheTNB/panel/app/http/controllers" - "github.com/TheTNB/panel/internal/services" + "github.com/TheTNB/panel/v2/app/http/controllers" + "github.com/TheTNB/panel/v2/internal/services" ) type PHPController struct{} diff --git a/app/http/controllers/plugins/phpmyadmin_controller.go b/app/http/controllers/plugins/phpmyadmin_controller.go index 5c48f70f6c..e777b1a8cc 100644 --- a/app/http/controllers/plugins/phpmyadmin_controller.go +++ b/app/http/controllers/plugins/phpmyadmin_controller.go @@ -9,11 +9,11 @@ import ( "github.com/goravel/framework/facades" "github.com/spf13/cast" - "github.com/TheTNB/panel/app/http/controllers" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/os" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/systemctl" + "github.com/TheTNB/panel/v2/app/http/controllers" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/os" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/systemctl" ) type PhpMyAdminController struct { diff --git a/app/http/controllers/plugins/podman_controller.go b/app/http/controllers/plugins/podman_controller.go index f287d20299..0d13067128 100644 --- a/app/http/controllers/plugins/podman_controller.go +++ b/app/http/controllers/plugins/podman_controller.go @@ -3,10 +3,10 @@ package plugins import ( "github.com/goravel/framework/contracts/http" - "github.com/TheTNB/panel/app/http/controllers" - requests "github.com/TheTNB/panel/app/http/requests/plugins/podman" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/systemctl" + "github.com/TheTNB/panel/v2/app/http/controllers" + requests "github.com/TheTNB/panel/v2/app/http/requests/plugins/podman" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/systemctl" ) type PodmanController struct { diff --git a/app/http/controllers/plugins/postgresql_controller.go b/app/http/controllers/plugins/postgresql_controller.go index 987fb829fa..f73eb7f05c 100644 --- a/app/http/controllers/plugins/postgresql_controller.go +++ b/app/http/controllers/plugins/postgresql_controller.go @@ -7,14 +7,14 @@ import ( "github.com/goravel/framework/support/carbon" _ "github.com/lib/pq" - "github.com/TheTNB/panel/app/http/controllers" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/internal/services" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/systemctl" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/app/http/controllers" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/internal/services" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/systemctl" + "github.com/TheTNB/panel/v2/pkg/types" ) type PostgreSQLController struct { diff --git a/app/http/controllers/plugins/pureftpd_controller.go b/app/http/controllers/plugins/pureftpd_controller.go index 542353c085..60a9ec2a6f 100644 --- a/app/http/controllers/plugins/pureftpd_controller.go +++ b/app/http/controllers/plugins/pureftpd_controller.go @@ -7,12 +7,12 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/spf13/cast" - "github.com/TheTNB/panel/app/http/controllers" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/os" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/systemctl" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/app/http/controllers" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/os" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/systemctl" + "github.com/TheTNB/panel/v2/pkg/types" ) type PureFtpdController struct { diff --git a/app/http/controllers/plugins/redis_controller.go b/app/http/controllers/plugins/redis_controller.go index fb43119caa..ecccf4a8c8 100644 --- a/app/http/controllers/plugins/redis_controller.go +++ b/app/http/controllers/plugins/redis_controller.go @@ -5,11 +5,11 @@ import ( "github.com/goravel/framework/contracts/http" - "github.com/TheTNB/panel/app/http/controllers" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/systemctl" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/app/http/controllers" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/systemctl" + "github.com/TheTNB/panel/v2/pkg/types" ) type RedisController struct { diff --git a/app/http/controllers/plugins/rsync_controller.go b/app/http/controllers/plugins/rsync_controller.go index 895f55ff18..fa16fa9896 100644 --- a/app/http/controllers/plugins/rsync_controller.go +++ b/app/http/controllers/plugins/rsync_controller.go @@ -6,13 +6,13 @@ import ( "github.com/goravel/framework/contracts/http" - "github.com/TheTNB/panel/app/http/controllers" - requests "github.com/TheTNB/panel/app/http/requests/plugins/rsync" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/str" - "github.com/TheTNB/panel/pkg/systemctl" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/app/http/controllers" + requests "github.com/TheTNB/panel/v2/app/http/requests/plugins/rsync" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/str" + "github.com/TheTNB/panel/v2/pkg/systemctl" + "github.com/TheTNB/panel/v2/pkg/types" ) type RsyncController struct { diff --git a/app/http/controllers/plugins/s3fs_controller.go b/app/http/controllers/plugins/s3fs_controller.go index 989408c940..2a06a9ec9e 100644 --- a/app/http/controllers/plugins/s3fs_controller.go +++ b/app/http/controllers/plugins/s3fs_controller.go @@ -8,12 +8,12 @@ import ( "github.com/goravel/framework/support/json" "github.com/spf13/cast" - "github.com/TheTNB/panel/app/http/controllers" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/internal/services" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/app/http/controllers" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/internal/services" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/types" ) type S3fsController struct { diff --git a/app/http/controllers/plugins/supervisor_controller.go b/app/http/controllers/plugins/supervisor_controller.go index 27ab7a200b..db030de50e 100644 --- a/app/http/controllers/plugins/supervisor_controller.go +++ b/app/http/controllers/plugins/supervisor_controller.go @@ -7,11 +7,11 @@ import ( "github.com/goravel/framework/contracts/http" - "github.com/TheTNB/panel/app/http/controllers" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/os" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/systemctl" + "github.com/TheTNB/panel/v2/app/http/controllers" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/os" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/systemctl" ) type SupervisorController struct { diff --git a/app/http/controllers/plugins/toolbox_controller.go b/app/http/controllers/plugins/toolbox_controller.go index 246438c57c..b724b5ed72 100644 --- a/app/http/controllers/plugins/toolbox_controller.go +++ b/app/http/controllers/plugins/toolbox_controller.go @@ -7,10 +7,10 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/spf13/cast" - "github.com/TheTNB/panel/app/http/controllers" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/str" + "github.com/TheTNB/panel/v2/app/http/controllers" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/str" ) type ToolBoxController struct { diff --git a/app/http/controllers/safe_controller.go b/app/http/controllers/safe_controller.go index d14751844e..818b22072b 100644 --- a/app/http/controllers/safe_controller.go +++ b/app/http/controllers/safe_controller.go @@ -7,10 +7,10 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/spf13/cast" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/os" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/systemctl" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/os" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/systemctl" ) type SafeController struct { diff --git a/app/http/controllers/setting_controller.go b/app/http/controllers/setting_controller.go index 3328962e78..b29461e63a 100644 --- a/app/http/controllers/setting_controller.go +++ b/app/http/controllers/setting_controller.go @@ -6,15 +6,15 @@ import ( "github.com/goravel/framework/support/path" "github.com/spf13/cast" - requests "github.com/TheTNB/panel/app/http/requests/setting" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/internal/services" - "github.com/TheTNB/panel/pkg/cert" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/os" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/tools" + requests "github.com/TheTNB/panel/v2/app/http/requests/setting" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/internal/services" + "github.com/TheTNB/panel/v2/pkg/cert" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/os" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/tools" ) type SettingController struct { diff --git a/app/http/controllers/ssh_controller.go b/app/http/controllers/ssh_controller.go index 0bc5a51ec0..7be31ff976 100644 --- a/app/http/controllers/ssh_controller.go +++ b/app/http/controllers/ssh_controller.go @@ -12,10 +12,10 @@ import ( "github.com/gorilla/websocket" "github.com/spf13/cast" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/internal/services" - "github.com/TheTNB/panel/pkg/ssh" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/internal/services" + "github.com/TheTNB/panel/v2/pkg/ssh" ) type SshController struct { diff --git a/app/http/controllers/swagger_controller.go b/app/http/controllers/swagger_controller.go index 8294fd521e..917ace38fb 100644 --- a/app/http/controllers/swagger_controller.go +++ b/app/http/controllers/swagger_controller.go @@ -4,7 +4,7 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/swaggo/http-swagger/v2" - _ "github.com/TheTNB/panel/docs" + _ "github.com/TheTNB/panel/v2/docs" ) type SwaggerController struct { diff --git a/app/http/controllers/system_controller.go b/app/http/controllers/system_controller.go index 3fa2d6bfbf..34596594e8 100644 --- a/app/http/controllers/system_controller.go +++ b/app/http/controllers/system_controller.go @@ -5,7 +5,7 @@ import ( "github.com/goravel/framework/contracts/http" - "github.com/TheTNB/panel/pkg/systemctl" + "github.com/TheTNB/panel/v2/pkg/systemctl" ) type SystemController struct { diff --git a/app/http/controllers/task_controller.go b/app/http/controllers/task_controller.go index e9d72ed338..c989b5988c 100644 --- a/app/http/controllers/task_controller.go +++ b/app/http/controllers/task_controller.go @@ -4,8 +4,8 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/facades" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/pkg/shell" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/pkg/shell" ) type TaskController struct { diff --git a/app/http/controllers/user_controller.go b/app/http/controllers/user_controller.go index 6e3865470e..219b7636d9 100644 --- a/app/http/controllers/user_controller.go +++ b/app/http/controllers/user_controller.go @@ -5,8 +5,8 @@ import ( "github.com/goravel/framework/facades" "github.com/spf13/cast" - "github.com/TheTNB/panel/app/http/requests/user" - "github.com/TheTNB/panel/app/models" + "github.com/TheTNB/panel/v2/app/http/requests/user" + "github.com/TheTNB/panel/v2/app/models" ) type UserController struct { diff --git a/app/http/controllers/website_controller.go b/app/http/controllers/website_controller.go index b0a1b1792e..e118bd34c6 100644 --- a/app/http/controllers/website_controller.go +++ b/app/http/controllers/website_controller.go @@ -8,15 +8,15 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/facades" - commonrequests "github.com/TheTNB/panel/app/http/requests/common" - requests "github.com/TheTNB/panel/app/http/requests/website" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/internal/services" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/str" - "github.com/TheTNB/panel/pkg/systemctl" + commonrequests "github.com/TheTNB/panel/v2/app/http/requests/common" + requests "github.com/TheTNB/panel/v2/app/http/requests/website" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/internal/services" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/str" + "github.com/TheTNB/panel/v2/pkg/systemctl" ) type WebsiteController struct { diff --git a/app/http/kernel.go b/app/http/kernel.go index e4c6468c94..8942e963f7 100644 --- a/app/http/kernel.go +++ b/app/http/kernel.go @@ -4,7 +4,7 @@ import ( "github.com/goravel/framework/contracts/http" sessionmiddleware "github.com/goravel/framework/session/middleware" - "github.com/TheTNB/panel/app/http/middleware" + "github.com/TheTNB/panel/v2/app/http/middleware" ) type Kernel struct { diff --git a/app/http/middleware/must_install.go b/app/http/middleware/must_install.go index cc6b94cd4d..6b4c566437 100644 --- a/app/http/middleware/must_install.go +++ b/app/http/middleware/must_install.go @@ -7,7 +7,7 @@ import ( "github.com/goravel/framework/contracts/translation" "github.com/goravel/framework/facades" - "github.com/TheTNB/panel/internal/services" + "github.com/TheTNB/panel/v2/internal/services" ) // MustInstall 确保已安装插件 diff --git a/app/http/middleware/static.go b/app/http/middleware/static.go index b8f588a3f2..2a92cfd8e9 100644 --- a/app/http/middleware/static.go +++ b/app/http/middleware/static.go @@ -5,7 +5,7 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/gin" - "github.com/TheTNB/panel/embed" + "github.com/TheTNB/panel/v2/embed" ) func Static() http.Middleware { diff --git a/app/http/middleware/status.go b/app/http/middleware/status.go index 37bd46a8a4..9f128fc734 100644 --- a/app/http/middleware/status.go +++ b/app/http/middleware/status.go @@ -4,7 +4,7 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/facades" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/pkg/types" ) // Status 检查程序状态 diff --git a/app/http/requests/cert/dns_store.go b/app/http/requests/cert/dns_store.go index 847423f5d0..6b2d0504c0 100644 --- a/app/http/requests/cert/dns_store.go +++ b/app/http/requests/cert/dns_store.go @@ -4,7 +4,7 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/contracts/validation" - "github.com/TheTNB/panel/pkg/acme" + "github.com/TheTNB/panel/v2/pkg/acme" ) type DNSStore struct { diff --git a/app/http/requests/cert/dns_update.go b/app/http/requests/cert/dns_update.go index 95286e5e57..06b5e44670 100644 --- a/app/http/requests/cert/dns_update.go +++ b/app/http/requests/cert/dns_update.go @@ -4,7 +4,7 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/contracts/validation" - "github.com/TheTNB/panel/pkg/acme" + "github.com/TheTNB/panel/v2/pkg/acme" ) type DNSUpdate struct { diff --git a/app/http/requests/container/container_create.go b/app/http/requests/container/container_create.go index dc75e0149a..6fb2caa995 100644 --- a/app/http/requests/container/container_create.go +++ b/app/http/requests/container/container_create.go @@ -4,7 +4,7 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/contracts/validation" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/pkg/types" ) type ContainerCreate struct { diff --git a/app/http/requests/container/container_update.go b/app/http/requests/container/container_update.go index 97908e432c..e7e3da9e00 100644 --- a/app/http/requests/container/container_update.go +++ b/app/http/requests/container/container_update.go @@ -4,7 +4,7 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/contracts/validation" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/pkg/types" ) type ContainerUpdate struct { diff --git a/app/http/requests/container/network_create.go b/app/http/requests/container/network_create.go index 76165be1db..8f63fa9b2c 100644 --- a/app/http/requests/container/network_create.go +++ b/app/http/requests/container/network_create.go @@ -4,7 +4,7 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/contracts/validation" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/pkg/types" ) type NetworkCreate struct { diff --git a/app/http/requests/container/volume_create.go b/app/http/requests/container/volume_create.go index 793eaa4dc1..244c022ac1 100644 --- a/app/http/requests/container/volume_create.go +++ b/app/http/requests/container/volume_create.go @@ -4,7 +4,7 @@ import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/contracts/validation" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/pkg/types" ) type VolumeCreate struct { diff --git a/app/jobs/process_task.go b/app/jobs/process_task.go index 2d5bf15d53..41d273cc3b 100644 --- a/app/jobs/process_task.go +++ b/app/jobs/process_task.go @@ -3,8 +3,8 @@ package jobs import ( "github.com/goravel/framework/facades" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/pkg/shell" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/pkg/shell" ) // ProcessTask 处理面板任务 diff --git a/app/models/cert_dns.go b/app/models/cert_dns.go index df85cb1bac..014d33f2a7 100644 --- a/app/models/cert_dns.go +++ b/app/models/cert_dns.go @@ -3,7 +3,7 @@ package models import ( "github.com/goravel/framework/database/orm" - "github.com/TheTNB/panel/pkg/acme" + "github.com/TheTNB/panel/v2/pkg/acme" ) type CertDNS struct { diff --git a/app/models/monitor.go b/app/models/monitor.go index 2691afc60b..e8566083b3 100644 --- a/app/models/monitor.go +++ b/app/models/monitor.go @@ -3,7 +3,7 @@ package models import ( "github.com/goravel/framework/database/orm" - "github.com/TheTNB/panel/pkg/tools" + "github.com/TheTNB/panel/v2/pkg/tools" ) type Monitor struct { diff --git a/app/providers/console_service_provider.go b/app/providers/console_service_provider.go index cb5ee152da..18d5090d4d 100644 --- a/app/providers/console_service_provider.go +++ b/app/providers/console_service_provider.go @@ -4,7 +4,7 @@ import ( "github.com/goravel/framework/contracts/foundation" "github.com/goravel/framework/facades" - "github.com/TheTNB/panel/app/console" + "github.com/TheTNB/panel/v2/app/console" ) type ConsoleServiceProvider struct { diff --git a/app/providers/database_service_provider.go b/app/providers/database_service_provider.go index 3787c9a4ea..7a08070a95 100644 --- a/app/providers/database_service_provider.go +++ b/app/providers/database_service_provider.go @@ -6,7 +6,7 @@ import ( "github.com/goravel/framework/database/gorm" "github.com/goravel/framework/facades" - "github.com/TheTNB/panel/pkg/migrate" + "github.com/TheTNB/panel/v2/pkg/migrate" ) type DatabaseServiceProvider struct { diff --git a/app/providers/queue_service_provider.go b/app/providers/queue_service_provider.go index afbebffb7f..cc8f1215b6 100644 --- a/app/providers/queue_service_provider.go +++ b/app/providers/queue_service_provider.go @@ -5,7 +5,7 @@ import ( "github.com/goravel/framework/contracts/queue" "github.com/goravel/framework/facades" - "github.com/TheTNB/panel/app/jobs" + "github.com/TheTNB/panel/v2/app/jobs" ) type QueueServiceProvider struct { diff --git a/app/providers/route_service_provider.go b/app/providers/route_service_provider.go index 11c614fbe4..97f3559dba 100644 --- a/app/providers/route_service_provider.go +++ b/app/providers/route_service_provider.go @@ -6,8 +6,8 @@ import ( "github.com/goravel/framework/facades" "github.com/goravel/framework/http/limit" - "github.com/TheTNB/panel/app/http" - "github.com/TheTNB/panel/routes" + "github.com/TheTNB/panel/v2/app/http" + "github.com/TheTNB/panel/v2/routes" ) type RouteServiceProvider struct { diff --git a/app/providers/validation_service_provider.go b/app/providers/validation_service_provider.go index 5215cd896b..c5de942610 100644 --- a/app/providers/validation_service_provider.go +++ b/app/providers/validation_service_provider.go @@ -5,7 +5,7 @@ import ( "github.com/goravel/framework/contracts/validation" "github.com/goravel/framework/facades" - "github.com/TheTNB/panel/app/rules" + "github.com/TheTNB/panel/v2/app/rules" ) type ValidationServiceProvider struct { diff --git a/app/rules/path_exist.go b/app/rules/path_exist.go index 338ec17d01..8bc0800f59 100644 --- a/app/rules/path_exist.go +++ b/app/rules/path_exist.go @@ -4,7 +4,7 @@ import ( "github.com/goravel/framework/contracts/validation" "github.com/spf13/cast" - "github.com/TheTNB/panel/pkg/io" + "github.com/TheTNB/panel/v2/pkg/io" ) type PathExists struct { diff --git a/app/rules/path_not_exist.go b/app/rules/path_not_exist.go index 63fc701ec1..c50fda88f1 100644 --- a/app/rules/path_not_exist.go +++ b/app/rules/path_not_exist.go @@ -4,7 +4,7 @@ import ( "github.com/goravel/framework/contracts/validation" "github.com/spf13/cast" - "github.com/TheTNB/panel/pkg/io" + "github.com/TheTNB/panel/v2/pkg/io" ) type PathNotExists struct { diff --git a/bootstrap/app.go b/bootstrap/app.go index a6ddd2095f..fdb26d3ced 100644 --- a/bootstrap/app.go +++ b/bootstrap/app.go @@ -6,7 +6,7 @@ import ( "github.com/gookit/validate/locales/zhcn" "github.com/goravel/framework/foundation" - "github.com/TheTNB/panel/config" + "github.com/TheTNB/panel/v2/config" ) func Boot() { diff --git a/config/app.go b/config/app.go index 2ae2dc5076..da84645873 100644 --- a/config/app.go +++ b/config/app.go @@ -25,7 +25,7 @@ import ( "github.com/goravel/framework/validation" "github.com/goravel/gin" - "github.com/TheTNB/panel/app/providers" + "github.com/TheTNB/panel/v2/app/providers" ) // Boot Start all init methods of the current folder to bootstrap all config. diff --git a/config/panel.go b/config/panel.go index 582ce52624..1dba251820 100644 --- a/config/panel.go +++ b/config/panel.go @@ -8,7 +8,7 @@ func init() { config := facades.Config() config.Add("panel", map[string]any{ "name": "耗子面板", - "version": "v2.2.25", + "version": "v2.2.26", "ssl": config.Env("APP_SSL", false), // 安全入口 "entrance": config.Env("APP_ENTRANCE", "/"), diff --git a/go.mod b/go.mod index 859d2b9ed2..ceae2da62d 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/TheTNB/panel +module github.com/TheTNB/panel/v2 go 1.22 diff --git a/internal/backup.go b/internal/backup.go index c6bbe13fef..1f55f94d38 100644 --- a/internal/backup.go +++ b/internal/backup.go @@ -1,8 +1,8 @@ package internal import ( - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/pkg/types" ) type Backup interface { diff --git a/internal/cert.go b/internal/cert.go index 433970815f..98e7dcaaf3 100644 --- a/internal/cert.go +++ b/internal/cert.go @@ -1,9 +1,9 @@ package internal import ( - requests "github.com/TheTNB/panel/app/http/requests/cert" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/pkg/acme" + requests "github.com/TheTNB/panel/v2/app/http/requests/cert" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/pkg/acme" ) type Cert interface { diff --git a/internal/container.go b/internal/container.go index e69a81768a..29415e67c5 100644 --- a/internal/container.go +++ b/internal/container.go @@ -7,8 +7,8 @@ import ( "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/volume" - requests "github.com/TheTNB/panel/app/http/requests/container" - paneltypes "github.com/TheTNB/panel/pkg/types" + requests "github.com/TheTNB/panel/v2/app/http/requests/container" + paneltypes "github.com/TheTNB/panel/v2/pkg/types" ) type Container interface { diff --git a/internal/cron.go b/internal/cron.go index 4eb632a54a..91b792bfab 100644 --- a/internal/cron.go +++ b/internal/cron.go @@ -1,6 +1,6 @@ package internal -import "github.com/TheTNB/panel/app/models" +import "github.com/TheTNB/panel/v2/app/models" type Cron interface { AddToSystem(cron models.Cron) error diff --git a/internal/php.go b/internal/php.go index e8b34ce887..7667dea7a4 100644 --- a/internal/php.go +++ b/internal/php.go @@ -1,7 +1,7 @@ package internal import ( - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/pkg/types" ) type PHP interface { diff --git a/internal/plugin.go b/internal/plugin.go index 38dd497374..02929b4c85 100644 --- a/internal/plugin.go +++ b/internal/plugin.go @@ -1,8 +1,8 @@ package internal import ( - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/pkg/types" ) type Plugin interface { diff --git a/internal/services/backup.go b/internal/services/backup.go index 4ec023d053..6144b8e205 100644 --- a/internal/services/backup.go +++ b/internal/services/backup.go @@ -9,12 +9,12 @@ import ( "github.com/goravel/framework/support/carbon" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/str" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/str" + "github.com/TheTNB/panel/v2/pkg/types" ) type BackupImpl struct { diff --git a/internal/services/cert.go b/internal/services/cert.go index 8f76e4b53f..927bb12396 100644 --- a/internal/services/cert.go +++ b/internal/services/cert.go @@ -11,13 +11,13 @@ import ( "github.com/go-resty/resty/v2" "github.com/goravel/framework/facades" - requests "github.com/TheTNB/panel/app/http/requests/cert" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/pkg/acme" - "github.com/TheTNB/panel/pkg/cert" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/systemctl" + requests "github.com/TheTNB/panel/v2/app/http/requests/cert" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/pkg/acme" + "github.com/TheTNB/panel/v2/pkg/cert" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/systemctl" ) type CertImpl struct { diff --git a/internal/services/container.go b/internal/services/container.go index 9e4623385c..3bcd7bf837 100644 --- a/internal/services/container.go +++ b/internal/services/container.go @@ -15,8 +15,8 @@ import ( "github.com/docker/docker/client" "github.com/goravel/framework/support/json" - requests "github.com/TheTNB/panel/app/http/requests/container" - paneltypes "github.com/TheTNB/panel/pkg/types" + requests "github.com/TheTNB/panel/v2/app/http/requests/container" + paneltypes "github.com/TheTNB/panel/v2/pkg/types" ) type Container struct { diff --git a/internal/services/cron.go b/internal/services/cron.go index b2459ec556..460630fe56 100644 --- a/internal/services/cron.go +++ b/internal/services/cron.go @@ -5,10 +5,10 @@ import ( "fmt" "strings" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/pkg/os" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/systemctl" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/pkg/os" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/systemctl" ) type CronImpl struct { diff --git a/internal/services/php.go b/internal/services/php.go index 5c24dafa2a..7ea387ab6b 100644 --- a/internal/services/php.go +++ b/internal/services/php.go @@ -12,11 +12,11 @@ import ( "github.com/goravel/framework/facades" "github.com/spf13/cast" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/systemctl" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/systemctl" + "github.com/TheTNB/panel/v2/pkg/types" ) type PHPImpl struct { diff --git a/internal/services/plugin.go b/internal/services/plugin.go index 52b399ec86..8617cf8660 100644 --- a/internal/services/plugin.go +++ b/internal/services/plugin.go @@ -6,10 +6,10 @@ import ( "github.com/goravel/framework/facades" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/types" ) type PluginImpl struct { diff --git a/internal/services/setting.go b/internal/services/setting.go index 946a0fc54f..5388987190 100644 --- a/internal/services/setting.go +++ b/internal/services/setting.go @@ -4,8 +4,8 @@ package services import ( "github.com/goravel/framework/facades" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/pkg/str" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/pkg/str" ) type SettingImpl struct { diff --git a/internal/services/task.go b/internal/services/task.go index 2ce31d2ec4..f36f13afd8 100644 --- a/internal/services/task.go +++ b/internal/services/task.go @@ -5,8 +5,8 @@ import ( "github.com/goravel/framework/facades" - "github.com/TheTNB/panel/app/jobs" - "github.com/TheTNB/panel/app/models" + "github.com/TheTNB/panel/v2/app/jobs" + "github.com/TheTNB/panel/v2/app/models" ) var taskMap sync.Map diff --git a/internal/services/user.go b/internal/services/user.go index 1fb732262f..a42764bdc3 100644 --- a/internal/services/user.go +++ b/internal/services/user.go @@ -4,7 +4,7 @@ package services import ( "github.com/goravel/framework/facades" - "github.com/TheTNB/panel/app/models" + "github.com/TheTNB/panel/v2/app/models" ) type UserImpl struct { diff --git a/internal/services/website.go b/internal/services/website.go index e2ea671708..96aa52abb4 100644 --- a/internal/services/website.go +++ b/internal/services/website.go @@ -4,7 +4,7 @@ package services import ( "errors" "fmt" - "github.com/TheTNB/panel/embed" + "github.com/TheTNB/panel/v2/embed" "path/filepath" "regexp" "slices" @@ -14,16 +14,16 @@ import ( "github.com/goravel/framework/facades" "github.com/spf13/cast" - requests "github.com/TheTNB/panel/app/http/requests/website" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/pkg/cert" - "github.com/TheTNB/panel/pkg/db" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/str" - "github.com/TheTNB/panel/pkg/systemctl" - "github.com/TheTNB/panel/pkg/types" + requests "github.com/TheTNB/panel/v2/app/http/requests/website" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/pkg/cert" + "github.com/TheTNB/panel/v2/pkg/db" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/str" + "github.com/TheTNB/panel/v2/pkg/systemctl" + "github.com/TheTNB/panel/v2/pkg/types" ) type WebsiteImpl struct { diff --git a/internal/user.go b/internal/user.go index 1ff0dbf28f..f0c47257c8 100644 --- a/internal/user.go +++ b/internal/user.go @@ -1,6 +1,6 @@ package internal -import "github.com/TheTNB/panel/app/models" +import "github.com/TheTNB/panel/v2/app/models" type User interface { Create(name, password string) (models.User, error) diff --git a/internal/website.go b/internal/website.go index ac24f4bfb6..c654262f5f 100644 --- a/internal/website.go +++ b/internal/website.go @@ -1,9 +1,9 @@ package internal import ( - requests "github.com/TheTNB/panel/app/http/requests/website" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/pkg/types" + requests "github.com/TheTNB/panel/v2/app/http/requests/website" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/pkg/types" ) type Website interface { diff --git a/main.go b/main.go index e628ff7b04..4bf4c5a487 100644 --- a/main.go +++ b/main.go @@ -19,7 +19,7 @@ package main import ( "github.com/goravel/framework/facades" - "github.com/TheTNB/panel/bootstrap" + "github.com/TheTNB/panel/v2/bootstrap" ) // @title 耗子面板 API diff --git a/pkg/acme/acme.go b/pkg/acme/acme.go index 46be6d2c0e..368d40c6e3 100644 --- a/pkg/acme/acme.go +++ b/pkg/acme/acme.go @@ -14,7 +14,7 @@ import ( "github.com/mholt/acmez/v2/acme" "go.uber.org/zap" - "github.com/TheTNB/panel/pkg/cert" + "github.com/TheTNB/panel/v2/pkg/cert" ) const ( diff --git a/pkg/acme/client.go b/pkg/acme/client.go index d71f804623..7826a343f2 100644 --- a/pkg/acme/client.go +++ b/pkg/acme/client.go @@ -8,7 +8,7 @@ import ( "github.com/mholt/acmez/v2" "github.com/mholt/acmez/v2/acme" - "github.com/TheTNB/panel/pkg/cert" + "github.com/TheTNB/panel/v2/pkg/cert" ) type Certificate struct { diff --git a/pkg/acme/solvers.go b/pkg/acme/solvers.go index 8c962a8c42..a70fe44f9e 100644 --- a/pkg/acme/solvers.go +++ b/pkg/acme/solvers.go @@ -15,8 +15,8 @@ import ( "github.com/mholt/acmez/v2/acme" "golang.org/x/net/publicsuffix" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/systemctl" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/systemctl" ) type httpSolver struct { diff --git a/pkg/db/mysql.go b/pkg/db/mysql.go index 62f56b31b2..db03f2009d 100644 --- a/pkg/db/mysql.go +++ b/pkg/db/mysql.go @@ -6,7 +6,7 @@ import ( _ "github.com/go-sql-driver/mysql" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/pkg/types" ) type MySQL struct { diff --git a/pkg/db/mysql_tools.go b/pkg/db/mysql_tools.go index cb8201cb81..21231c8b92 100644 --- a/pkg/db/mysql_tools.go +++ b/pkg/db/mysql_tools.go @@ -4,8 +4,8 @@ import ( "errors" "fmt" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/systemctl" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/systemctl" ) // MySQLResetRootPassword 重置 MySQL root密码 diff --git a/pkg/db/postgres.go b/pkg/db/postgres.go index 47e6e69737..3095391541 100644 --- a/pkg/db/postgres.go +++ b/pkg/db/postgres.go @@ -6,10 +6,10 @@ import ( _ "github.com/lib/pq" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" - "github.com/TheTNB/panel/pkg/systemctl" - "github.com/TheTNB/panel/pkg/types" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/systemctl" + "github.com/TheTNB/panel/v2/pkg/types" ) type Postgres struct { diff --git a/pkg/migrate/migrations.go b/pkg/migrate/migrations.go index 353cc52fbd..ae98882407 100644 --- a/pkg/migrate/migrations.go +++ b/pkg/migrate/migrations.go @@ -4,7 +4,7 @@ import ( "github.com/go-gormigrate/gormigrate/v2" "gorm.io/gorm" - "github.com/TheTNB/panel/app/models" + "github.com/TheTNB/panel/v2/app/models" ) var Init = &gormigrate.Migration{ diff --git a/pkg/plugins/loader.go b/pkg/plugins/loader.go new file mode 100644 index 0000000000..51096701aa --- /dev/null +++ b/pkg/plugins/loader.go @@ -0,0 +1,52 @@ +package plugins + +import ( + "context" + "runtime" + "strings" + "sync" + + "github.com/goravel/framework/contracts/foundation" + "github.com/goravel/framework/facades" +) + +var plugins sync.Map + +type Meta[ctx any] struct { + Name string // 插件名称 + Description string // 插件描述 + Slug string // 插件标识 + Version string // 插件版本 + Requires []string // 依赖插件 + Excludes []string // 排除插件 + Install string // 安装命令 + Uninstall string // 卸载命令 + Update string // 更新命令 + OnEnable func(ctx) // 启用插件后执行的命令 + OnDisable func(ctx) // 禁用插件后执行的命令 +} + +func AutoRegister(o *Meta[*context.Context]) foundation.Application { + pc, _, _, ok := runtime.Caller(1) + if !ok { + panic("unable to get caller") + } + name := runtime.FuncForPC(pc).Name() + a := strings.LastIndex(name, "/") + if a < 0 { + panic("invalid package name: " + name) + } + name = name[a+1:] + b := strings.Index(name, ".") + if b < 0 { + panic("invalid package name: " + name) + } + name = name[:b] + return Register(name, o) +} + +// Register 注册插件控制器 +func Register(service string, o *Meta[*context.Context]) foundation.Application { + plugins.Store(service, o) + return facades.App() +} diff --git a/pkg/shell/exec.go b/pkg/shell/exec.go index e4bc32e602..63e4b64149 100644 --- a/pkg/shell/exec.go +++ b/pkg/shell/exec.go @@ -11,7 +11,7 @@ import ( "github.com/goravel/framework/support" - "github.com/TheTNB/panel/pkg/slice" + "github.com/TheTNB/panel/v2/pkg/slice" ) // Execf 执行 shell 命令 diff --git a/pkg/ssh/ssh.go b/pkg/ssh/ssh.go index be7a35fe58..687ce960cc 100644 --- a/pkg/ssh/ssh.go +++ b/pkg/ssh/ssh.go @@ -5,7 +5,7 @@ import ( "golang.org/x/crypto/ssh" - "github.com/TheTNB/panel/pkg/io" + "github.com/TheTNB/panel/v2/pkg/io" ) type AuthMethod int8 diff --git a/pkg/systemctl/service.go b/pkg/systemctl/service.go index 1f854d5370..401d814376 100644 --- a/pkg/systemctl/service.go +++ b/pkg/systemctl/service.go @@ -5,7 +5,7 @@ import ( "os/exec" "strings" - "github.com/TheTNB/panel/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/shell" ) // Status 获取服务状态 diff --git a/pkg/tools/tools.go b/pkg/tools/tools.go index 37a39d6440..74cbd3b99d 100644 --- a/pkg/tools/tools.go +++ b/pkg/tools/tools.go @@ -20,8 +20,8 @@ import ( "github.com/shirou/gopsutil/net" "github.com/spf13/cast" - "github.com/TheTNB/panel/pkg/io" - "github.com/TheTNB/panel/pkg/shell" + "github.com/TheTNB/panel/v2/pkg/io" + "github.com/TheTNB/panel/v2/pkg/shell" ) // MonitoringInfo 监控信息 diff --git a/routes/api.go b/routes/api.go index 88722b8de4..b7a66f8a49 100644 --- a/routes/api.go +++ b/routes/api.go @@ -8,9 +8,9 @@ import ( "github.com/goravel/framework/facades" frameworkmiddleware "github.com/goravel/framework/http/middleware" - "github.com/TheTNB/panel/app/http/controllers" - "github.com/TheTNB/panel/app/http/middleware" - "github.com/TheTNB/panel/embed" + "github.com/TheTNB/panel/v2/app/http/controllers" + "github.com/TheTNB/panel/v2/app/http/middleware" + "github.com/TheTNB/panel/v2/embed" ) func Api() { diff --git a/routes/plugin.go b/routes/plugin.go index de3ff9c474..d66d6b57a2 100644 --- a/routes/plugin.go +++ b/routes/plugin.go @@ -4,8 +4,8 @@ import ( "github.com/goravel/framework/contracts/route" "github.com/goravel/framework/facades" - "github.com/TheTNB/panel/app/http/controllers/plugins" - "github.com/TheTNB/panel/app/http/middleware" + "github.com/TheTNB/panel/v2/app/http/controllers/plugins" + "github.com/TheTNB/panel/v2/app/http/middleware" ) // Plugin 加载插件路由 diff --git a/tests/setting/setting_test.go b/tests/setting/setting_test.go index c1b720bf8a..b34629c358 100644 --- a/tests/setting/setting_test.go +++ b/tests/setting/setting_test.go @@ -5,9 +5,9 @@ import ( "github.com/stretchr/testify/suite" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/internal/services" - "github.com/TheTNB/panel/tests" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/internal/services" + "github.com/TheTNB/panel/v2/tests" ) type SettingTestSuite struct { diff --git a/tests/test_case.go b/tests/test_case.go index bb402bba02..9ec1294671 100644 --- a/tests/test_case.go +++ b/tests/test_case.go @@ -3,7 +3,7 @@ package tests import ( "github.com/goravel/framework/testing" - "github.com/TheTNB/panel/bootstrap" + "github.com/TheTNB/panel/v2/bootstrap" ) func init() { diff --git a/tests/user/user_test.go b/tests/user/user_test.go index ca33958044..f29461f660 100644 --- a/tests/user/user_test.go +++ b/tests/user/user_test.go @@ -6,10 +6,10 @@ import ( "github.com/goravel/framework/facades" "github.com/stretchr/testify/suite" - "github.com/TheTNB/panel/app/models" - "github.com/TheTNB/panel/internal" - "github.com/TheTNB/panel/internal/services" - "github.com/TheTNB/panel/tests" + "github.com/TheTNB/panel/v2/app/models" + "github.com/TheTNB/panel/v2/internal" + "github.com/TheTNB/panel/v2/internal/services" + "github.com/TheTNB/panel/v2/tests" ) type UserTestSuite struct {