From 02ea60a0c5809b4f5c0465cb95a433efbfa02065 Mon Sep 17 00:00:00 2001 From: kastov Date: Wed, 25 Feb 2026 16:18:12 +0300 Subject: [PATCH 1/2] fix: update default value for includeHiddenHosts in Mihomo generator service --- .../generators/mihomo.generator.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/subscription-template/generators/mihomo.generator.service.ts b/src/modules/subscription-template/generators/mihomo.generator.service.ts index 3d1fec49..dd4ad201 100644 --- a/src/modules/subscription-template/generators/mihomo.generator.service.ts +++ b/src/modules/subscription-template/generators/mihomo.generator.service.ts @@ -72,7 +72,7 @@ export class MihomoGeneratorService { const yamlConfig = yamlConfigDb as unknown as any; const { remnawave, ...cleanConfig } = yamlConfig ?? {}; - const includeHidden = remnawave?.includeHiddenHosts ?? true; + const includeHidden = remnawave?.includeHiddenHosts ?? false; const data: ClashData = { proxies: [], From dd4fbbad18b88fa5a8ee6bce51c374203dd6989e Mon Sep 17 00:00:00 2001 From: this-xkit Date: Tue, 3 Mar 2026 21:26:22 +0300 Subject: [PATCH 2/2] feat: send x-hwid-limit header with false value when HWID is active and limit not reached Previously x-hwid-limit was only sent as 'true' when the device limit was exceeded. Now the header has three states: - absent: HWID control is not active for this subscription - 'false': HWID control is active, new device registered, limit not reached - 'true': HWID control is active, limit reached or client doesn't support HWID Added isNewDevice field to checkHwidDeviceLimit return type to distinguish new device registration from existing device lookups. --- .../subscription/subscription.service.ts | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/modules/subscription/subscription.service.ts b/src/modules/subscription/subscription.service.ts index 5bf0f105..6d05014f 100644 --- a/src/modules/subscription/subscription.service.ts +++ b/src/modules/subscription/subscription.service.ts @@ -145,6 +145,8 @@ export class SubscriptionService { const subscriptionSettings = srrContext.subscriptionSettings; + let hwidLimitHeader: string | undefined; + if (subscriptionSettings.hwidSettings.enabled) { const isAllowed = await this.checkHwidDeviceLimit( user.response, @@ -199,6 +201,10 @@ export class SubscriptionService { return response; } + + if (isAllowed.isOk && isAllowed.response.isNewDevice) { + hwidLimitHeader = 'false'; // v2rayTUN + } } else { await this.checkAndUpsertHwidUserDevice(user.response, hwidHeaders); } @@ -243,12 +249,18 @@ export class SubscriptionService { hostsOverrides, }); + const headers = await this.getUserProfileHeadersInfo( + user.response, + isXrayExtSupported, + subscriptionSettings, + ); + + if (hwidLimitHeader !== undefined) { + headers['x-hwid-limit'] = hwidLimitHeader; + } + return new SubscriptionWithConfigResponse({ - headers: await this.getUserProfileHeadersInfo( - user.response, - isXrayExtSupported, - subscriptionSettings, - ), + headers, body: subscription.subscription, contentType: subscription.contentType, }); @@ -321,6 +333,10 @@ export class SubscriptionService { isHwidLimited = true; } + + if (isAllowed.isOk && isAllowed.response.isNewDevice) { + headers['x-hwid-limit'] = 'false'; // v2rayTUN + } } else { await this.checkAndUpsertHwidUserDevice(user, hwidHeaders); @@ -778,6 +794,7 @@ export class SubscriptionService { isSubscriptionAllowed: boolean; maxDeviceReached: boolean; hwidNotSupported: boolean; + isNewDevice: boolean; }> > { try { @@ -796,6 +813,7 @@ export class SubscriptionService { isSubscriptionAllowed: true, maxDeviceReached: false, hwidNotSupported: false, + isNewDevice: false, }); } @@ -804,6 +822,7 @@ export class SubscriptionService { isSubscriptionAllowed: false, maxDeviceReached: false, hwidNotSupported: true, + isNewDevice: false, }); } @@ -827,6 +846,7 @@ export class SubscriptionService { isSubscriptionAllowed: true, maxDeviceReached: false, hwidNotSupported: false, + isNewDevice: false, }); } } @@ -840,6 +860,7 @@ export class SubscriptionService { isSubscriptionAllowed: false, maxDeviceReached: true, hwidNotSupported: false, + isNewDevice: false, }); } @@ -848,6 +869,7 @@ export class SubscriptionService { isSubscriptionAllowed: false, maxDeviceReached: true, hwidNotSupported: false, + isNewDevice: false, }); } @@ -871,6 +893,7 @@ export class SubscriptionService { isSubscriptionAllowed: false, maxDeviceReached: true, hwidNotSupported: false, + isNewDevice: false, }); } @@ -883,6 +906,7 @@ export class SubscriptionService { isSubscriptionAllowed: true, maxDeviceReached: false, hwidNotSupported: false, + isNewDevice: true, }); } catch (error) { this.logger.error(`Error checking hwid device limit: ${error}`); @@ -890,6 +914,7 @@ export class SubscriptionService { isSubscriptionAllowed: false, maxDeviceReached: true, hwidNotSupported: false, + isNewDevice: false, }); } }