using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.StaticFiles; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace webmusic { public class Startup { // This method gets called by the runtime. Use this method to add services to the container. public static void ConfigureServices(IServiceCollection services) { services.Configure(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.Configure(options => { options.EnableEndpointRouting = false; }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Latest); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public static void Configure(IApplicationBuilder app, IWebHostEnvironment env) { var provider = new FileExtensionContentTypeProvider(); provider.Mappings[".flac"] = "audio/flac"; provider.Mappings[".m3u"] = "audio/m3u"; provider.Mappings[".opus"] = "audio/opus"; if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } 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(); } app.UseStaticFiles(new StaticFileOptions {ContentTypeProvider = provider}); app.UseCookiePolicy(); app.UseMvc(); } } }