feat(sub): add per-client subscription HWID limits (#5802)

* feat(sub): add per-client subscription HWID limits

* fix(sub): address HWID review on shared subId and bulk create

* fix(sub): store HWID devices by sub_id and drop anchor client workaround

* fix(sub): restore UA auto-detect and HTML page routing in subs()

The cherry-pick of the HWID gate onto main's refactored SUBController
had dropped main's UA-based format auto-detection and sub-page handling
from subs(). Restore those branches, slotting enforceHwid after the
HTML page and before format detection so the gate only applies to
machine-readable subscription bodies.

Also adapt tests to main's options-struct constructor and to the
ClientService.Update signature extended with limitHwid.

* fix(frontend): drop axios from HttpUtil.delete

The bulk-delete rework's committed version still referenced axios,
which this file no longer imports, breaking typecheck in CI. Use the
httpRequest wrapper like the other verbs.

---------

Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
This commit is contained in:
Rouzbeh†
2026-08-15 18:20:20 +03:30
committed by GitHub
parent 1793a9b8b4
commit 694ad6deae
45 changed files with 1212 additions and 50 deletions
@@ -60,7 +60,7 @@ func TestUpdateInboundClientCaseOnlyRenameDoesNotDuplicateRecord(t *testing.T) {
updated := source[0]
updated.Email = "Test"
if _, err := svc.Update(inboundSvc, origId, updated); err != nil {
if _, err := svc.Update(inboundSvc, origId, updated, 0); err != nil {
t.Fatalf("Update case-only email: %v", err)
}
@@ -132,7 +132,7 @@ func TestClientUpdateDuplicateSubIDDoesNotRenameEmail(t *testing.T) {
updated := source[0]
updated.Email = "kept@x"
updated.SubID = "sub-other"
if _, err := svc.Update(inboundSvc, origId, updated); err == nil {
if _, err := svc.Update(inboundSvc, origId, updated, 0); err == nil {
t.Fatalf("Update with colliding subId succeeded, want error")
}
@@ -165,7 +165,7 @@ func TestClientUpdateKeepsSharedSubIDEditable(t *testing.T) {
updated := source[0]
updated.TotalGB = 42
if _, err := svc.Update(inboundSvc, first.Id, updated); err != nil {
if _, err := svc.Update(inboundSvc, first.Id, updated, 0); err != nil {
t.Fatalf("Update of a client whose subId is already shared: %v", err)
}
if got := lookupClientRecord(t, "a@node").TotalGB; got != 42 {
@@ -175,7 +175,7 @@ func TestClientUpdateKeepsSharedSubIDEditable(t *testing.T) {
omitted := source[0]
omitted.SubID = ""
omitted.TotalGB = 43
if _, err := svc.Update(inboundSvc, first.Id, omitted); err != nil {
if _, err := svc.Update(inboundSvc, first.Id, omitted, 0); err != nil {
t.Fatalf("Update with subId omitted entirely: %v", err)
}
other := lookupClientRecord(t, "b@node")