mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-10-27 08:15:01 +03:00
feat(hosts): add drag-and-drop and global subscription ordering (#6895)
Hosts already had one saved order on the Hosts page, but subscriptions honoured it only inside each inbound, so a host of a later inbound could never come before one of an earlier inbound (#6894). A new opt-in setting makes raw/base64, Clash/Mihomo and JSON subscriptions follow the Hosts page order across inbounds; the default keeps today's inbound-first output unchanged. The Hosts table gains drag-and-drop reordering next to the Up/Down buttons, on a pointer-reorder hook the Routing Rules table now shares.
This commit is contained in:
@@ -83,6 +83,7 @@ var defaultValueMap = map[string]string{
|
||||
"remarkTemplate": DefaultRemarkTemplate,
|
||||
"subShowIdentityOnAllLinks": "false",
|
||||
"subInfoNodeEnable": "false",
|
||||
"subHostSortMode": "inbound-first",
|
||||
"subCalendarExpireInclusive": "false",
|
||||
"subExpiredTemplate": DefaultSubExpiredTemplate,
|
||||
"subTrafficDepletedTemplate": DefaultSubTrafficDepletedTemplate,
|
||||
@@ -770,6 +771,10 @@ func (s *SettingService) GetSubInfoNodeEnable() (bool, error) {
|
||||
return s.getBool("subInfoNodeEnable")
|
||||
}
|
||||
|
||||
func (s *SettingService) GetSubHostSortMode() (string, error) {
|
||||
return s.getString("subHostSortMode")
|
||||
}
|
||||
|
||||
func (s *SettingService) GetSubCalendarExpireInclusive() (bool, error) {
|
||||
return s.getBool("subCalendarExpireInclusive")
|
||||
}
|
||||
@@ -1662,6 +1667,13 @@ type SecretClears struct {
|
||||
}
|
||||
|
||||
func (s *SettingService) UpdateAllSetting(allSetting *entity.AllSetting, clears SecretClears) error {
|
||||
switch allSetting.SubHostSortMode {
|
||||
case "":
|
||||
allSetting.SubHostSortMode = "inbound-first"
|
||||
case "inbound-first", "hosts-first":
|
||||
default:
|
||||
return errors.New("subscription host sort mode must be inbound-first or hosts-first")
|
||||
}
|
||||
switch allSetting.SubProfileMode {
|
||||
case "", SubProfileModeNone, SubProfileModeBuiltin, SubProfileModeCustom:
|
||||
allSetting.SubProfileMode = effectiveSubProfileMode(allSetting.SubProfileMode, allSetting.SubProfileUrl)
|
||||
|
||||
Reference in New Issue
Block a user