Add Telegram bot integration and enhance user management features
- Introduced Telegram.Bot package for bot functionality. - Updated user management to include Telegram linking and blocking features. - Enhanced activation request handling with notifications via Telegram. - Added new database entities for Telegram link tokens and login requests. - Implemented traffic synchronization for client stats in the XuiPanelGateway. - Updated application structure to support new test projects and improved dependency injection for Telegram services.
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
using PnvPanel.Application.Common.Interfaces;
|
||||
using PnvPanel.Application.Common.Models;
|
||||
using PnvPanel.Domain.Inbounds;
|
||||
using PnvPanel.Domain.Nodes;
|
||||
|
||||
namespace PnvPanel.IntegrationTests.TestSupport;
|
||||
|
||||
/// <summary>
|
||||
/// Заглушка 3x-ui для интеграционных тестов — реальной панели нет. Возвращает успех для проб/CRUD
|
||||
/// клиентов, отдаёт один синтетический inbound на ноду для сценариев с SyncNode.
|
||||
/// </summary>
|
||||
public sealed class FakeXuiPanelGateway : IXuiPanelGateway
|
||||
{
|
||||
public Result ValidateBaseAddress(Uri baseAddress) => Result.Success();
|
||||
|
||||
public Task<NodeProbeResult> ProbeAsync(Node node, CancellationToken cancellationToken)
|
||||
=> Task.FromResult(new NodeProbeResult(true, null));
|
||||
|
||||
public Task<Result<IReadOnlyList<RemoteInboundInfo>>> ListInboundsAsync(Node node, CancellationToken cancellationToken)
|
||||
{
|
||||
IReadOnlyList<RemoteInboundInfo> inbounds =
|
||||
[
|
||||
new RemoteInboundInfo("1", VpnProtocol.Vless, "Test inbound", 443),
|
||||
];
|
||||
|
||||
return Task.FromResult(Result.Success(inbounds));
|
||||
}
|
||||
|
||||
public void InvalidateClient(Guid nodeId)
|
||||
{
|
||||
}
|
||||
|
||||
public Task<Result<string>> AddClientAsync(
|
||||
Node node, string inboundRemoteId, VpnProtocol protocol, string clientEmail, string clientName,
|
||||
int deviceLimit, CancellationToken cancellationToken)
|
||||
=> Task.FromResult(Result.Success(Guid.NewGuid().ToString()));
|
||||
|
||||
public Task<Result> RemoveClientAsync(
|
||||
Node node, string inboundRemoteId, string clientExternalId, VpnProtocol protocol, CancellationToken cancellationToken)
|
||||
=> Task.FromResult(Result.Success());
|
||||
|
||||
public Task<Result> UpdateClientAsync(
|
||||
Node node, string inboundRemoteId, string clientExternalId, VpnProtocol protocol,
|
||||
string name, int deviceLimit, bool enable, CancellationToken cancellationToken)
|
||||
=> Task.FromResult(Result.Success());
|
||||
|
||||
public Task<Result<string>> BuildConnectionStringAsync(
|
||||
Node node, Inbound inbound, string clientExternalId, string clientName, string publicHost, CancellationToken cancellationToken)
|
||||
=> Task.FromResult(Result.Success("vless://fake-connection-string"));
|
||||
|
||||
public Task<Result<IReadOnlyDictionary<string, ClientTrafficInfo>>> GetClientTrafficAsync(
|
||||
Node node, string inboundRemoteId, CancellationToken cancellationToken)
|
||||
{
|
||||
IReadOnlyDictionary<string, ClientTrafficInfo> traffic = new Dictionary<string, ClientTrafficInfo>();
|
||||
return Task.FromResult(Result.Success(traffic));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user