mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-16 12:57:27 +00:00
feat(sub): optionally replace configs rejected by HWID limits
This commit is contained in:
parent
e535df0374
commit
cc951e6342
31 changed files with 351 additions and 13 deletions
|
|
@ -38,6 +38,22 @@ URLs and preview both bodies here:
|
|||
|
||||
<SubscriptionBuilder />
|
||||
|
||||
## Replacing nodes after an HWID rejection
|
||||
|
||||
In **Panel settings → Subscription**, enable **Replace configs when HWID is
|
||||
rejected** (`subHwidRejectWithConfig`, off by default). When HWID is missing or
|
||||
the device limit is reached, the server returns HTTP 200 with a non-working
|
||||
node instead of 404. This supports raw/base64 links, Xray JSON, Clash/Mihomo,
|
||||
legacy Clash, and automatic format detection. Compatible apps can accept the
|
||||
update and replace previously downloaded nodes. With this option off, the
|
||||
existing 404 response and HWID error headers are preserved.
|
||||
|
||||
Replacement requires the app to refresh and accept the subscription. It does
|
||||
not revoke copied credentials or immediately terminate existing connections.
|
||||
Deleting a device only frees its slot: it can register again if a slot is
|
||||
available. To reject it after deletion, the remaining devices must fill the
|
||||
configured limit.
|
||||
|
||||
## Output formats
|
||||
|
||||
The **format is chosen by path**, each with its own enable toggle:
|
||||
|
|
|
|||
|
|
@ -9,6 +9,24 @@ icon: Rss
|
|||
входящего соединения клиенты подхватывают изменения автоматически. Сервер
|
||||
подписок работает как **отдельный** сервер от панели.
|
||||
|
||||
## Замена узлов при отказе по HWID
|
||||
|
||||
В разделе **Настройки панели → Подписка** включите **Заменять конфиги при
|
||||
отказе по HWID** (`subHwidRejectWithConfig`, по умолчанию выключено).
|
||||
При отсутствии HWID или достижении лимита устройств сервер вернёт HTTP 200
|
||||
с нерабочим узлом вместо 404. Поддерживаются обычные и base64-ссылки, Xray JSON,
|
||||
Clash/Mihomo, старый Clash и автоматическое определение формата. Совместимое
|
||||
приложение сможет принять обновление и заменить ранее загруженные узлы.
|
||||
При выключенной настройке сохраняются ответ 404 и заголовки ошибки HWID.
|
||||
|
||||

