403Webshell
Server IP : 65.108.144.40  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64
User : dev ( 1000)
PHP Version : 8.2.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/dev/webapps/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/dev/webapps/Startup.cs
using Advanced.CMS.AdvancedReviews;

using Certinia.Web.Features.Media.Images.Models;
using Certinia.Web.Infrastructure;
using Certinia.Web.Infrastructure.Constants;
using Certinia.Web.Infrastructure.IOptions;
using Certinia.Web.Infrastructure.Middleware;
using Certinia.Web.Infrastructure.Options;
using Certinia.Web.Infrastructure.Services.Rss;

using EPiServer.Cms.Shell;
using EPiServer.Cms.Shell.UI.Configurations;
using EPiServer.Cms.UI.AspNetIdentity;
using EPiServer.Cms.WelcomeIntegration.Graph;
using EPiServer.DependencyInjection;
using EPiServer.OptimizelyIdentity;
using EPiServer.Scheduler;
using EPiServer.Web;
using EPiServer.Web.Routing;

using Geta.NotFoundHandler.Infrastructure.Configuration;
using Geta.NotFoundHandler.Infrastructure.Initialization;
using Geta.NotFoundHandler.Optimizely.Infrastructure.Configuration;
using Geta.NotFoundHandler.Optimizely.Infrastructure.Initialization;
using Geta.Optimizely.Sitemaps;

using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Rewrite;
using Microsoft.Extensions.Options;

using Optimizely.Cms.DependencyInjection;
using Optimizely.Cms.Preview1;

using Stott.Optimizely.RobotsHandler.Common;
using Stott.Optimizely.RobotsHandler.Configuration;

namespace Certinia.Web;

public class Startup
{
    private readonly IWebHostEnvironment _webHostingEnvironment;
    private readonly IConfiguration _configuration;

    public Startup(IWebHostEnvironment webHostingEnvironment, IConfiguration configuration)
    {
        _webHostingEnvironment = webHostingEnvironment;
        _configuration = configuration;
    }

    public void ConfigureServices(IServiceCollection services)
    {
        bool isDevelopment = _webHostingEnvironment.IsDevelopment();
        if (isDevelopment)
        {
            services.Configure<SchedulerOptions>(options => options.Enabled = false);
            services.AddCmsAspNetIdentity<ApplicationUser>()
                     .AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme);
            services.ConfigureApplicationCookie(options =>
            {
                options.LoginPath = "/Util/Login";
                options.AccessDeniedPath = "/Util/Login";
            });
        }
        else
        {
             services.AddCmsCloudPlatformSupport(_configuration);
             services.AddOptimizelyIdentity(useAsDefault: true);
        }

        services.AddCdnImageResizing(options =>
        {
            options.IsEnabled = !isDevelopment;
        });

        services
            .AddAuthorization()
            .AddCms()
            .AddCmsCmpPublishing()
            .AddEmbeddedLocalization<Startup>()
            .AddJsonConversionStandard()
            .AddDAMUi()
            .AddDAMGraphIntegration()
            .AddAdvancedReviews(opts =>
            {
                opts.EditableLinksEnabled = true;
            })
            .AddTinyMceConfiguration()
            .AddRobotsHandler(
                authOptions =>
                    authOptions.AddPolicy(RobotsConstants.AuthorizationPolicy, policy => policy.RequireRole(StartupConstants.ContentAdminRole))
            )
            .AddSitemaps(options => { }, policy => policy.RequireRole(StartupConstants.ContentAdminRole))
            .AddOptimizelyNotFoundHandler()
            .AddNotFoundHandler(options =>
            {
                options.UseSqlServer(_configuration.GetConnectionString("EPiServerDB"));
                options.LogWithHostname = true;
            },
                policy => policy.RequireRole(StartupConstants.ContentAdminRole)
            );

        services.ConfigureContentApiOptions(o =>
        {
            o.IncludeInternalContentRoots = true;
            o.IncludeSiteHosts = true;
        });

        services.AddContentDeliveryApi(); 
        services.AddContentGraph(opts =>
        {
            opts.IncludeInheritanceInContentType = true;
        });

