Commit Graph
2 Commits
  • 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>
  • fix(clients): persist all editable fields for clients with no inbound (#6053)
    ClientService.Update only wrote most editable fields to the clients table
    inside the per-inbound loop (UpdateInboundClient -> SyncInbound), so a
    client with no attached inbound — the external-links / remote-
    subscription client — silently dropped subId, totalGB, expiryTime,
    limitIp, tgId, comment, reset, flow, security and the credential fields
    on edit. Update still returned success, so the panel showed a saved
    toast while the row was untouched. email/enable/group_name/ad_tag/reverse
    already had dedicated unconditional direct writes that covered the
    no-inbound case; the rest did not.
    
    This was a known failure shape: commit c4448f4e added the no-inbound
    fallback for email only, and TestUpdate_PersistsRecordEnable_NoInbound
    covered enable only — both stayed scoped to a single field.
    
    Extract SyncInbound's per-row field merge into applyClientRecordMerge
    (unconditional for scalar quota/lifecycle/subscription fields,
    preserve-when-empty for credentials/identifiers, earliest CreatedAt)
    and reuse it from Update. Update's new branch runs only when the client
    has no inbound, so it fixes the gap without altering the inbound-attached
    path (where flow is per-inbound gated via clientWithInboundFlow and
    SyncInbound already persists every field). email/reverse/group/ad_tag/
    enable keep their existing dedicated writes; the new write covers the
    remaining columns.
    
    Fixes #5981