add check context events
This commit is contained in:
@@ -13,6 +13,8 @@ public class ApiServer(string apiUrl) : IApiServer
|
||||
protected readonly HttpListener httpListener = new();
|
||||
|
||||
public event OnCheckAuthenticationEventHandler? OnCheckAuthentication;
|
||||
public event OnCheckContextEventHandler? OnCheckContext;
|
||||
public event OnCheckContextEventHandler? OnCheckContextCompleted;
|
||||
|
||||
protected record PrivateApiResult(ApiResult Original, string? ResultJson);
|
||||
|
||||
@@ -104,6 +106,7 @@ public class ApiServer(string apiUrl) : IApiServer
|
||||
Receive();
|
||||
|
||||
// Check context
|
||||
OnCheckContext?.Invoke(this, new(context));
|
||||
try
|
||||
{
|
||||
CheckContext(context);
|
||||
@@ -114,6 +117,10 @@ public class ApiServer(string apiUrl) : IApiServer
|
||||
if (DebugMode)
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
OnCheckContextCompleted?.Invoke(this, new(context));
|
||||
}
|
||||
|
||||
// Listen for new request
|
||||
if (!AllowMultipleRequests)
|
||||
|
||||
Reference in New Issue
Block a user