Skip to content

Commit ef571f8

Browse files
authored
logging
1 parent 407474d commit ef571f8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Jellyfin.HardwareVisualizer/Server/Program.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,16 @@ string GetConnectionString()
7575
);
7676

7777
builder.Services.Configure<ForwardedHeadersOptions>(options =>
78-
{
79-
var envVar = Environment.GetEnvironmentVariables();
78+
{
8079
var hostingOptions = builder.Configuration.Get<HostingOptions>();
81-
8280
options.ForwardLimit = 2;
8381
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor;
82+
Console.WriteLine("Add Proxy Settings.");
8483
foreach(var proxy in hostingOptions.KnownProxies ?? [])
8584
{
85+
Console.WriteLine($"Add Proxy: {proxy}");
8686
options.KnownProxies.Add(IPAddress.Parse(proxy));
8787
}
88-
89-
options.ForwardedForHeaderName = "X-Forwarded-For";
9088
});
9189

9290

Jellyfin.HardwareVisualizer/Server/Services/SubmitToken/SubmitTokenService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Security.Claims;
33
using System.Security.Cryptography;
44
using System.Text;
5+
using Jellyfin.HardwareVisualizer.Client.Shared.ViewUtil;
56
using Microsoft.Extensions.Caching.Memory;
67
using ServiceLocator.Attributes;
78

@@ -72,8 +73,9 @@ public bool Validate(JwtPayload token, out TimeSpan? retryAfter)
7273
public (string? token, TimeSpan? retryAfter) GenerateToken()
7374
{
7475
var ipAddress = _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString();
76+
_httpContextAccessor.HttpContext.Request.Headers.TryGetValue("X-Forwarded-For", out var value);
7577

76-
_logger.LogInformation($"Ip {ipAddress} requested a new Token.");
78+
_logger.LogInformation($"Ip {ipAddress} requested a new Token with {value}.");
7779

7880
var cacheKey = "ip-token-" + ipAddress;
7981
if (_memoryCache.TryGetValue<TokenStore>(cacheKey, out var tokenStore)

0 commit comments

Comments
 (0)