| @@ -57,6 +57,7 @@ if (app.Environment.IsDevelopment()) | |||
| } | |||
| else | |||
| { | |||
| 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. | |||
| app.UseHsts(); | |||
| @@ -86,4 +87,4 @@ app.MapCodeFirstGrpcReflectionService(); | |||
| app.MapFallbackToFile("index.html"); | |||
| app.Run(); | |||
| app.Run("http://127.0.0.1:5002"); | |||
| @@ -18,7 +18,7 @@ namespace SpotifyWorker | |||
| { | |||
| _logger = logger; | |||
| // 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) | |||
| //{ | |||
| @@ -68,7 +68,8 @@ namespace SpotifyWorker | |||
| await Task.Delay(5000, stoppingToken); | |||
| 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) | |||
| @@ -7,7 +7,8 @@ namespace SpotifyService | |||
| public const String MEDIATYPE = "application/json"; | |||
| public const string CLIENT_ID = "83e1d09876b049c4bb1953185a4b3bfb"; | |||
| 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"; | |||
| /* | |||
| "ClientId": "83e1d09876b049c4bb1953185a4b3bfb", | |||
| @@ -13,13 +13,13 @@ var builder = WebApplication.CreateBuilder(args); | |||
| #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 | |||
| @@ -13,7 +13,7 @@ | |||
| }, | |||
| "AuthParams": { | |||
| "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", | |||
| "ClientSecret": "ea752433d0774fad87fab5c1ee788c8d" | |||
| } | |||