// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApi api) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } App.Init(api); // Configure cache level App.CacheLevel = Piranha.Cache.CacheLevel.Full; // Build content types var pageTypeBuilder = new Piranha.AttributeBuilder.PageTypeBuilder(api) .AddType(typeof(Models.BlogArchive)) .AddType(typeof(Models.StandardPage)) .AddType(typeof(Models.TeaserPage)) .Build() .DeleteOrphans(); var postTypeBuilder = new Piranha.AttributeBuilder.PostTypeBuilder(api) .AddType(typeof(Models.BlogPost)) .Build() .DeleteOrphans(); var siteTypeBuilder = new Piranha.AttributeBuilder.SiteTypeBuilder(api) .AddType(typeof(Models.StandardSite)) .Build() .DeleteOrphans(); // Configure editor Piranha.Manager.Editor.EditorConfig.FromFile("editorconfig.json"); /** * * Test another culture in the UI * * var cultureInfo = new System.Globalization.CultureInfo("en-US"); * System.Globalization.CultureInfo.DefaultThreadCurrentCulture = cultureInfo; * System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = cultureInfo; */ // Register middleware app.UseStaticFiles(); app.UseAuthentication(); app.UsePiranha(); app.UsePiranhaManager(); app.UsePiranhaSummernote(); //app.UsePiranhaTinyMCE(); app.UseMvc(routes => { routes.MapRoute(name: "areaRoute", template: "{area:exists}/{controller}/{action}/{id?}", defaults: new { controller = "Home", action = "Index" }); routes.MapRoute( name: "default", template: "{controller=home}/{action=index}/{id?}"); }); Seed.RunAsync(api).GetAwaiter().GetResult(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApi api) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } App.Init(api); // Configure cache level App.CacheLevel = Piranha.Cache.CacheLevel.Full; // Build content types var pageTypeBuilder = new Piranha.AttributeBuilder.PageTypeBuilder(api) .AddType(typeof(Models.BlogArchive)) .AddType(typeof(Models.StandardPage)) .AddType(typeof(Models.TeaserPage)) .Build() .DeleteOrphans(); var postTypeBuilder = new Piranha.AttributeBuilder.PostTypeBuilder(api) .AddType(typeof(Models.BlogPost)) .Build() .DeleteOrphans(); var siteTypeBuilder = new Piranha.AttributeBuilder.SiteTypeBuilder(api) .AddType(typeof(Models.StandardSite)) .Build() .DeleteOrphans(); // Configure editor Piranha.Manager.Editor.EditorConfig.FromFile("editorconfig.json"); /** * * Test another culture in the UI * * var cultureInfo = new System.Globalization.CultureInfo("en-US"); * System.Globalization.CultureInfo.DefaultThreadCurrentCulture = cultureInfo; * System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = cultureInfo; */ // Register middleware app.UseStaticFiles(); app.UsePiranha(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UsePiranhaIdentity(); app.UsePiranhaManager(); app.UsePiranhaTinyMCE(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapPiranhaManager(); }); Seed.RunAsync(api).GetAwaiter().GetResult(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApi api) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); // app.UseCookiePolicy(); // Initialize Piranha App.Init(); // Configure cache level App.CacheLevel = Piranha.Cache.CacheLevel.Basic; // Build content types var pageTypeBuilder = new Piranha.AttributeBuilder.PageTypeBuilder(api) .AddType(typeof(BlogArchive)) .AddType(typeof(StandardPage)); pageTypeBuilder.Build() .DeleteOrphans(); var postTypeBuilder = new Piranha.AttributeBuilder.PostTypeBuilder(api) .AddType(typeof(BlogPost)); postTypeBuilder.Build() .DeleteOrphans(); var siteTypeBuilder = new Piranha.AttributeBuilder.SiteTypeBuilder(api) .AddType(typeof(BlogSite)); siteTypeBuilder.Build() .DeleteOrphans(); // Register middleware app.UseStaticFiles(); app.UseAuthentication(); app.UsePiranha(); app.UsePiranhaManager(); app.UseMvc(routes => { routes.MapRoute(name: "areaRoute", template: "{area:exists}/{controller}/{action}/{id?}", defaults: new { controller = "Home", action = "Index" }); routes.MapRoute( name: "default", template: "{controller=home}/{action=index}/{id?}"); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IServiceProvider services) { loggerFactory.AddConsole(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } // Initialize Piranha var api = services.GetService <IApi>(); App.Init(api); // Add custom blocks App.Blocks.Register <Models.Blocks.SliderGroup>(); App.Blocks.Register <Models.Blocks.SliderItem>(); // Build types var pageTypeBuilder = new Piranha.AttributeBuilder.PageTypeBuilder(api) .AddType(typeof(Models.BlogArchive)) .AddType(typeof(Models.StandardPage)) .AddType(typeof(Models.TeaserPage)); pageTypeBuilder.Build() .DeleteOrphans(); var postTypeBuilder = new Piranha.AttributeBuilder.PostTypeBuilder(api) .AddType(typeof(Models.BlogPost)); postTypeBuilder.Build() .DeleteOrphans(); var siteTypeBuilder = new Piranha.AttributeBuilder.SiteTypeBuilder(api) .AddType(typeof(Models.StandardSite)); siteTypeBuilder.Build() .DeleteOrphans(); // Register middleware app.UseStaticFiles(); app.UseAuthentication(); app.UsePiranha(); app.UsePiranhaManager(); app.UseMvc(routes => { routes.MapRoute(name: "areaRoute", template: "{area:exists}/{controller}/{action}/{id?}", defaults: new { controller = "Home", action = "Index" }); routes.MapRoute( name: "default", template: "{controller=home}/{action=index}/{id?}"); }); Seed(api); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider services, IApi api) { // Initialize Piranha App.Init(); // Configure cache level App.CacheLevel = Piranha.Cache.CacheLevel.Basic; // Build content types var pageTypeBuilder = new Piranha.AttributeBuilder.PageTypeBuilder(api) .AddType(typeof(Models.BlogArchive)) .AddType(typeof(Models.StandardPage)) .AddType(typeof(Models.LiveStreamsPage)) .AddType(typeof(Models.ChatPage)); pageTypeBuilder.Build() .DeleteOrphans(); var postTypeBuilder = new Piranha.AttributeBuilder.PostTypeBuilder(api) .AddType(typeof(Models.BlogPost)); postTypeBuilder.Build() .DeleteOrphans(); var siteTypeBuilder = new Piranha.AttributeBuilder.SiteTypeBuilder(api) .AddType(typeof(Models.BlogSite)); siteTypeBuilder.Build() .DeleteOrphans(); // Register middleware app.UseStaticFiles(); app.UseResponseCompression(); app.UseGlobalErrorHandler(true); app.UseCorrelationToken(); app.UseRequestLogging(); app.UsePerformanceLogging(settings.PerformaceWarningMinimumInMS); app.UseAuthentication(); app.UsePiranha(); app.UsePiranhaManager(); app.UseMvc(routes => { routes.MapRoute(name: "areaRoute", template: "{area:exists}/{controller}/{action}/{id?}", defaults: new { controller = "Home", action = "Index" }); routes.MapRoute( name: "default", template: "{controller=home}/{action=index}/{id?}"); }); logger.Debug($"Service started (v{Program.GetVersion})"); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApi api) { app.UseResponseCompression(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseSwagger(); // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), // specifying the Swagger JSON endpoint. app.UseSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "PiranhaCMS API V1"); }); } app.Use(async(context, next) => { await next(); if (context.Response.StatusCode == 404) { context.Request.Path = "/not-found"; await next(); } }); App.Init(api); // Configure cache level App.CacheLevel = Piranha.Cache.CacheLevel.Full; // Build content types var pageTypeBuilder = new Piranha.AttributeBuilder.PageTypeBuilder(api) .AddType(typeof(Models.TeaserPage)) .AddType(typeof(Models.IntroPage)) .AddType(typeof(Models.EnterprisePage)) .AddType(typeof(Models.HelpPage)) .AddType(typeof(Models.DocumentPage)) .AddType(typeof(Models.NewsPage)) .AddType(typeof(Models.BondsPage)) .AddType(typeof(Models.PageNotFound)) .AddType(typeof(Models.SearchPage)) .Build() .DeleteOrphans(); var postTypeBuilder = new Piranha.AttributeBuilder.PostTypeBuilder(api) .AddType(typeof(Models.NewsPost)) .Build() .DeleteOrphans(); var siteTypeBuilder = new Piranha.AttributeBuilder.SiteTypeBuilder(api) .Build() .DeleteOrphans(); /** * * Test another culture in the UI * * var cultureInfo = new System.Globalization.CultureInfo("en-US"); * System.Globalization.CultureInfo.DefaultThreadCurrentCulture = cultureInfo; * System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = cultureInfo; */ // Register middleware app.UseStaticFiles(new StaticFileOptions { OnPrepareResponse = ctx => { var headers = ctx.Context.Response.GetTypedHeaders(); headers.CacheControl = new CacheControlHeaderValue { Public = true, MaxAge = TimeSpan.FromDays(14) }; } }); app.UsePiranha(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UsePiranhaIdentity(); app.UsePiranhaManager(); //app.UsePiranhaSummernote(); app.UsePiranhaTinyMCE(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapPiranhaManager(); }); //Seed.RunAsync(api).GetAwaiter().GetResult(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApi api, ILoggerFactory loggerFactory) { app.ConfigureExceptionHandler(loggerFactory, env.IsDevelopment()); if (env.IsDevelopment()) { app.UseCors("development mode"); app.UseDeveloperExceptionPage(); app.UseOpenApi(); app.UseSwaggerUi3(); } App.Init(api); // Configure cache level App.CacheLevel = Piranha.Cache.CacheLevel.None; // Build content types var pageTypeBuilder = new Piranha.AttributeBuilder.PageTypeBuilder(api) .AddType(typeof(Models.BlogArchive)) .AddType(typeof(Models.StandardPage)) .AddType(typeof(Models.TeaserPage)) .Build() .DeleteOrphans(); var postTypeBuilder = new Piranha.AttributeBuilder.PostTypeBuilder(api) .AddType(typeof(Models.BlogPost)) .Build() .DeleteOrphans(); var siteTypeBuilder = new Piranha.AttributeBuilder.SiteTypeBuilder(api) .AddType(typeof(Models.StandardSite)) .Build() .DeleteOrphans(); // Register middleware app.UseStaticFiles(); app.UseSpaStaticFiles(); app.UseAuthentication(); app.UsePiranhaManager(); app.UseMvc(routes => { routes.MapRoute(name: "areaRoute", template: "{area:exists}/{controller}/{action}/{id?}", defaults: new { controller = "Home", action = "Index" }); routes.MapRoute( name: "default", template: "{controller=home}/{action=index}/{id?}"); routes.MapRoute( name: "angular", template: "{*template}", defaults: new { controller = "Home", action = "Index" }); }); app.UseSpa(spa => { // To learn more about options for serving an Angular SPA from ASP.NET Core, // see https://go.microsoft.com/fwlink/?linkid=864501 spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { spa.UseAngularCliServer(npmScript: "start"); } }); //Seed.RunAsync(api).GetAwaiter().GetResult(); //TODO: fix seeding }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IServiceProvider services) { loggerFactory.AddConsole(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } // Initialize Piranha var api = services.GetService <IApi>(); App.Init(api); // Add custom fields App.Fields.Register <SizedImageField>(); // Add custom blocks App.Blocks.Register <SliderGroup>(); App.Blocks.Register <SizedImageBlock>(); // Build types var pageTypeBuilder = new Piranha.AttributeBuilder.PageTypeBuilder(api) .AddType(typeof(Models.BlogArchive)) .AddType(typeof(Models.StandardPage)) .AddType(typeof(Models.TeaserPage)); pageTypeBuilder.Build() .DeleteOrphans(); var postTypeBuilder = new Piranha.AttributeBuilder.PostTypeBuilder(api) .AddType(typeof(Models.BlogPost)); postTypeBuilder.Build() .DeleteOrphans(); var siteTypeBuilder = new Piranha.AttributeBuilder.SiteTypeBuilder(api) .AddType(typeof(Models.StandardSite)); siteTypeBuilder.Build() .DeleteOrphans(); // Register middleware app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseSpaStaticFiles(); app.UseAuthentication(); app.UsePiranhaManager(); app.UseMvc(routes => { routes.MapRoute(name: "areaRoute", template: "{area:exists}/{controller}/{action}/{id?}", defaults: new { controller = "Home", action = "Index" }); routes.MapRoute( name: "default", template: "{controller}/{action=Index}/{id?}"); }); app.UseSpa(spa => { // To learn more about options for serving an Angular SPA from ASP.NET Core, // see https://go.microsoft.com/fwlink/?linkid=864501 spa.Options.SourcePath = "ClientApp"; //spa.UseSpaPrerendering(options => //{ // options.BootModulePath = $"{spa.Options.SourcePath}/dist-server/main.js"; // options.BootModuleBuilder = env.IsDevelopment() // ? new AngularCliBuilder(npmScript: "build:ssr") // : null; // //options.SupplyData = (context, data) => // // { // // // Creates a new value called isHttpsRequest that's passed to TypeScript code // // data["isHttpsRequest"] = context.Request.IsHttps; // // }; // options.ExcludeUrls = new[] { "/sockjs-node" }; //}); if (env.IsDevelopment()) { spa.UseAngularCliServer(npmScript: "start"); } }); Seed(api); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApi api) { app.UseResponseCompression(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseSwagger(); // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), // specifying the Swagger JSON endpoint. app.UseSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "PiranhaCMS API V1"); }); } App.Init(api); // Configure cache level App.CacheLevel = Piranha.Cache.CacheLevel.Full; // Build content types var pageTypeBuilder = new Piranha.AttributeBuilder.PageTypeBuilder(api) .AddType(typeof(Models.TeaserPage)) .AddType(typeof(Models.RelationPage)) .AddType(typeof(Models.ContactPage)) .AddType(typeof(Models.IntroPage)) .AddType(typeof(Models.ServicesPage)) .AddType(typeof(Models.InvestbankPage)) .AddType(typeof(Models.AgencyPage)) .AddType(typeof(Models.NewsPage)) .AddType(typeof(Models.RequestOpenAccPage)) .AddType(typeof(Models.RecruitPage)) .AddType(typeof(Models.LoginPage)) .AddType(typeof(Models.RegisterPage)) .AddType(typeof(Models.SearchPage)) .AddType(typeof(Models.ForgotPassword)) .AddType(typeof(Models.AnalyzePage)) .AddType(typeof(Models.OtherServicesPage)) .Build() .DeleteOrphans(); var postTypeBuilder = new Piranha.AttributeBuilder.PostTypeBuilder(api) .AddType(typeof(Models.NewsPost)) .Build() .DeleteOrphans(); var siteTypeBuilder = new Piranha.AttributeBuilder.SiteTypeBuilder(api) .AddType(typeof(Models.StandardSite)) .Build() .DeleteOrphans(); /** * * Test another culture in the UI * * var cultureInfo = new System.Globalization.CultureInfo("en-US"); * System.Globalization.CultureInfo.DefaultThreadCurrentCulture = cultureInfo; * System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = cultureInfo; */ // Register middleware app.UseStaticFiles(new StaticFileOptions { OnPrepareResponse = ctx => { var headers = ctx.Context.Response.GetTypedHeaders(); headers.CacheControl = new CacheControlHeaderValue { Public = true, MaxAge = TimeSpan.FromDays(3) }; } }); app.UsePiranha(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UsePiranhaIdentity(); app.UsePiranhaManager(); app.UsePiranhaSummernote(); app.UsePiranhaTinyMCE(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapPiranhaManager(); }); app.UseRewriter(new RewriteOptions() .AddIISUrlRewrite(env.ContentRootFileProvider, "RedirectToWwwRule.xml") .AddRedirectToHttps() ); Seed.RunAsync(api).GetAwaiter().GetResult(); }