Refactor client update handling to support nullable parameters for name and expiration
- Updated the `UpdateClientAsync` method in `IXuiPanelGateway` to accept nullable parameters for `name` and `expiresAt`, allowing for more flexible client management without unintended modifications. - Adjusted the `BlockUserCommandHandler`, `UnblockUserCommandHandler`, and other related command handlers to utilize the new nullable parameters, ensuring that client names remain unchanged during block/unblock operations and that expiration dates are managed correctly. - Enhanced the billing and configuration handling to reflect the new logic for managing client states based on expiration rather than enabling/disabling, improving reliability in client status management. - Updated tests to cover the new behavior and ensure proper functionality across the application.
This commit is contained in:
@@ -47,13 +47,18 @@ internal static class BillingConfigResumer
|
||||
|
||||
if (inbound is not null && node is not null)
|
||||
{
|
||||
// Возвращаем через expiryTime = новый newPaidUntil, а не enable:true — тот же
|
||||
// механизм приостановки, что и у BillingService (см. IXuiPanelGateway.UpdateClientAsync):
|
||||
// переписываем просроченную дату на настоящую, панель/Xray сами перестают считать
|
||||
// клиента истёкшим. name: null — не переименовываем клиента.
|
||||
var updateResult = await gateway.UpdateClientAsync(
|
||||
node,
|
||||
inbound.RemoteInboundId,
|
||||
config.ClientExternalId,
|
||||
config.Protocol,
|
||||
config.Label ?? config.ClientEmail,
|
||||
enable: true,
|
||||
name: null,
|
||||
enable: null,
|
||||
expiresAt: newPaidUntil,
|
||||
cancellationToken
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user