Skip to content

Commit 49a24d3

Browse files
committed
Fixed trailing whitespace
1 parent 4450d62 commit 49a24d3

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

src/ElectronNET.API/Runtime/Helpers/UnpackagedDetector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static bool CheckIsUnpackaged()
6565
{
6666
var baseDir = AppDomain.CurrentDomain.BaseDirectory;
6767
var dir = new DirectoryInfo(baseDir);
68-
68+
6969
if (dir.Name == "bin" && dir.Parent?.Name == "resources")
7070
{
7171
return false;

src/ElectronNET.AspNet/API/WebHostBuilderExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ public static IWebHostBuilder UseElectron(this IWebHostBuilder builder, string[]
7474
// check for the content folder if its exists in base director otherwise no need to include
7575
// It was used before because we are publishing the project which copies everything to bin folder and contentroot wwwroot was folder there.
7676
// now we have implemented the live reload if app is run using /watch then we need to use the default project path.
77-
77+
7878
// For port 0 (dynamic port assignment), Kestrel requires binding to specific IP (127.0.0.1) not localhost
7979
var host = "localhost";
80-
80+
8181
if (Directory.Exists($"{AppDomain.CurrentDomain.BaseDirectory}\\wwwroot"))
8282
{
8383
builder = builder.UseContentRoot(AppDomain.CurrentDomain.BaseDirectory)

src/ElectronNET.AspNet/Middleware/ElectronAuthenticationMiddleware.cs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class ElectronAuthenticationMiddleware
2525
private const string AuthCookieName = "ElectronAuth";
2626

2727
public ElectronAuthenticationMiddleware(
28-
RequestDelegate next,
28+
RequestDelegate next,
2929
IElectronAuthenticationService authService,
3030
ILogger<ElectronAuthenticationMiddleware> logger)
3131
{
@@ -37,10 +37,10 @@ public ElectronAuthenticationMiddleware(
3737
public async Task InvokeAsync(HttpContext context)
3838
{
3939
var path = context.Request.Path.Value;
40-
40+
4141
// Check if authentication cookie exists
4242
var authCookie = context.Request.Cookies[AuthCookieName];
43-
43+
4444
if (!string.IsNullOrEmpty(authCookie))
4545
{
4646
// Cookie present - validate it
@@ -52,8 +52,7 @@ public async Task InvokeAsync(HttpContext context)
5252
else
5353
{
5454
// Invalid cookie - reject
55-
_logger.LogWarning("Authentication failed: Invalid cookie for path {Path} from {RemoteIp}",
56-
path, context.Connection.RemoteIpAddress);
55+
_logger.LogWarning("Authentication failed: Invalid cookie for path {Path} from {RemoteIp}", path, context.Connection.RemoteIpAddress);
5756
context.Response.StatusCode = 401;
5857
await context.Response.WriteAsync("Unauthorized: Invalid authentication");
5958
return;
@@ -62,14 +61,14 @@ public async Task InvokeAsync(HttpContext context)
6261

6362
// No cookie - check for token in query string (first-time authentication)
6463
var token = context.Request.Query["token"].ToString();
65-
64+
6665
if (!string.IsNullOrEmpty(token))
6766
{
6867
if (_authService.ValidateToken(token))
6968
{
7069
// Valid token - set cookie for future requests
7170
_logger.LogInformation("Authentication successful: Setting cookie for path {Path}", path);
72-
71+
7372
context.Response.Cookies.Append(AuthCookieName, token, new CookieOptions
7473
{
7574
HttpOnly = true, // Prevent JavaScript access (XSS protection)
@@ -78,24 +77,22 @@ public async Task InvokeAsync(HttpContext context)
7877
Secure = false, // False because localhost is HTTP
7978
IsEssential = true // Required for app to function
8079
});
81-
80+
8281
await _next(context);
8382
return;
8483
}
8584
else
8685
{
8786
// Invalid token - reject
88-
_logger.LogWarning("Authentication failed: Invalid token (prefix: {TokenPrefix}...) for path {Path} from {RemoteIp}",
89-
token.Length > 8 ? token.Substring(0, 8) : token, path, context.Connection.RemoteIpAddress);
87+
_logger.LogWarning("Authentication failed: Invalid token (prefix: {TokenPrefix}...) for path {Path} from {RemoteIp}", token.Length > 8 ? token.Substring(0, 8) : token, path, context.Connection.RemoteIpAddress);
9088
context.Response.StatusCode = 401;
9189
await context.Response.WriteAsync("Unauthorized: Invalid authentication");
9290
return;
9391
}
9492
}
9593

9694
// Neither cookie nor valid token present - reject
97-
_logger.LogWarning("Authentication failed: No cookie or token provided for path {Path} from {RemoteIp}",
98-
path, context.Connection.RemoteIpAddress);
95+
_logger.LogWarning("Authentication failed: No cookie or token provided for path {Path} from {RemoteIp}", path, context.Connection.RemoteIpAddress);
9996
context.Response.StatusCode = 401;
10097
await context.Response.WriteAsync("Unauthorized: Authentication required");
10198
}

src/ElectronNET.Samples.BlazorSignalR/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
options.AutoHideMenuBar = true;
5656

5757
var browserWindow = await Electron.WindowManager.CreateWindowAsync(options);
58-
58+
5959
browserWindow.OnReadyToShow += () => browserWindow.Show();
6060
});
6161

0 commit comments

Comments
 (0)