示例#1
0
 protected override void ConfigureConventions(NancyConventions conventions)
 {
     conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("css", @"Content/css"));
     conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("js", @"Content/js"));
     conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("img", @"Content/img"));
     base.ConfigureConventions(conventions);
 }
示例#2
0
        protected override void ConfigureConventions(Nancy.Conventions.NancyConventions nancyConventions)
        {
            base.ConfigureConventions(nancyConventions);

            Conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("/Scripts"));
        }
        protected override void ConfigureConventions(NancyConventions nancyConventions)
        {
            base.ConfigureConventions(nancyConventions);

            nancyConventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("/swagger/ui"));
        }
示例#4
0
 protected override void ConfigureConventions(NancyConventions nancyConventions)
 {
     nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("Scripts", @"/Scripts"));
     nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("Content", @"/Content"));
     nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("fonts", @"/fonts"));
     base.ConfigureConventions(nancyConventions);
 }
 protected override void ConfigureConventions(NancyConventions conventions)
 {
     base.ConfigureConventions(conventions);
     conventions.StaticContentsConventions.Add(
         StaticContentConventionBuilder.AddDirectory("/", "public")
         );
 }
示例#6
0
        private static string GetStaticContent(string virtualDirectory, string requestedFilename, string root = null)
        {
            var resource =
                string.Format("/{0}/{1}", virtualDirectory, requestedFilename);

            var context =
                new NancyContext
            {
                Request = new Request("GET", resource, "http")
            };

            var resolver =
                StaticContentConventionBuilder.AddDirectory(virtualDirectory, "Resources/Assets/Styles");

            var rootFolder = root ?? Environment.CurrentDirectory;

            GenericFileResponse.SafePaths.Add(rootFolder);

            var response =
                resolver.Invoke(context, rootFolder) as GenericFileResponse;

            if (response != null)
            {
                using (var stream = new MemoryStream())
                {
                    response.Contents(stream);
                    return(Encoding.UTF8.GetString(stream.GetBuffer(), 0, (int)stream.Length));
                }
            }

            return(null);
        }
示例#7
0
        protected override void ConfigureConventions(NancyConventions conventions)
        {
            base.ConfigureConventions(conventions);

            conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("products/maint/assets", "client/assets"));
            conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("products/maint/build", "client/build"));
        }
示例#8
0
        protected override void ApplicationStartup(IContainer container, Nancy.Bootstrapper.IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            var config            = container.GetInstance <IAsimovConfig>();
            var tempReportsFolder = Path.Combine(config.TempFolder, "AsimovTempReports");

            GenericFileResponse.SafePaths.Add(tempReportsFolder);

            Conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("temp-reports", tempReportsFolder)
                );

            pipelines.BeforeRequest.AddItemToEndOfPipeline(ctx =>
            {
                if (ctx.Request.Method == "POST")
                {
                    if (ctx.Request.Headers.Authorization != config.ApiKey)
                    {
                        return(401);
                    }
                }

                return(null);
            });
        }
        protected override void ConfigureConventions(NancyConventions conventions)
        {
            conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("dist", @"dist"));

            conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("resources", @"resources"));

            conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("controls", @"controls"));

            conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("admin", @"admin"));

            conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("admin_reporting", @"admin/reporting"));

            conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("viewreporting", @"viewreporting"));

            conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("report_resources", @"report_resources"));

            base.ConfigureConventions(conventions);
        }
示例#10
0
        /* Not using this...
         * protected override DiagnosticsConfiguration DiagnosticsConfiguration
         * {
         *  get { return new DiagnosticsConfiguration { Password = @".....SalmonAreP1nk.....BestServedCold....." }; }
         * }
         * */

        protected override void ConfigureConventions(NancyConventions nancyConventions)
        {
            nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("js", @"Web/js", ".js"));
            nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("css", @"Web/css", ".css"));

            base.ConfigureConventions(nancyConventions);
        }
 /// <summary>
 /// Adds a new static file to the nancy conventions
 /// </summary>
 /// <param name="requestFile">The route of the file</param>
 public string this[string requestFile]
 {
     set
     {
         this.conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddFile(requestFile, value));
     }
 }
