Merge upstream/master into develop

Sync upstream changes from perfect-panel/server

  Includes updates from v1.0.1 to v1.2.5:
  - Currency configuration support
  - Subscribe improvements (short token, inventory check, etc.)
  - Node management enhancements
  - Database migrations
  - Bug fixes and optimizations
This commit is contained in:
EUForest
2026-01-02 12:51:55 +08:00
parent 47c41d1d14
commit 80ee9a6acf
63 changed files with 947 additions and 1509 deletions
+34
View File
@@ -0,0 +1,34 @@
package initialize
import (
"context"
"fmt"
"github.com/perfect-panel/server/internal/config"
"github.com/perfect-panel/server/internal/svc"
"github.com/perfect-panel/server/pkg/logger"
"github.com/perfect-panel/server/pkg/tool"
)
func Currency(ctx *svc.ServiceContext) {
// Retrieve system currency configuration
currency, err := ctx.SystemModel.GetCurrencyConfig(context.Background())
if err != nil {
logger.Errorf("[INIT] Failed to get currency configuration: %v", err.Error())
panic(fmt.Sprintf("[INIT] Failed to get currency configuration: %v", err.Error()))
}
// Parse currency configuration
configs := struct {
CurrencyUnit string
CurrencySymbol string
AccessKey string
}{}
tool.SystemConfigSliceReflectToStruct(currency, &configs)
ctx.Config.Currency = config.Currency{
Unit: configs.CurrencyUnit,
Symbol: configs.CurrencySymbol,
AccessKey: configs.AccessKey,
}
logger.Infof("[INIT] Currency configuration: %v", ctx.Config.Currency)
}
+1
View File
@@ -15,6 +15,7 @@ func StartInitSystemConfig(svc *svc.ServiceContext) {
Subscribe(svc)
Register(svc)
Mobile(svc)
Currency(svc)
if !svc.Config.Debug {
Telegram(svc)
}
@@ -0,0 +1,2 @@
ALTER TABLE `subscribe`
DROP COLUMN `show_original_price`;
@@ -0,0 +1,2 @@
ALTER TABLE `subscribe`
ADD COLUMN `show_original_price` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'display the original price: 0 not display, 1 display' AFTER `created_at`;
@@ -0,0 +1 @@
DROP TABLE IF EXISTS `server_group`;
@@ -0,0 +1,5 @@
-- This migration script reverts the inventory values in the 'subscribe' table
UPDATE `subscribe`
SET `inventory` = 0
WHERE `inventory` = -1;
@@ -0,0 +1,4 @@
-- Update the `subscribe` table to set `inventory` to -1 where it is currently 0
UPDATE `subscribe`
SET `inventory` = -1
WHERE `inventory` = 0;