// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IRunner runner, CodeGolfContext codeGolfContext) { 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(); } var minifiedGAScriptHash = "qEShyXJhwl9qHYlR7p7AwHlpnpEclnzFsPGivkRFOzM="; app.UseSecurityHeaders( policies => policies.AddDefaultSecurityHeaders() .AddStrictTransportSecurityMaxAgeIncludeSubDomains(maxAgeInSeconds: 63072000) .AddContentSecurityPolicy( b => { b.AddDefaultSrc().Self(); var scripts = b.AddScriptSrc().Self().From("https://www.google.com") .From("https://www.googletagmanager.com").From("https://www.gstatic.com") .From("https://www.google-analytics.com") .WithHash256("fJYxG/MUxs9b4moaAfLG0e5TxMp0nppc6ulRT3MfHLU=") .WithHash256(minifiedGAScriptHash); if (env.IsDevelopment()) { scripts.UnsafeEval(); } b.AddImgSrc().Self().From("https://www.google-analytics.com") .From("https://*.githubusercontent.com"); b.AddFrameSource().Self().From("https://www.google.com"); b.AddStyleSrc().Self().UnsafeInline().Blob(); b.AddConnectSrc().Self().From("https://localhost:8080"); })); app.UseForwardedHeaders( new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto, }); app.UseHttpsRedirection(); var sfOptions = new StaticFileOptions { OnPrepareResponse = r => { var path = r.File.PhysicalPath; var cacheExtensions = new[] { ".css", ".js", ".gif", ".jpg", ".png", ".svg", ".ico", ".json" }; if (cacheExtensions.Any(path.EndsWith)) { var maxAge = TimeSpan.FromDays(7); r.Context.Response.Headers.Add( "Cache-Control", "max-age=" + maxAge.TotalSeconds.ToString("0")); } } }; app.UseStaticFiles(); app.UseSpaStaticFiles(sfOptions); app.UseAuthentication(); app.UseWebMarkupMin(); app.UseCookiePolicy(); app.UseSignalR(routes => { routes.MapHub <RefreshHub>("/refreshHub"); }); app.UseMvc(); app.UseSpa( spa => { spa.Options.SourcePath = "ClientApp/codeGolf/"; if (env.IsDevelopment()) { // run npm process with client app // spa.UseReactDevelopmentServer(npmScript: "start:development"); // if you just prefer to proxy requests from client app, use proxy to SPA dev server instead: // app should be already running before starting a .NET client spa.UseProxyToSpaDevelopmentServer("http://localhost:8080"); // your Vue app port } }); codeGolfContext.SeedDatabase(); runner.WakeUpCompiler(CancellationToken.None); }
public UserRepository(CodeGolfContext context) { this.context = context; }
public static void InitializeDbForTests(CodeGolfContext db) { }
public HoleRepository(CodeGolfContext context) { this.context = context; }
public AttemptRepository(CodeGolfContext context) { this.context = context; }