public ThumbNailerShould() { this.thumbNailer = new ThumbNailer.ThumbNailer(this.mockConfig.GetThumbNailerSettings()); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILogger <Startup> logger, IThumbNailer thumbNailer, ForumContext forumContext) { if (env.IsDevelopment()) { /////app.UseBrowserLink(); app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(a => a.MaxAge(365)); } app.UseForwardedHeaders(new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto }); var google = "https://www.google.com"; app.UseCsp(a => a. DefaultSources(b => b.Self()). ImageSources(c => c.Self().CustomSources("data:")). StyleSources(c => c.Self().UnsafeInline()). ScriptSources(s => s.Self().CustomSources(google, "https://www.gstatic.com")). FrameSources(c => c.Self().CustomSources(google))); app.UseXContentSecurityPolicy(); app.UseReferrerPolicy(opts => opts.NoReferrer()); app.UseStaticFiles(new StaticFileOptions() { OnPrepareResponse = r => { var path = r.File.PhysicalPath; var cacheExtensions = new[] { ".css", ".js", ".gif", ".jpg", ".png", ".svg" }; if (cacheExtensions.Any(path.EndsWith)) { var maxAge = TimeSpan.FromDays(7); r.Context.Response.Headers.Add("Cache-Control", "max-age=" + maxAge.TotalSeconds.ToString("0")); } } }); app.UseXfo(options => options.Deny()); app.UseXXssProtection(options => options.EnabledWithBlockMode()); app.UseXContentTypeOptions(); app.UseXDownloadOptions(); app.UseRedirectValidation(); app.UseAnalyticsMiddleware(); app.UseExpectCt(); app.UseMvc(); forumContext.SeedData().Wait(); if (!thumbNailer.IsSettingValid()) { logger.LogInformation("cannot locate FFMPEG executable."); } }
public UploadMapper(IThumbNailer thumbNailer) { this.thumbNailer = thumbNailer; }