示例#12
0
 /// <summary>
 /// Adds a new static directory to the nancy conventions
 /// </summary>
 /// <param name="requestDirectory">The route of the file</param>
 /// <param name="allowedExtensions">A list of extensions that is valid for the conventions. If not supplied, all extensions are valid</param>
 public string this[string requestDirectory, params string[] allowedExtensions]
 {
     set
     {
         this.conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory(requestDirectory, value, allowedExtensions));
     }
 }
 protected override void ConfigureConventions(NancyConventions nancyConventions)
 {
     nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("/views"));
     nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("/css", "/views/css"));
     nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("/js", "/views/js"));
     base.ConfigureConventions(nancyConventions);
 }
 protected override void ConfigureConventions(NancyConventions nancyConventions)
 {
     nancyConventions.StaticContentsConventions.Clear();
     nancyConventions.StaticContentsConventions
     .Add(StaticContentConventionBuilder.AddDirectory("/", "wwwroot"));
     base.ConfigureConventions(nancyConventions);
 }
示例#15
0
        protected override void ConfigureConventions(NancyConventions nancyConventions)
        {
            base.ConfigureConventions(nancyConventions);

            // By default, Nancy will serve static content from the 'Content' folder. We want to add 'Scripts' as well.
            nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("Scripts", "Scripts"));
        }
 protected override void ConfigureConventions(NancyConventions nancyConventions)
 {
     // nancyConventions.StaticContentsConventions.Add(
     //     StaticContentConventionBuilder.AddDirectory((new TmxServerRootPathProvider()).GetRootPath(), "Root"));
     
     nancyConventions.StaticContentsConventions.Add(
         StaticContentConventionBuilder.AddDirectory((new TmxServerRootPathProvider()).GetRootPath() + @"Views/results", "results"));
     
     nancyConventions.StaticContentsConventions.Add(
         StaticContentConventionBuilder.AddDirectory((new TmxServerRootPathProvider()).GetRootPath() + "Views/Scripts", @"Scripts", ".js"));
         
     nancyConventions.StaticContentsConventions.Add(
         StaticContentConventionBuilder.AddDirectory((new TmxServerRootPathProvider()).GetRootPath() + "Views/settings", @"settings"));
         
     nancyConventions.StaticContentsConventions.Add(
         StaticContentConventionBuilder.AddDirectory((new TmxServerRootPathProvider()).GetRootPath() + "Views/status", @"status"));
     
     nancyConventions.StaticContentsConventions.Add(
         StaticContentConventionBuilder.AddDirectory((new TmxServerRootPathProvider()).GetRootPath() + "Views/testRuns", @"testRuns"));
     
     nancyConventions.StaticContentsConventions.Add(
         StaticContentConventionBuilder.AddDirectory((new TmxServerRootPathProvider()).GetRootPath() + "Views/workflows", @"workflows"));
     
     base.ConfigureConventions(nancyConventions);
 }
示例#17
0
        protected override void ConfigureConventions(NancyConventions nancyConventions)
        {
            base.ConfigureConventions(nancyConventions);

            nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("docs", "docs"));
            nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("styles", "styles"));
        }
示例#18
0
        protected override void ConfigureConventions(NancyConventions _conventions)
        {
            base.ConfigureConventions(_conventions);

            _conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("css", @"css")
                );

            _conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("js", @"js")
                );

            _conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("js/3rdParty", @"js/3rdParty")
                );

            _conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("js/controllers", @"js/controllers")
                );

            _conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("js/services", @"js/services")
                );

            _conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("images", @"images")
                );

            _conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("views", @"ClientViews")
                );
        }
示例#19
0
 // The bootstrapper enables you to reconfigure the composition of the framework,
 // by overriding the various methods and properties.
 // For more information https://github.com/NancyFx/Nancy/wiki/Bootstrapper
 protected override void ConfigureConventions(NancyConventions nancyConventions)
 {
     nancyConventions.StaticContentsConventions.Add(
         StaticContentConventionBuilder.AddDirectory("images", "Content/progdata")
         );
     base.ConfigureConventions(nancyConventions);
 }
 protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
 {
     base.ApplicationStartup(container, pipelines);
     this.Conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("Scripts"));
     CookieBasedSessions.Enable(pipelines);
     RouteTable.Routes.MapHubs();
 }
