feat: отправка x-hwid-limit: false когда HWID активен и лимит не достигнут#143
feat: отправка x-hwid-limit: false когда HWID активен и лимит не достигнут#143this-xkit wants to merge 29 commits intoremnawave:devfrom
Conversation
Merge pull request remnawave#110 from remnawave/dev
Merge pull request remnawave#112 from remnawave/dev
Merge pull request remnawave#120 from remnawave/dev
Merge pull request remnawave#126 from remnawave/dev
Merge pull request remnawave#127 from remnawave/dev
Merge pull request remnawave#128 from remnawave/dev
Merge pull request remnawave#129 from remnawave/dev
…nd 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.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
PR Summary
|
Greptile SummaryThis PR extends the However, the PR modifies a second file that is not documented in the PR description: Key changes:
Confidence Score: 2/5
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Subscription request received] --> B{hwidSettings.enabled?}
B -- No --> C[checkAndUpsertHwidUserDevice\nskip header]
B -- Yes --> D[checkHwidDeviceLimit]
D --> E{isAllowed.isOk\n& !isSubscriptionAllowed?}
E -- Yes --> F[Set x-hwid-limit: 'true'\nearly return / isHwidLimited=true]
E -- No --> G{isAllowed.isOk\n& isNewDevice?}
G -- Yes --> H[Set x-hwid-limit: 'false']
G -- No --> I[No x-hwid-limit header\ne.g. known device or hwidDeviceLimit=0]
H --> J[Generate subscription & return response]
I --> J
C --> J
Last reviewed commit: dd4fbba |
|
|
||
| const { remnawave, ...cleanConfig } = yamlConfig ?? {}; | ||
| const includeHidden = remnawave?.includeHiddenHosts ?? true; | ||
| const includeHidden = remnawave?.includeHiddenHosts ?? false; |
There was a problem hiding this comment.
The default value for includeHiddenHosts has been changed from true to false on this line, but this breaking change is not mentioned in the PR description. The PR description states only subscription.service.ts is modified ("Один файл"), yet this file is also changed.
Mihomo/Stash users who have not explicitly set remnawave.includeHiddenHosts in their templates will silently lose hidden hosts from their subscriptions after this update — a breaking behavior change for existing deployments.
Please document this change in the PR description and consider whether existing users need migration guidance.
Что изменено
Расширена логика отправки HTTP-хедера
x-hwid-limitв ответе на запрос подписки.Раньше хедер отправлялся только со значением
trueпри превышении лимита устройств и когда клиент не отправил HWID. Теперь у хедера три состояния:falsetrueЧто затронуто
Один файл:
src/modules/subscription/subscription.service.tscheckHwidDeviceLimit()добавлено полеisNewDevice: booleanв тип возврата — чтобы отличить регистрацию нового устройства от уже известногоgetSubscriptionByShortUuid()— хедерx-hwid-limit: falseставится при успешной регистрации нового устройстваgetRawSubscriptionByShortUuid()— аналогичноЧто НЕ затронуто
SS_HWID_LIMIT— не измененаhwidDeviceLimit = 0— хедер отсутствует (как и раньше)Протестировано
Все сценарии проверены вручную на живом окружении:
true✅false✅true✅