        var singleKey = _configuration["Optimizely:ContentGraph:SingleKey"];
        services
            .AddContentGraphClient()
            .ConfigureHttpClient(client => client.BaseAddress = new Uri($"https://cg.optimizely.com/content/v2?auth={singleKey}"));

        services.AddAntiforgery(options => {
            options.Cookie.SameSite = SameSiteMode.None;
            options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
        });

        services.AddInlineBlocks();
        services.AddContentModelBuilders();

        services.AddSwaggerGen(c =>
        {
            c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
            c.DocInclusionPredicate((_, apiDesc) => apiDesc.RelativePath != null && !apiDesc.RelativePath.Contains("episerver"));
        });

        if (isDevelopment)
        {
            services.Configure<CmsServiceOptions>(opts => {
                opts.AddDevelopmentSigningCredentials();
            });
        }

        services.Configure<CookieAuthenticationOptions>(OptimizelyIdentityDefaults.CookieSchemeName, options =>
        {
            options.Cookie.SameSite = SameSiteMode.None;
            options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
        });

        services.Configure<RazorViewEngineOptions>(options =>
        {
            options.ViewLocationFormats.Add("/Features/{1}/Views/{0}.cshtml");
            options.ViewLocationFormats.Add("/Features/Pages/{1}/Views/{0}.cshtml");
            options.ViewLocationFormats.Add("/Features/Pages/{0}/Views/{0}.cshtml");
            options.ViewLocationFormats.Add("/Features/Blocks/{0}.cshtml");
        });

        services.Configure<UploadOptions>(options =>
        {
            options.FileSizeLimit = 2147483648;
        });

        services.Configure<MediaOptions>(options =>
        {
            options.CacheControl = "public"; 
            options.ExpirationTime = new TimeSpan(365, 6, 0, 0);
        });

        services
            .AddOptions<CustomApiOptions>()
            .BindConfiguration(CustomApiOptions.CustomApi)
            .ValidateDataAnnotations()
            .ValidateOnStart();

        services.AddOptions<RedirectRuleOptions>()
            .BindConfiguration(RedirectRuleOptions.RedirectRules);
    }

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseStatusCodePagesWithReExecute("/error/{0}");
            app.UseExceptionHandler("/static/html/error.html");
        }

        // Custom redirects in appsettings.json
        var rewriteOptions = new RewriteOptions();

        using (var scope = app.ApplicationServices.CreateScope())
        {
            var options = scope.ServiceProvider
                .GetRequiredService<IOptions<RedirectRuleOptions>>()
                .Value;

            foreach (var rule in options.Rules)
            {
                rewriteOptions.AddRedirect(
                    $"^{rule.OldUrl.TrimStart('/')}$",
                    rule.NewUrl,
                    StatusCodes.Status301MovedPermanently);
            }
        }
        app.UseRewriter(rewriteOptions);


        app.UseNotFoundHandler();
        app.UseOptimizelyNotFoundHandler();

        // 31536000 = 60 seconds × 60 minutes × 24 hours × 365 days
        var cacheMaxAgeOneYear = "31536000";
        app.UseStaticFiles(new StaticFileOptions
        {
            OnPrepareResponse = ctx =>
            {
                ctx.Context.Response.Headers.Append("Cache-Control", $"public, max-age={cacheMaxAgeOneYear}");
            }
        });

        app.UseRouting();
        app.UseAuthentication();
        app.UseCmsCmpPublishingPreviewLinks();
        app.UseAuthorization();

        if (!env.IsDevelopment())
        {
            app.UseContentSecurePolicy();
        }

        app.Use(async (context, next) =>
        {
            if (context != null)
            {
                var baseUrl = UriHelper.BuildAbsolute(context.Request.Scheme, context.Request.Host, context.Request.PathBase);

                context.RequestServices.GetRequiredService<IRssBlogFeedService>().CurrentSiteBaseUrl = baseUrl;
                context.RequestServices.GetRequiredService<ImageModelBuilder>().CurrentSiteBaseUrl = baseUrl;
            }

            await next();
        });

        app.UseEndpoints(endpoints =>
        {
            endpoints.MapContent();
            endpoints.MapRazorPages();
        });

        if (!env.IsProduction())
        {
            app.UseSwagger();
            app.UseSwaggerUI();
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit