| } | } | ||||
| else | else | ||||
| { | { | ||||
| app.UseExceptionHandler("/Error"); | app.UseExceptionHandler("/Error"); | ||||
| // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. | ||||
| app.UseHsts(); | app.UseHsts(); | ||||
| app.MapFallbackToFile("index.html"); | app.MapFallbackToFile("index.html"); | ||||
| app.Run(); | |||||
| app.Run("http://127.0.0.1:5002"); |
| { | { | ||||
| _logger = logger; | _logger = logger; | ||||
| // AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); | // AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); | ||||
| _serviceClient = GrpcChannel.ForAddress("https://localhost:5051/").CreateGrpcService<IStatsService>(); | |||||
| _serviceClient = GrpcChannel.ForAddress("https://localhost:5001/").CreateGrpcService<IStatsService>(); | |||||
| } | } | ||||
| //public override Task StartAsync(CancellationToken cancellationToken) | //public override Task StartAsync(CancellationToken cancellationToken) | ||||
| //{ | //{ | ||||
| await Task.Delay(5000, stoppingToken); | await Task.Delay(5000, stoppingToken); | ||||
| try | try | ||||
| { | { | ||||
| var res = await _serviceClient.GetCurrentlyPlayingTrack(new GrpcShared.DTO.SessionMessage { UserId = "6308a8bfc731f7b44d76ac4e" }); | |||||
| var res = await _serviceClient.GetCurrentlyPlayingTrack(new GrpcShared.DTO.SessionMessage { UserId = "630ddbad89698131d98dc0fd" }); | |||||
| Console.WriteLine(res.Item!.Name); | |||||
| } | } | ||||
| catch (RpcException e) | catch (RpcException e) |
| public const String MEDIATYPE = "application/json"; | public const String MEDIATYPE = "application/json"; | ||||
| public const string CLIENT_ID = "83e1d09876b049c4bb1953185a4b3bfb"; | public const string CLIENT_ID = "83e1d09876b049c4bb1953185a4b3bfb"; | ||||
| public const string SECRET = "ea752433d0774fad87fab5c1ee788c8d"; | public const string SECRET = "ea752433d0774fad87fab5c1ee788c8d"; | ||||
| public const string REDIRECT_URI = "http://localhost:5051/callback"; | |||||
| //public const string REDIRECT_URI = "http://localhost:5051/callback"; | |||||
| public const string REDIRECT_URI = "https://localhost:5001/callback"; | |||||
| public const string SCOPE = "user-read-currently-playing user-read-email user-library-modify user-top-read user-read-private"; | public const string SCOPE = "user-read-currently-playing user-read-email user-library-modify user-top-read user-read-private"; | ||||
| /* | /* | ||||
| "ClientId": "83e1d09876b049c4bb1953185a4b3bfb", | "ClientId": "83e1d09876b049c4bb1953185a4b3bfb", |
| #if DEBUG | #if DEBUG | ||||
| builder.WebHost.ConfigureKestrel(options => | |||||
| { | |||||
| options.ListenLocalhost(5050, o => o.Protocols = | |||||
| HttpProtocols.Http2); | |||||
| options.ListenLocalhost(5051, o => o.Protocols = | |||||
| HttpProtocols.Http1AndHttp2); | |||||
| }); | |||||
| //builder.WebHost.ConfigureKestrel(options => | |||||
| //{ | |||||
| // options.ListenLocalhost(5050, o => o.Protocols = | |||||
| // HttpProtocols.Http2); | |||||
| // options.ListenLocalhost(5051, o => o.Protocols = | |||||
| // HttpProtocols.Http1AndHttp2); | |||||
| //}); | |||||
| #endif | #endif | ||||
| }, | }, | ||||
| "AuthParams": { | "AuthParams": { | ||||
| "ClientId": "83e1d09876b049c4bb1953185a4b3bfb", | "ClientId": "83e1d09876b049c4bb1953185a4b3bfb", | ||||
| "RedirectURI": "http://localhost:5051/callback", | |||||
| "RedirectURI": "https://localhost:5001/callback", | |||||
| "Scope": "user-read-currently-playing user-read-email user-library-modify user-top-read user-read-private", | "Scope": "user-read-currently-playing user-read-email user-library-modify user-top-read user-read-private", | ||||
| "ClientSecret": "ea752433d0774fad87fab5c1ee788c8d" | "ClientSecret": "ea752433d0774fad87fab5c1ee788c8d" | ||||
| } | } |