示例#21
0
 protected override void ConfigureConventions(NancyConventions nancyConventions)
 {
     nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("Scripts", @"Views/Scripts"));
     nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("css", @"Views/Styles"));
     nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("Partials", @"Views/Partials"));
     base.ConfigureConventions(nancyConventions);
 }
示例#22
0
        protected override void ApplicationStartup(TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            CookieBasedSessions.Enable(pipelines);

            Conventions.ViewLocationConventions.Add((viewName, model, context) => string.Concat("views/", viewName));

            Conventions.StaticContentsConventions.Add(
                StaticContentConventionBuilder.AddDirectory("assets", @"assets")
                );

            container.Register <IFlexUserStore, FlexMembershipUserStore <User, Role> >();
            container.Register(typeof(IDocumentStore), InitDocStore());
            container.Register(typeof(IDocumentSession), (c, overloads) =>
                               c.Resolve <IDocumentStore>().OpenSession());

            var cryptographyConfiguration = new CryptographyConfiguration(
                new RijndaelEncryptionProvider(new PassphraseKeyGenerator(Configuration.EncryptionKey, new byte[] { 8, 2, 10, 4, 68, 120, 7, 14 })),
                new DefaultHmacProvider(new PassphraseKeyGenerator(Configuration.HmacKey, new byte[] { 1, 20, 73, 49, 25, 106, 78, 86 })));

            var authenticationConfiguration =
                new FormsAuthenticationConfiguration()
            {
                CryptographyConfiguration = cryptographyConfiguration,
                RedirectUrl = "/login",
                UserMapper  = container.Resolve <IUserMapper>(),
            };

            FormsAuthentication.Enable(pipelines, authenticationConfiguration);

            FlexMembershipProvider.RegisterClient(
                new GoogleOpenIdClient(),
                "Google", new Dictionary <string, object>());
        }
示例#23
0
 protected override void ConfigureConventions(NancyConventions nancyConventions)
 {
     Conventions.StaticContentsConventions.Add(
         StaticContentConventionBuilder.AddDirectory("site", @".")
         );
     base.ConfigureConventions(nancyConventions);
 }
 protected override void ConfigureConventions(NancyConventions nancyConventions)
 {
     base.ConfigureConventions(nancyConventions);
     nancyConventions.StaticContentsConventions.Add(
         StaticContentConventionBuilder.AddDirectory("assets"));
     Nancy.Json.JsonSettings.MaxJsonLength = int.MaxValue;
 }
示例#25
0
        protected override void ConfigureConventions(NancyConventions conventions)
        {
            base.ConfigureConventions(conventions);

            conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("", "dist"));
            conventions.ViewLocationConventions.Add((viewName, model, context) => string.Concat("dist/", viewName));
        }
示例#26
0
        protected override void ConfigureConventions(NancyConventions conventions)
        {
            base.ConfigureConventions(conventions);

            conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("retailers/dem-stock/assets", "client/assets"));
            conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("retailers/dem-stock/build", "client/build"));
        }
示例#27
0
        protected override void ConfigureConventions(NancyConventions nancyConventions)
        {
            base.ConfigureConventions(nancyConventions);

            nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddFile("/favicon.ico", "/Content/favicon.ico"));
            nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddFile("/robots.txt", "/Content/robots.txt"));
        }
示例#28
0
 protected override void ConfigureConventions(NancyConventions nancyConventions)
 {
     base.ConfigureConventions(nancyConventions);
     nancyConventions.StaticContentsConventions.Clear();
     nancyConventions.StaticContentsConventions.Add
         (StaticContentConventionBuilder.AddDirectory("assets", "/assets"));
 }
示例#29
0
 protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
 {
     base.ApplicationStartup(container, pipelines);
     this.Conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("Scripts"));
     this.Conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("Styles"));
     this.Conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("Fonts"));
 }
        protected override void ConfigureConventions(NancyConventions nancyConventions)
        {
            base.ConfigureConventions(nancyConventions);

            Conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("Scripts"));

            Conventions.ViewLocationConventions.Add((viewName, model, context) => string.Concat(context.ModuleName, "/Views/", viewName));
        }