|
||||
|
||||
Замена происходит только после обновления подписки приложением. Она не
|
||||
отзывает скопированные ключи и не разрывает существующие соединения.
|
||||
Удаление устройства освобождает место: если лимит позволяет, устройство
|
||||
сможет зарегистрироваться снова. Чтобы оно получило отказ после удаления,
|
||||
оставшиеся устройства должны заполнять установленный лимит.
|
||||
|
||||
## Включение и настройка
|
||||
|
||||
Сервер подписок **включён по умолчанию** (`subEnable`). Настройте его в
|
||||
|
|
|
|||
BIN
docs/public/images/subscription-hwid-rejection.png
Normal file
BIN
docs/public/images/subscription-hwid-rejection.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
|
|
@ -354,6 +354,9 @@
|
|||
"example": "inbound-first",
|
||||
"type": "string"
|
||||
},
|
||||
"subHwidRejectWithConfig": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"subIncyAnnounceUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -710,6 +713,7 @@
|
|||
"subHappTunType",
|
||||
"subHideSettings",
|
||||
"subHostSortMode",
|
||||
"subHwidRejectWithConfig",
|
||||
"subIncyAnnounceUrl",
|
||||
"subIncyAppAutoDetect",
|
||||
"subIncyBannerBgColor",
|
||||
|
|
@ -1145,6 +1149,9 @@
|
|||
"example": "inbound-first",
|
||||
"type": "string"
|
||||
},
|
||||
"subHwidRejectWithConfig": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"subIncyAnnounceUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -1509,6 +1516,7 @@
|
|||
"subHappTunType",
|
||||
"subHideSettings",
|
||||
"subHostSortMode",
|
||||
"subHwidRejectWithConfig",
|
||||
"subIncyAnnounceUrl",
|
||||
"subIncyAppAutoDetect",
|
||||
"subIncyBannerBgColor",
|
||||
|
|
|
|||
|
|
@ -354,6 +354,9 @@
|
|||
"example": "inbound-first",
|
||||
"type": "string"
|
||||
},
|
||||
"subHwidRejectWithConfig": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"subIncyAnnounceUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -710,6 +713,7 @@
|
|||
"subHappTunType",
|
||||
"subHideSettings",
|
||||
"subHostSortMode",
|
||||
"subHwidRejectWithConfig",
|
||||
"subIncyAnnounceUrl",
|
||||
"subIncyAppAutoDetect",
|
||||
"subIncyBannerBgColor",
|
||||
|
|
@ -1145,6 +1149,9 @@
|
|||
"example": "inbound-first",
|
||||
"type": "string"
|
||||
},
|
||||
"subHwidRejectWithConfig": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"subIncyAnnounceUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -1509,6 +1516,7 @@
|
|||
"subHappTunType",
|
||||
"subHideSettings",
|
||||
"subHostSortMode",
|
||||
"subHwidRejectWithConfig",
|
||||
"subIncyAnnounceUrl",
|
||||
"subIncyAppAutoDetect",
|
||||
"subIncyBannerBgColor",
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ export const EXAMPLES: Record<string, unknown> = {
|
|||
"subHappTunType": "",
|
||||
"subHideSettings": false,
|
||||
"subHostSortMode": "inbound-first",
|
||||
"subHwidRejectWithConfig": false,
|
||||
"subIncyAnnounceUrl": "",
|
||||
"subIncyAppAutoDetect": false,
|
||||
"subIncyBannerBgColor": "",
|
||||
|
|
@ -291,6 +292,7 @@ export const EXAMPLES: Record<string, unknown> = {
|
|||
"subHappTunType": "",
|
||||
"subHideSettings": false,
|
||||
"subHostSortMode": "inbound-first",
|
||||
"subHwidRejectWithConfig": false,
|
||||
"subIncyAnnounceUrl": "",
|
||||
"subIncyAppAutoDetect": false,
|
||||
"subIncyBannerBgColor": "",
|
||||
|
|
|
|||
|
|
@ -328,6 +328,9 @@ export const SCHEMAS: Record<string, unknown> = {
|
|||
"example": "inbound-first",
|
||||
"type": "string"
|
||||
},
|
||||
"subHwidRejectWithConfig": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"subIncyAnnounceUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -684,6 +687,7 @@ export const SCHEMAS: Record<string, unknown> = {
|
|||
"subHappTunType",
|
||||
"subHideSettings",
|
||||
"subHostSortMode",
|
||||
"subHwidRejectWithConfig",
|
||||
"subIncyAnnounceUrl",
|
||||
"subIncyAppAutoDetect",
|
||||
"subIncyBannerBgColor",
|
||||
|
|
@ -1119,6 +1123,9 @@ export const SCHEMAS: Record<string, unknown> = {
|
|||
"example": "inbound-first",
|
||||
"type": "string"
|
||||
},
|
||||
"subHwidRejectWithConfig": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"subIncyAnnounceUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -1483,6 +1490,7 @@ export const SCHEMAS: Record<string, unknown> = {
|
|||
"subHappTunType",
|
||||
"subHideSettings",
|
||||
"subHostSortMode",
|
||||
"subHwidRejectWithConfig",
|
||||
"subIncyAnnounceUrl",
|
||||
"subIncyAppAutoDetect",
|
||||
"subIncyBannerBgColor",
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ export interface AllSetting {
|
|||
subHappTunType: string;
|
||||
subHideSettings: boolean;
|
||||
subHostSortMode: string;
|
||||
subHwidRejectWithConfig: boolean;
|
||||
subIncyAnnounceUrl: string;
|
||||
subIncyAppAutoDetect: boolean;
|
||||
subIncyBannerBgColor: string;
|
||||
|
|
@ -301,6 +302,7 @@ export interface AllSettingView {
|
|||
subHappTunType: string;
|
||||
subHideSettings: boolean;
|
||||
subHostSortMode: string;
|
||||
subHwidRejectWithConfig: boolean;
|
||||
subIncyAnnounceUrl: string;
|
||||
subIncyAppAutoDetect: boolean;
|
||||
subIncyBannerBgColor: string;
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ export const AllSettingSchema = z.object({
|
|||
subHappTunType: z.string(),
|
||||
subHideSettings: z.boolean(),
|
||||
subHostSortMode: z.string(),
|
||||
subHwidRejectWithConfig: z.boolean(),
|
||||
subIncyAnnounceUrl: z.string(),
|
||||
subIncyAppAutoDetect: z.boolean(),
|
||||
subIncyBannerBgColor: z.string(),
|
||||
|
|
@ -320,6 +321,7 @@ export const AllSettingViewSchema = z.object({
|
|||
subHappTunType: z.string(),
|
||||
subHideSettings: z.boolean(),
|
||||
subHostSortMode: z.string(),
|
||||
subHwidRejectWithConfig: z.boolean(),
|
||||
subIncyAnnounceUrl: z.string(),
|
||||
subIncyAppAutoDetect: z.boolean(),
|
||||
subIncyBannerBgColor: z.string(),
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ export class AllSetting {
|
|||
remarkTemplate = '{{INBOUND}}-{{EMAIL}}|📊{{TRAFFIC_LEFT}}|⏳{{DAYS_LEFT}}D';
|
||||
subShowIdentityOnAllLinks = false;
|
||||
subInfoNodeEnable = false;
|
||||
subHwidRejectWithConfig = false;
|
||||
subHostSortMode: SubHostSortMode = 'inbound-first';
|
||||
subCalendarExpireInclusive = false;
|
||||
subExpiredTemplate = '⛔ {{EMAIL}} | Expired: {{EXPIRE_DATE}}';
|
||||
|
|
|
|||
|
|
@ -95,6 +95,17 @@ export default function SubscriptionGeneralTab({
|
|||
}
|
||||
/>
|
||||
)}
|
||||
<SettingListItem
|
||||
paddings="small"
|
||||
title={t('pages.settings.subHwidRejectWithConfig')}
|
||||
description={t('pages.settings.subHwidRejectWithConfigDesc')}
|
||||
>
|
||||
<Switch
|
||||
aria-label={t('pages.settings.subHwidRejectWithConfig')}
|
||||
checked={allSetting.subHwidRejectWithConfig}
|
||||
onChange={(v) => updateSetting({ subHwidRejectWithConfig: v })}
|
||||
/>
|
||||
</SettingListItem>
|
||||
<SettingListItem
|
||||
paddings="small"
|
||||
title={t('pages.settings.subHostSortMode')}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ export const AllSettingSchema = z
|
|||
remarkTemplate: z.string().optional(),
|
||||
subShowIdentityOnAllLinks: z.boolean().optional(),
|
||||
subInfoNodeEnable: z.boolean().optional(),
|
||||
subHwidRejectWithConfig: z.boolean().optional(),
|
||||
subHostSortMode: SubHostSortModeSchema.optional(),
|
||||
subCalendarExpireInclusive: z.boolean().optional(),
|
||||
subExpiredTemplate: z.string().optional(),
|
||||
|
|
|
|||
|
|
@ -484,10 +484,16 @@ func (a *SUBController) subs(c *gin.Context) {
|
|||
logSubscriptionRoute(userAgent, "html")
|
||||
return
|
||||
}
|
||||
if !a.enforceHwid(c) {
|
||||
format := hwidLinks
|
||||
if shouldAutoServeClash(a.subClashAutoDetect, a.clashEnabled, false, userAgent, a.clashUserAgent) {
|
||||
format = hwidClash
|
||||
} else if shouldAutoServeJson(a.jsonAutoDetect, a.jsonEnabled, false, userAgent, a.jsonUserAgent) {
|
||||
format = hwidJSONArray
|
||||
}
|
||||
if !a.enforceHwid(c, format) {
|
||||
return
|
||||
}
|
||||
if shouldAutoServeClash(a.subClashAutoDetect, a.clashEnabled, false, userAgent, a.clashUserAgent) && a.serveClashBody(c, false, false) {
|
||||
if format == hwidClash && a.serveClashBody(c, false, false) {
|
||||
a.recordSubscriptionFetch(c)
|
||||
logSubscriptionRoute(userAgent, "clash")
|
||||
return
|
||||
|
|
@ -713,7 +719,7 @@ func (a *SUBController) subPageContext(page PageData) map[string]any {
|
|||
}
|
||||
}
|
||||
|
||||
func (a *SUBController) enforceHwid(c *gin.Context) bool {
|
||||
func (a *SUBController) enforceHwid(c *gin.Context, format hwidResponseFormat) bool {
|
||||
result, err := a.clientService.EnforceHwidForSubID(c.Param("subid"), service.HwidRequest{
|
||||
Hwid: c.GetHeader("X-HWID"),
|
||||
UserAgent: c.GetHeader("User-Agent"),
|
||||
|
|
@ -725,11 +731,11 @@ func (a *SUBController) enforceHwid(c *gin.Context) bool {
|
|||
writeSubError(c, err)
|
||||
return false
|
||||
}
|
||||
applyHwidHeaders(c, result)
|
||||
if !result.Allowed {
|
||||
c.Status(http.StatusNotFound)
|
||||
a.writeHwidRejection(c, result, format)
|
||||
return false
|
||||
}
|
||||
applyHwidHeaders(c, result)
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
@ -814,7 +820,7 @@ func (a *SUBController) loadSubTemplate(themeDir string) (*template.Template, er
|
|||
// device limit is enforced on every body route, ?view=raw included (#GHSA-7ww3).
|
||||
func (a *SUBController) subJsons(c *gin.Context) {
|
||||
if strings.EqualFold(c.Query("view"), "raw") {
|
||||
if !a.enforceHwid(c) {
|
||||
if !a.enforceHwid(c, hwidJSON) {
|
||||
return
|
||||
}
|
||||
if !a.serveJsonBody(c, a.jsonAlwaysArray, "application/json; charset=utf-8", true) {
|
||||
|
|
@ -826,7 +832,7 @@ func (a *SUBController) subJsons(c *gin.Context) {
|
|||
if a.maybeServeSubPage(c) {
|
||||
return
|
||||
}
|
||||
if !a.enforceHwid(c) {
|
||||
if !a.enforceHwid(c, hwidJSON) {
|
||||
return
|
||||
}
|
||||
a.serveJson(c, a.jsonAlwaysArray, "text/plain; charset=utf-8")
|
||||
|
|
@ -876,7 +882,7 @@ func (a *SUBController) subClashLegacy(c *gin.Context) {
|
|||
|
||||
func (a *SUBController) subClash(c *gin.Context, legacy bool) {
|
||||
if strings.EqualFold(c.Query("view"), "raw") {
|
||||
if !a.enforceHwid(c) {
|
||||
if !a.enforceHwid(c, hwidClash) {
|
||||
return
|
||||
}
|
||||
if !a.serveClashBody(c, true, legacy) {
|
||||
|
|
@ -888,7 +894,7 @@ func (a *SUBController) subClash(c *gin.Context, legacy bool) {
|
|||
if a.maybeServeSubPage(c) {
|
||||
return
|
||||
}
|
||||
if !a.enforceHwid(c) {
|
||||
if !a.enforceHwid(c, hwidClash) {
|
||||
return
|
||||
}
|
||||
if !a.serveClashBody(c, false, legacy) {
|
||||
|
|
|
|||
|
|
@ -1,22 +1,138 @@
|
|||
package sub
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/goccy/go-yaml"
|
||||
"github.com/xtls/xray-core/infra/conf"
|
||||
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/database"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/database/dbtest"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/web/service"
|
||||
)
|
||||
|
||||
func initHwidSubRouter(t *testing.T, limit int) (*gin.Engine, string) {
|
||||
func TestSubscriptionHwidReplacementRemovesRealNodes(t *testing.T) {
|
||||
router, subID := initHwidSubRouter(t, 2, WithSUBJsonUserAgentRegex("(?i)xray"))
|
||||
settingsService := &service.SettingService{}
|
||||
settings, err := settingsService.GetAllSetting()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if settings.SubHwidRejectWithConfig {
|
||||
t.Fatal("replacement must be opt-in")
|
||||
}
|
||||
settings.SubHwidRejectWithConfig = true
|
||||
if err := settingsService.UpdateAllSetting(settings, service.SecretClears{}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if rec := requestSub(t, router, http.MethodGet, "/sub/"+subID, "device-owner", ""); rec.Code != http.StatusOK {
|
||||
t.Fatalf("register owner = %d", rec.Code)
|
||||
}
|
||||
if rec := requestSub(t, router, http.MethodGet, "/sub/"+subID, "device-rejected", ""); rec.Code != http.StatusOK {
|
||||
t.Fatalf("register second device = %d", rec.Code)
|
||||
}
|
||||
var removed model.ClientHwid
|
||||
if err := database.GetDB().Where("sub_id = ?", subID).Order("id DESC").First(&removed).Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
clientService := &service.ClientService{}
|
||||
if err := clientService.DeleteClientHwid("route@example.com", removed.Id); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := database.GetDB().Model(&model.ClientRecord{}).Where("sub_id = ?", subID).Update("limit_hwid", 1).Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, tc := range []struct {
|
||||
path, userAgent, format string
|
||||
}{
|
||||
{"/sub/", "Happ/4.0", "links"},
|
||||
{"/json/", "Happ/4.0", "json"},
|
||||
{"/json/", "", "json"},
|
||||
{"/clash/", "", "clash"},
|
||||
{"/mihomo/", "", "clash"},
|
||||
{"/clash-legacy/", "", "clash"},
|
||||
{"/sub/", "Mihomo/1.0", "clash"},
|
||||
{"/sub/", "Xray/1.0", "json-array"},
|
||||
} {
|
||||
t.Run(tc.path+tc.userAgent, func(t *testing.T) {
|
||||
req := httptest.NewRequest(http.MethodGet, tc.path+subID+"?view=raw", nil)
|
||||
req.Header.Set("X-HWID", "device-rejected")
|
||||
req.Header.Set("User-Agent", tc.userAgent)
|
||||
rec := httptest.NewRecorder()
|
||||
router.ServeHTTP(rec, req)
|
||||
if rec.Code != http.StatusOK || rec.Header().Get("X-Hwid-Active") != "true" || rec.Header().Get("X-Hwid-Max-Devices-Reached") != "" || rec.Header().Get("X-Hwid-Limit") != "" {
|
||||
t.Fatalf("rejected device = %d, headers=%v, body=%s", rec.Code, rec.Header(), rec.Body)
|
||||
}
|
||||
body := rec.Body.String()
|
||||
switch tc.format {
|
||||
case "links":
|
||||
link, err := base64.StdEncoding.DecodeString(body)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
body = string(link)
|
||||
if !strings.HasPrefix(body, "vless://") || !strings.Contains(body, "@192.0.2.1:1?") {
|
||||
t.Fatalf("replacement link = %s", body)
|
||||
}
|
||||
case "json", "json-array":
|
||||
if tc.format == "json-array" {
|
||||
var configs []json.RawMessage
|
||||
if err := json.Unmarshal([]byte(body), &configs); err != nil || len(configs) != 1 {
|
||||
t.Fatalf("auto JSON array = %s, err=%v", body, err)
|
||||
}
|
||||
body = string(configs[0])
|
||||
}
|
||||
var config conf.Config
|
||||
if err := json.Unmarshal([]byte(body), &config); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(config.OutboundConfigs) != 1 || config.OutboundConfigs[0].Protocol != "blackhole" {
|
||||
t.Fatalf("JSON must block all traffic: %s", body)
|
||||
}
|
||||
if _, err := config.Build(); err != nil {
|
||||
t.Fatalf("Xray rejected replacement config: %v", err)
|
||||
}
|
||||
case "clash":
|
||||
var profile struct {
|
||||
Proxies []struct {
|
||||
Server string `yaml:"server"`
|
||||
Port int `yaml:"port"`
|
||||
} `yaml:"proxies"`
|
||||
Rules []string `yaml:"rules"`
|
||||
}
|
||||
if err := yaml.Unmarshal(rec.Body.Bytes(), &profile); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(profile.Proxies) != 1 || profile.Proxies[0].Server != "192.0.2.1" || profile.Proxies[0].Port != 1 || !reflect.DeepEqual(profile.Rules, []string{"MATCH,HWID-BLOCKED"}) || strings.Contains(body, "DIRECT") {
|
||||
t.Fatalf("Clash must only route to the dummy node: %s", body)
|
||||
}
|
||||
}
|
||||
if strings.Contains(body, "11111111-2222-4333-8444-555555555555") {
|
||||
t.Fatalf("replacement leaked real credentials: %s", body)
|
||||
}
|
||||
})
|
||||
}
|
||||
owner := requestSub(t, router, http.MethodGet, "/sub/"+subID, "device-owner", "")
|
||||
ownerLinks, err := base64.StdEncoding.DecodeString(owner.Body.String())
|
||||
if err != nil || owner.Code != http.StatusOK || !strings.Contains(string(ownerLinks), "11111111-2222-4333-8444-555555555555") {
|
||||
t.Fatalf("owner lost real config: %d %s, err=%v", owner.Code, ownerLinks, err)
|
||||
}
|
||||
if rec := requestSub(t, router, http.MethodGet, "/sub/unknown", "device-rejected", ""); rec.Code != http.StatusNotFound {
|
||||
t.Fatalf("unknown subscription = %d, want 404", rec.Code)
|
||||
}
|
||||
}
|
||||
|
||||
func initHwidSubRouter(t *testing.T, limit int, options ...SUBControllerOption) (*gin.Engine, string) {
|
||||
t.Helper()
|
||||
tmp := t.TempDir()
|
||||
t.Chdir(tmp)
|
||||
|
|
@ -56,8 +172,7 @@ func initHwidSubRouter(t *testing.T, limit int) (*gin.Engine, string) {
|
|||
|
||||
gin.SetMode(gin.TestMode)
|
||||
router := gin.New()
|
||||
NewSUBController(
|
||||
router.Group("/"),
|
||||
defaults := []SUBControllerOption{
|
||||
WithSUBPath("/sub/"),
|
||||
WithSUBJsonPath("/json/"),
|
||||
WithSUBClashPath("/clash/"),
|
||||
|
|
@ -65,10 +180,48 @@ func initHwidSubRouter(t *testing.T, limit int) (*gin.Engine, string) {
|
|||
WithSUBJsonAutoDetect(true),
|
||||
WithSUBJsonEnabled(true),
|
||||
WithSUBClashEnabled(true),
|
||||
)
|
||||
}
|
||||
controller := NewSUBController(router.Group("/"), append(defaults, options...)...)
|
||||
t.Cleanup(controller.Close)
|
||||
return router, subID
|
||||
}
|
||||
|
||||
func TestSubscriptionHwidReplacementForMissingHwidAndAutoJSON(t *testing.T) {
|
||||
router, subID := initHwidSubRouter(t, 1,
|
||||
WithSUBEncryption(false),
|
||||
WithSUBJsonUserAgentRegex("(?i)xray"),
|
||||
WithSUBJsonAlwaysArray(true),
|
||||
)
|
||||
if err := database.GetDB().Create(&model.Setting{Key: "subHwidRejectWithConfig", Value: "true"}).Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, path := range []string{"/sub/", "/json/", "/clash/"} {
|
||||
rec := requestSub(t, router, http.MethodGet, path+subID, "", "")
|
||||
if rec.Code != http.StatusOK || rec.Header().Get("X-Hwid-Active") != "true" || rec.Header().Get("X-Hwid-Not-Supported") != "" {
|
||||
t.Fatalf("%s missing HWID = %d %v", path, rec.Code, rec.Header())
|
||||
}
|
||||
if path == "/sub/" && !strings.HasPrefix(rec.Body.String(), "vless://") {
|
||||
t.Fatalf("unencrypted replacement = %s", rec.Body)
|
||||
}
|
||||
if path == "/json/" && !strings.HasPrefix(rec.Body.String(), "[") {
|
||||
t.Fatalf("JSON array setting ignored: %s", rec.Body)
|
||||
}
|
||||
head := requestSub(t, router, http.MethodHead, path+subID, "", "")
|
||||
if head.Code != http.StatusOK || head.Body.Len() != 0 || head.Header().Get("Content-Type") != rec.Header().Get("Content-Type") {
|
||||
t.Fatalf("%s HEAD = %d %v %q", path, head.Code, head.Header(), head.Body.String())
|
||||
}
|
||||
}
|
||||
req := httptest.NewRequest(http.MethodGet, "/sub/"+subID, nil)
|
||||
req.Header.Set("User-Agent", "Xray/1.0")
|
||||
rec := httptest.NewRecorder()
|
||||
router.ServeHTTP(rec, req)
|
||||
var configs []json.RawMessage
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &configs); err != nil || len(configs) != 1 {
|
||||
t.Fatalf("auto JSON = %s, error=%v", rec.Body, err)
|
||||
}
|
||||
assertHwidStatus(t, requestSub(t, router, http.MethodGet, "/sub/"+subID+"/hwid-status", "", ""), true, 1, 0, 1, false)
|
||||
}
|
||||
|
||||
func requestSub(t *testing.T, router *gin.Engine, method string, path string, hwid string, accept string) *httptest.ResponseRecorder {
|
||||
t.Helper()
|
||||
req := httptest.NewRequest(method, path, nil)
|
||||
|
|
|
|||
68
internal/sub/hwid_rejection.go
Normal file
68
internal/sub/hwid_rejection.go
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
package sub
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/web/service"
|
||||
)
|
||||
|
||||
type hwidResponseFormat int
|
||||
|
||||
const (
|
||||
hwidLinks hwidResponseFormat = iota
|
||||
hwidJSON
|
||||
hwidJSONArray
|
||||
hwidClash
|
||||
)
|
||||
|
||||
// A parseable dummy node lets subscription apps replace previously downloaded nodes.
|
||||
// Never reuse subscriber credentials or include a direct-connection fallback here.
|
||||
func (a *SUBController) writeHwidRejection(c *gin.Context, result service.HwidGateResult, format hwidResponseFormat) {
|
||||
enabled, err := a.settingService.GetSubHwidRejectWithConfig()
|
||||
if err != nil {
|
||||
writeSubError(c, err)
|
||||
return
|
||||
}
|
||||
if !enabled {
|
||||
applyHwidHeaders(c, result)
|
||||
c.Status(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
remark := "Device limit reached"
|
||||
if result.NotSupported {
|
||||
remark = "HWID required"
|
||||
}
|
||||
contentType := "text/plain; charset=utf-8"
|
||||
var body string
|
||||
switch format {
|
||||
case hwidJSON, hwidJSONArray:
|
||||
contentType = "application/json; charset=utf-8"
|
||||
body = fmt.Sprintf(`{"remarks":%q,"inbounds":[{"listen":"127.0.0.1","port":10808,"protocol":"socks","settings":{"auth":"noauth","udp":true}}],"outbounds":[{"tag":"blocked","protocol":"blackhole","settings":{}}]}`, remark)
|
||||
if format == hwidJSONArray || a.jsonAlwaysArray {
|
||||
body = "[" + body + "]"
|
||||
}
|
||||
case hwidClash:
|
||||
contentType = "application/yaml; charset=utf-8"
|
||||
body = fmt.Sprintf("mode: rule\nproxies:\n - name: %q\n type: vmess\n server: 192.0.2.1\n port: 1\n uuid: 00000000-0000-4000-8000-000000000001\n alterId: 0\n cipher: auto\nproxy-groups:\n - name: HWID-BLOCKED\n type: select\n proxies:\n - %q\nrules:\n - MATCH,HWID-BLOCKED\n", remark, remark)
|
||||
default:
|
||||
body = "vless://00000000-0000-4000-8000-000000000001@192.0.2.1:1?encryption=none&type=tcp&security=none#" + url.PathEscape(remark) + "\n"
|
||||
if a.subEncrypt {
|
||||
body = base64.StdEncoding.EncodeToString([]byte(body))
|
||||
}
|
||||
}
|
||||
c.Header("Profile-Update-Interval", a.updateInterval)
|
||||
// Rejection headers can make apps discard a successful replacement response.
|
||||
applyHwidHeaders(c, service.HwidGateResult{Active: result.Active})
|
||||
c.Header("Announce", "base64:"+base64.StdEncoding.EncodeToString([]byte(remark)))
|
||||
c.Header("Content-Type", contentType)
|
||||
if c.Request.Method == http.MethodHead {
|
||||
c.Status(http.StatusOK)
|
||||
return
|
||||
}
|
||||
c.Data(http.StatusOK, contentType, []byte(body))
|
||||
}
|
||||
|
|
@ -38,6 +38,7 @@ type AllSetting struct {
|
|||
RemarkTemplate string `json:"remarkTemplate" form:"remarkTemplate"`
|
||||
SubShowIdentityOnAllLinks bool `json:"subShowIdentityOnAllLinks" form:"subShowIdentityOnAllLinks"`
|
||||
SubInfoNodeEnable bool `json:"subInfoNodeEnable" form:"subInfoNodeEnable"`
|
||||
SubHwidRejectWithConfig bool `json:"subHwidRejectWithConfig" form:"subHwidRejectWithConfig"`
|
||||
SubHostSortMode string `json:"subHostSortMode" form:"subHostSortMode" example:"inbound-first"`
|
||||
SubCalendarExpireInclusive bool `json:"subCalendarExpireInclusive" form:"subCalendarExpireInclusive"`
|
||||
SubExpiredTemplate string `json:"subExpiredTemplate" form:"subExpiredTemplate"`
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ var defaultValueMap = map[string]string{
|
|||
"remarkTemplate": DefaultRemarkTemplate,
|
||||
"subShowIdentityOnAllLinks": "false",
|
||||
"subInfoNodeEnable": "false",
|
||||
"subHwidRejectWithConfig": "false",
|
||||
"subHostSortMode": "inbound-first",
|
||||
"subCalendarExpireInclusive": "false",
|
||||
"subExpiredTemplate": DefaultSubExpiredTemplate,
|
||||
|
|
@ -771,6 +772,10 @@ func (s *SettingService) GetSubInfoNodeEnable() (bool, error) {
|
|||
return s.getBool("subInfoNodeEnable")
|
||||
}
|
||||
|
||||
func (s *SettingService) GetSubHwidRejectWithConfig() (bool, error) {
|
||||
return s.getBool("subHwidRejectWithConfig")
|
||||
}
|
||||
|
||||
func (s *SettingService) GetSubHostSortMode() (string, error) {
|
||||
return s.getString("subHostSortMode")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1641,6 +1641,8 @@
|
|||
},
|
||||
"subCalendarExpireInclusive": "Month-end subscription expiry display",
|
||||
"subCalendarExpireInclusiveDesc": "Default off. For clients renewing on day 1 with a midnight cutoff in the panel timezone, report the previous month's last second in subscription expiry headers. Actual cutoff and renewals are unchanged. Clients use their own timezone and may consider the subscription expired one second early.",
|
||||
"subHwidRejectWithConfig": "استبدال الإعدادات عند رفض HWID",
|
||||
"subHwidRejectWithConfigDesc": "إرجاع HTTP 200 مع عقدة غير عاملة بدلاً من 404 عند غياب HWID أو بلوغ حد الأجهزة. يمكن للتطبيقات المتوافقة استبدال العقد المحفوظة عند التحديث؛ وتبقى الإعدادات المنسوخة صالحة. حذف جهاز يحرر مكاناً لكنه لا يحظره نهائياً.",
|
||||
"subInfoNodeEnable": "تكوين معلومات منفصل / عقدة وهمية",
|
||||
"subInfoNodeEnableDesc": "عند التفعيل، يتم عرض الملاحظات وحركة المرور/الأيام المتبقية كتكوين SOCKS منفصل في الأعلى، وعند انتهاء الصلاحية أو نفاد البيانات يتم إرجاع تكوين الحالة فقط.",
|
||||
"subExpiredTemplate": "قالب انتهاء الصلاحية",
|
||||
|
|
|
|||
|
|
@ -1762,6 +1762,8 @@
|
|||
},
|
||||
"subCalendarExpireInclusive": "Month-end subscription expiry display",
|
||||
"subCalendarExpireInclusiveDesc": "Default off. For clients renewing on day 1 with a midnight cutoff in the panel timezone, report the previous month's last second in subscription expiry headers. Actual cutoff and renewals are unchanged. Clients use their own timezone and may consider the subscription expired one second early.",
|
||||
"subHwidRejectWithConfig": "Replace configs when HWID is rejected",
|
||||
"subHwidRejectWithConfigDesc": "Return HTTP 200 with a non-working node instead of 404 when HWID is missing or the device limit is reached. Compatible apps can replace saved nodes on update; copied configs remain valid. Deleting a device frees a slot and does not permanently ban it.",
|
||||
"subInfoNodeEnable": "Separate Info Config / Dummy Node",
|
||||
"subInfoNodeEnableDesc": "When enabled, remarks and remaining traffic/days are served as a separate dummy SOCKS config at the top, and expired/depleted subscriptions return only the status config.",
|
||||
"subExpiredTemplate": "Expired Template",
|
||||
|
|
|
|||
|
|
@ -1641,6 +1641,8 @@
|
|||
},
|
||||
"subCalendarExpireInclusive": "Month-end subscription expiry display",
|
||||
"subCalendarExpireInclusiveDesc": "Default off. For clients renewing on day 1 with a midnight cutoff in the panel timezone, report the previous month's last second in subscription expiry headers. Actual cutoff and renewals are unchanged. Clients use their own timezone and may consider the subscription expired one second early.",
|
||||
"subHwidRejectWithConfig": "Reemplazar configuraciones al rechazar el HWID",
|
||||
"subHwidRejectWithConfigDesc": "Devolver HTTP 200 con un nodo no funcional en lugar de 404 si falta el HWID o se alcanza el límite de dispositivos. Las aplicaciones compatibles pueden reemplazar los nodos guardados al actualizar; las configuraciones copiadas siguen siendo válidas. Eliminar un dispositivo libera una plaza, pero no lo bloquea permanentemente.",
|
||||
"subInfoNodeEnable": "Configuración de información separada / Nodo ficticio",
|
||||
"subInfoNodeEnableDesc": "Si está activado, la información de tráfico y días restantes se muestra en un nodo SOCKS ficticio arriba, y las suscripciones caducadas o agotadas devuelven solo el estado.",
|
||||
"subExpiredTemplate": "Plantilla de expirado",
|
||||
|
|
|
|||
|
|
@ -1641,6 +1641,8 @@
|
|||
},
|
||||
"subCalendarExpireInclusive": "Month-end subscription expiry display",
|
||||
"subCalendarExpireInclusiveDesc": "Default off. For clients renewing on day 1 with a midnight cutoff in the panel timezone, report the previous month's last second in subscription expiry headers. Actual cutoff and renewals are unchanged. Clients use their own timezone and may consider the subscription expired one second early.",
|
||||
"subHwidRejectWithConfig": "جایگزینی پیکربندی هنگام رد شدن HWID",
|
||||
"subHwidRejectWithConfigDesc": "اگر HWID موجود نباشد یا ظرفیت دستگاهها پر شده باشد، بهجای 404 پاسخ HTTP 200 با یک گره غیرفعال ارسال شود. برنامههای سازگار میتوانند هنگام بهروزرسانی گرههای ذخیرهشده را جایگزین کنند؛ پیکربندیهای کپیشده معتبر میمانند. حذف دستگاه یک جایگاه آزاد میکند، اما آن را برای همیشه مسدود نمیکند.",
|
||||
"subInfoNodeEnable": "کانفیگ جداگانه اطلاعات / نود نمایشی",
|
||||
"subInfoNodeEnableDesc": "در صورت فعال بودن، مشخصات و حجم/روزهای باقیمانده به عنوان یک کانفیگ مجزای ساکس در بالای لیست نمایش داده میشود و در صورت انقضا یا اتمام حجم فقط پیام وضعیت ارسال میشود.",
|
||||
"subExpiredTemplate": "قالب پیام انقضا",
|
||||
|
|
|
|||
|
|
@ -1641,6 +1641,8 @@
|
|||
},
|
||||
"subCalendarExpireInclusive": "Month-end subscription expiry display",
|
||||
"subCalendarExpireInclusiveDesc": "Default off. For clients renewing on day 1 with a midnight cutoff in the panel timezone, report the previous month's last second in subscription expiry headers. Actual cutoff and renewals are unchanged. Clients use their own timezone and may consider the subscription expired one second early.",
|
||||
"subHwidRejectWithConfig": "Ganti konfigurasi saat HWID ditolak",
|
||||
"subHwidRejectWithConfigDesc": "Kembalikan HTTP 200 dengan node yang tidak berfungsi alih-alih 404 jika HWID tidak ada atau batas perangkat tercapai. Aplikasi yang kompatibel dapat mengganti node tersimpan saat pembaruan; konfigurasi yang disalin tetap berlaku. Menghapus perangkat membebaskan slot, tetapi tidak memblokirnya secara permanen.",
|
||||
"subInfoNodeEnable": "Konfigurasi Info Terpisah / Node Dummy",
|
||||
"subInfoNodeEnableDesc": "Saat diaktifkan, catatan dan sisa kuota/hari disajikan sebagai konfigurasi SOCKS dummy terpisah di bagian atas, dan langganan kedaluwarsa/habis hanya mengembalikan status.",
|
||||
"subExpiredTemplate": "Templat Kedaluwarsa",
|
||||
|
|
|
|||
|
|
@ -1641,6 +1641,8 @@
|
|||
},
|
||||
"subCalendarExpireInclusive": "Month-end subscription expiry display",
|
||||
"subCalendarExpireInclusiveDesc": "Default off. For clients renewing on day 1 with a midnight cutoff in the panel timezone, report the previous month's last second in subscription expiry headers. Actual cutoff and renewals are unchanged. Clients use their own timezone and may consider the subscription expired one second early.",
|
||||
"subHwidRejectWithConfig": "HWID 拒否時に設定を置き換える",
|
||||
"subHwidRejectWithConfigDesc": "HWID がない場合や端末数の上限に達した場合、404 の代わりに接続できないノードと HTTP 200 を返します。対応アプリは更新時に保存済みノードを置き換えられますが、コピー済みの設定は引き続き有効です。端末の削除は空きを作りますが、永久的なブロックにはなりません。",
|
||||
"subInfoNodeEnable": "個別情報設定 / ダミーノード",
|
||||
"subInfoNodeEnableDesc": "有効にすると、備考と残りの通信量/日数が上部の独立したSOCKSダミー構成として表示され、期限切れや通信量超過時はステータスのみが返されます。",
|
||||
"subExpiredTemplate": "期限切れテンプレート",
|
||||
|
|
|
|||
|
|
@ -1641,6 +1641,8 @@
|
|||
},
|
||||
"subCalendarExpireInclusive": "Month-end subscription expiry display",
|
||||
"subCalendarExpireInclusiveDesc": "Default off. For clients renewing on day 1 with a midnight cutoff in the panel timezone, report the previous month's last second in subscription expiry headers. Actual cutoff and renewals are unchanged. Clients use their own timezone and may consider the subscription expired one second early.",
|
||||
"subHwidRejectWithConfig": "Substituir configurações quando o HWID for rejeitado",
|
||||
"subHwidRejectWithConfigDesc": "Retornar HTTP 200 com um nó sem conexão em vez de 404 quando faltar o HWID ou o limite de dispositivos for atingido. Aplicativos compatíveis podem substituir os nós salvos ao atualizar; configurações copiadas continuam válidas. Excluir um dispositivo libera uma vaga, mas não o bloqueia permanentemente.",
|
||||
"subInfoNodeEnable": "Configuração de informações separada / Nó fictício",
|
||||
"subInfoNodeEnableDesc": "Quando ativado, observações e tráfego/dias restantes são exibidos em uma configuração SOCKS fictícia no topo, e assinaturas expiradas/esgotadas retornam apenas o status.",
|
||||
"subExpiredTemplate": "Modelo expirado",
|
||||
|
|
|
|||
|
|
@ -1641,6 +1641,8 @@
|
|||
},
|
||||
"subCalendarExpireInclusive": "Month-end subscription expiry display",
|
||||
"subCalendarExpireInclusiveDesc": "Default off. For clients renewing on day 1 with a midnight cutoff in the panel timezone, report the previous month's last second in subscription expiry headers. Actual cutoff and renewals are unchanged. Clients use their own timezone and may consider the subscription expired one second early.",
|
||||
"subHwidRejectWithConfig": "Заменять конфиги при отказе по HWID",
|
||||
"subHwidRejectWithConfigDesc": "При отсутствии HWID или превышении лимита устройств возвращать HTTP 200 с нерабочим узлом вместо 404. Совместимые приложения смогут заменить сохранённые узлы при обновлении; скопированные конфиги сохраняют доступ. Удаление устройства освобождает место, но не блокирует его навсегда.",
|
||||
"subInfoNodeEnable": "Отдельный инфо-конфиг / фиктивный узел",
|
||||
"subInfoNodeEnableDesc": "Если включено, примечание и остаток трафика/дней отображаются отдельным SOCKS-конфигом вверху, а при истечении срока/трафика возвращается только статус.",
|
||||
"subExpiredTemplate": "Шаблон истекшей подписки",
|
||||
|
|
|
|||
|
|
@ -1762,6 +1762,8 @@
|
|||
},
|
||||
"subCalendarExpireInclusive": "Zobrazenie konca mesačnej platnosti v odbere",
|
||||
"subCalendarExpireInclusiveDesc": "Predvolene vypnuté. Pri obnove v 1. deň mesiaca o polnoci v pásme panelu hlási hlavička odberu ako koniec platnosti poslednú sekundu predchádzajúceho mesiaca. Skutočné ukončenie a obnovovanie sa nemení. Klienti používajú vlastné časové pásmo a môžu odber považovať za neplatný o sekundu skôr.",
|
||||
"subHwidRejectWithConfig": "Nahradiť konfigurácie pri odmietnutí HWID",
|
||||
"subHwidRejectWithConfigDesc": "Pri chýbajúcom HWID alebo dosiahnutí limitu zariadení vrátiť HTTP 200 s nefunkčným uzlom namiesto 404. Kompatibilné aplikácie môžu pri aktualizácii nahradiť uložené uzly; skopírované konfigurácie zostávajú platné. Odstránenie zariadenia uvoľní miesto, ale nezablokuje ho natrvalo.",
|
||||
"subInfoNodeEnable": "Samostatný informačný profil",
|
||||
"subInfoNodeEnableDesc": "Názov a zostávajúce dáta/dni sa zobrazia hore ako samostatný nefunkčný profil SOCKS. Odbery so skončenou platnosťou alebo vyčerpaným limitom potom vrátia iba stavový profil.",
|
||||
"subExpiredTemplate": "Šablóna skončenej platnosti",
|
||||
|
|
|
|||
|
|
@ -1641,6 +1641,8 @@
|
|||
},
|
||||
"subCalendarExpireInclusive": "Month-end subscription expiry display",
|
||||
"subCalendarExpireInclusiveDesc": "Default off. For clients renewing on day 1 with a midnight cutoff in the panel timezone, report the previous month's last second in subscription expiry headers. Actual cutoff and renewals are unchanged. Clients use their own timezone and may consider the subscription expired one second early.",
|
||||
"subHwidRejectWithConfig": "HWID reddedildiğinde yapılandırmaları değiştir",
|
||||
"subHwidRejectWithConfigDesc": "HWID eksikse veya cihaz sınırına ulaşılmışsa 404 yerine çalışmayan bir düğümle HTTP 200 döndürür. Uyumlu uygulamalar güncellemede kayıtlı düğümleri değiştirebilir; kopyalanan yapılandırmalar geçerli kalır. Cihazı silmek yer açar ancak cihazı kalıcı olarak engellemez.",
|
||||
"subInfoNodeEnable": "Ayrı Bilgi Yapılandırması / Sahte Düğüm",
|
||||
"subInfoNodeEnableDesc": "Etkinleştirildiğinde, notlar ve kalan trafik/günler en üstte ayrı bir sahte SOCKS yapılandırması olarak sunulur; süresi dolmuş veya kotası bitmiş abonelikler yalnızca durum yapılandırmasını alır.",
|
||||
"subExpiredTemplate": "Süresi Dolmuş Şablonu",
|
||||
|
|
|
|||
|
|
@ -1641,6 +1641,8 @@
|
|||
},
|
||||
"subCalendarExpireInclusive": "Month-end subscription expiry display",
|
||||
"subCalendarExpireInclusiveDesc": "Default off. For clients renewing on day 1 with a midnight cutoff in the panel timezone, report the previous month's last second in subscription expiry headers. Actual cutoff and renewals are unchanged. Clients use their own timezone and may consider the subscription expired one second early.",
|
||||
"subHwidRejectWithConfig": "Замінювати конфігурації при відмові за HWID",
|
||||
"subHwidRejectWithConfigDesc": "Якщо HWID відсутній або досягнуто ліміту пристроїв, повертати HTTP 200 з неробочим вузлом замість 404. Сумісні програми можуть замінити збережені вузли при оновленні; скопійовані конфігурації залишаються чинними. Видалення пристрою звільняє місце, але не блокує його назавжди.",
|
||||
"subInfoNodeEnable": "Окремий інфо-конфіг / фіктивний вузол",
|
||||
"subInfoNodeEnableDesc": "Якщо увімкнено, примітка та залишок трафіку/днів відображаються окремим SOCKS-конфігом угорі, а після закінчення терміну/трафіку повертається лише статус.",
|
||||
"subExpiredTemplate": "Шаблон закінчення терміну",
|
||||
|
|
|
|||
|
|
@ -1641,6 +1641,8 @@
|
|||
},
|
||||
"subCalendarExpireInclusive": "Month-end subscription expiry display",
|
||||
"subCalendarExpireInclusiveDesc": "Default off. For clients renewing on day 1 with a midnight cutoff in the panel timezone, report the previous month's last second in subscription expiry headers. Actual cutoff and renewals are unchanged. Clients use their own timezone and may consider the subscription expired one second early.",
|
||||
"subHwidRejectWithConfig": "Thay cấu hình khi HWID bị từ chối",
|
||||
"subHwidRejectWithConfigDesc": "Trả về HTTP 200 với nút không hoạt động thay vì 404 khi thiếu HWID hoặc đạt giới hạn thiết bị. Ứng dụng tương thích có thể thay các nút đã lưu khi cập nhật; cấu hình đã sao chép vẫn còn hiệu lực. Xóa thiết bị giải phóng một chỗ nhưng không chặn thiết bị vĩnh viễn.",
|
||||
"subInfoNodeEnable": "Cấu hình thông tin riêng / Nút ảo",
|
||||
"subInfoNodeEnableDesc": "Khi bật, ghi chú và lưu lượng/ngày còn lại sẽ hiển thị dưới dạng cấu hình SOCKS ảo riêng ở trên cùng, và đăng ký hết hạn/hết dung lượng chỉ trả về cấu hình trạng thái.",
|
||||
"subExpiredTemplate": "Mẫu hết hạn",
|
||||
|
|
|
|||
|
|
@ -1641,6 +1641,8 @@
|
|||
},
|
||||
"subCalendarExpireInclusive": "订阅到期日期显示为月底",
|
||||
"subCalendarExpireInclusiveDesc": "默认关闭。对于按每月 1 日续期、且到期时间为面板时区午夜的客户端,订阅到期时间报告为上月最后一秒。真实截止时间和续期不变。客户端使用自身时区,可能提前一秒显示过期。",
|
||||
"subHwidRejectWithConfig": "HWID 被拒绝时替换配置",
|
||||
"subHwidRejectWithConfigDesc": "缺少 HWID 或达到设备上限时,返回 HTTP 200 和不可用节点,而非 404。兼容的应用可在更新时替换已保存的节点;已复制的配置仍然有效。删除设备会释放名额,但不会永久封禁该设备。",
|
||||
"subInfoNodeEnable": "独立信息配置 / 提示节点",
|
||||
"subInfoNodeEnableDesc": "启用后,备注及剩余流量/天数将作为单独的 SOCKS 提示配置显示在顶部;过期或流量耗尽时仅返回状态提示。",
|
||||
"subExpiredTemplate": "过期提示模板",
|
||||
|
|
|
|||
|
|
@ -1641,6 +1641,8 @@
|
|||
},
|
||||
"subCalendarExpireInclusive": "訂閱到期日期顯示為月底",
|
||||
"subCalendarExpireInclusiveDesc": "預設關閉。對於按每月 1 日續期、且到期時間為面板時區午夜的用戶端,訂閱到期時間回報為上月最後一秒。真實截止時間和續期不變。用戶端使用自身時區,可能提前一秒顯示過期。",
|
||||
"subHwidRejectWithConfig": "HWID 被拒絕時取代設定",
|
||||
"subHwidRejectWithConfigDesc": "缺少 HWID 或達到裝置上限時,回傳 HTTP 200 和無法使用的節點,而非 404。相容的應用程式可在更新時取代已儲存的節點;已複製的設定仍然有效。刪除裝置會釋出名額,但不會永久封鎖該裝置。",
|
||||
"subInfoNodeEnable": "獨立資訊配置 / 提示節點",
|
||||
"subInfoNodeEnableDesc": "啟用後,備註及剩餘流量/天數將作為單獨的 SOCKS 提示配置顯示在頂部;過期或流量耗盡時僅返回狀態提示。",
|
||||
"subExpiredTemplate": "過期提示範本",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue