Skip to content

Commit

Permalink
shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
immisterio committed Jan 1, 2023
1 parent 6266ba8 commit 5953a00
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 0 additions & 6 deletions Engine/Middlewares/Accs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ public Task Invoke(HttpContext httpContext)
return _next(httpContext);
#endregion

#region Методы работающие без авторизации
if (httpContext.Request.Path.Value.StartsWith("/shutdown"))
return httpContext.Response.WriteAsync("");
#endregion


if (Startup.settings.AuthorizationRequired)
{
#region Авторизация по домену
Expand Down
9 changes: 9 additions & 0 deletions Engine/Middlewares/TorAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ async public Task InvokeAsync(HttpContext httpContext)

var userData = httpContext.Features.Get<UserData>();

if (!userData.shutdown && httpContext.Request.Path.Value.StartsWith("/shutdown"))
return;

string dbKeyOrLogin = userData.login;
if (userData.IsShared)
dbKeyOrLogin = $"{userData.login}:{httpContext.Connection.RemoteIpAddress}";
Expand Down Expand Up @@ -280,6 +283,12 @@ async public Task InvokeAsync(HttpContext httpContext)
await CopyProxyHttpResponse(httpContext, response, info);
}
#endregion

if (httpContext.Request.Path.Value.StartsWith("/shutdown"))
{
db.TryRemove(dbKeyOrLogin, out _);
info.Dispose();
}
}


Expand Down
3 changes: 3 additions & 0 deletions Models/UserData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class UserData
[JsonIgnore]
public bool IsShared { get; set; }

[JsonIgnore]
public bool shutdown { get; set; }

[JsonIgnore]
public byte maxiptoIsLockHostOrUser { get; set; }
}
Expand Down

0 comments on commit 5953a00

Please sign in to comment.