Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 12 2020 01:41

    jtkech on patch-1

    (compare)

  • Apr 12 2020 01:39

    jtkech on patch-1

    Update ZoneShapes.cs (compare)

somecodeguy
@dafergu2:matrix.org
[m]
and that method looks like this...
public static IApplicationBuilder UseViteDevelopmentEnvironment(
    this IApplicationBuilder builder)
{
    // Use the vite dev server as a proxy for all of the ts or css files
    return builder.MapWhen(context => IsViteResource(context), builder =>
    {
        builder.Use(async (context, next) =>
        {
            var oldUrl = (string)context.Request.Path;

            // Patch the hmr client.  It doesn't respect the base url path in the
            // vite config.  There is an outstanding PR to fix this in the vite repo.
            // https://github.com/vitejs/vite/pull/3495
            if (oldUrl.EndsWith("@vite/client"))
            {
                var newUrl = oldUrl.Replace("@vite/client", "patches/vite-hmr-client.js");
                context.Request.Path = newUrl;
                context.Request.QueryString = new QueryString("");
            }

            await next();
        });

        builder.UseSpa(spa =>
        {
            // TODO: Make this configurable if needed.  We would also need to make the vite
            // server configurable as well.
            spa.UseProxyToSpaDevelopmentServer("http://localhost:3000");
        });
    });
}

private static bool IsViteResource(HttpContext context)
{
    var url = (string)context.Request.Path;
    var lowerUrl = url.ToLowerInvariant();
    if (lowerUrl.Contains("firefliestheme")
        && (lowerUrl.EndsWith(".ts")
            || lowerUrl.EndsWith(".js")
            || lowerUrl.EndsWith(".css")
            || lowerUrl.EndsWith(".pcss")
            || lowerUrl.EndsWith(".vue")
            || lowerUrl.Contains("@vite"))
            || lowerUrl.Contains("/vite/")
            || lowerUrl.Contains("node_modules")
        // TODO: Once we figure out how to deal
        //   with the bug in the vite HMR client, determine if we
        //   should filter based on the /dist/ folder
        // && !lowerUrl.Contains("/dist/")
        )
    {
        return true;
    }
    return false;
}
The above startup code is your web project, not your theme project. Also, the mention to firefliestheme in the code, that's the name of my theme module.
You also need to reference this package in your main web project. <PackageReference Include="Microsoft.Aspnetcore.SpaServices.Extensions" Version="5.0.6" />
somecodeguy
@dafergu2:matrix.org
[m]
MS does have a package that is webpack specific. I wouldn't advise using it though, even though a lot of blogs show that you should. The reason is that it is now deprecated. MS is now recommending that for a true spa, you use the development server of webpack/react/angular/vue/whatever and then have it proxy all calls it doesn't server to your dotnet process. That doesn't work well here, and they are still supporting the generic proxy api (that I use above) from the Microsoft.Aspnetcore.SpaServices.Extensions package
somecodeguy
@dafergu2:matrix.org
[m]
@happygrizzly: I hope all of the above I posted helps. I spent a good amount of time getting this to work over the past several weeks. The end result is that I can use full vue SFC components, typescript, and 3rd party packaged js components easily now. All of my JS is now in typescript as well.
4 replies
Aleksey Filippov
@happygrizzly
Thank you very much! I'm going to investigate this. In my case I don't need a spa. Considering my requirements it would be easier to go with next.js as a separate frontend project. But - believe it or not - company doesn't like the idea of node/next.js.
3 replies
Sébastien Ros
@sebastienros
@deanmarcussen @Skrypt @agriffard won't be able to join the triage until 10:15 PT (15 minutes late)
What is Dave's alias so he's aware?
somecodeguy
@dafergu2:matrix.org
[m]
@sebastienros: Do you mean me?
I'm guessing not. :)
Dean Marcussen
@deanmarcussen
@sebastienros I can't make it all tonight :( Dave was daveblack, but he has changed his name I think, optimal?
Antoine Griffard
@agriffard
Dave Black : @daveblack101
Dave Black
@daveblack101
Gotcha. Cheers guys
Sébastien Ros
@sebastienros
I am in the room already
somecodeguy
@dafergu2:matrix.org
[m]
What could cause a page being rendered to not respect templates? I've got a custom route that returns a view in which I render a shape. I've tried changing the alternate but the rendered page doesn't have an alternate listed in its model. I've also tried overriding the template with the admin tool and with a cshtml in my theme to no avail. I feel like it is something simple that I'm not understanding.
vmahant
@vmahant
Any Idea I can't see image on frontend. Shortcode feature is enabled though
image.png
image.png
image.png
am I missing something?
Tony Han
@hyzx86

Are there any methods or modules that
Mapping existing relational database entity types to OrchardCore (Yessql) Model
It is possible to automatically create types based on existing types with only simple adjustments

Maybe it can also automatically synchronize data to a relational database?

aaronamm
@aaronamm
I have a custom module and configure OrchardCore.PublishLater as dependency.
However, when I enable my custom module it won't automatically enable OrchardCore.PublishLater module?
Can someone help me one this? Thank you.
[assembly: Module(
    Name = "MyModule",
    Version = "0.0.1",
    Category = "Content Management",
    Dependencies = new[]{
        "OrchardCore.PublishLater",
    }
)]
7 replies
aaronamm
@aaronamm
Should I use _shellFeaturesManager.EnableFeaturesAsync or recipe.json? I think we have something like this in Orchard 1 but I don't know to get it work with OC.
mmdqq
@mmdqq
how to use aspnet-contrib/AspNet.Security.OAuth.Providers in Orchardcore?
somecodeguy
@dafergu2:matrix.org
[m]
@sebastienros @deanmarcussen Thoughts about OrchardCMS/OrchardCore#9615 I'd like to get that merged in as I'm hoping to rely on some timezone updates in .NET 6 preview 4.
CrestApps
@CrestApps
Is there an example of how to change the template of the default pager?
28 replies
somecodeguy
@dafergu2:matrix.org
[m]
Hrm, this is really bothering me. My template is not being applied for a very specific use case. Here's my scenario.
I have a generic content type called Liquid Page. I have a simple content item of type Liquid Page with a well known alias. I have a module that exposes an endpoint on a controller via a [Route] attribute. The controller queries a 3rd party database to get some information. Then it creates a shape for the content item with the well known alias and renders it by passing that shape to the View() method. The cshtml simply does a @DisplayAsync.
I tried creating a Content-LiquidPage template in my theme. This is used for all over Liquid Page content items, but for the one that is rendered via my custom route, it is not.
somecodeguy
@dafergu2:matrix.org
[m]
I also tried setting an alternate on the shape, but that doesn't seem to be working. In fact, I don't even see the alternate listed when it gets rendered. (I dump the model using {{ Model | json }}.
Any suggestions on how to tackle this?
aaronamm
@aaronamm

I found something interesting, if I use dotnet new octheme --name CodesanookTheme --AddLiquid false, I expect some Razor views to be generated but it is not.
Here is the result.

dotnet new octheme --name CodesanookTheme --AddLiquid false
tree -I "bin|obj" CodesanookTheme/

CodesanookTheme/
├── CodesanookTheme.csproj
└── Manifest.cs

Is this the current behavior?

aaronamm
@aaronamm
is-DW
@is-DW
if I don't want load "node_modules" in vs,how to do?:)
4 replies
Kevin Welsh
@kdubious
Is there a good way in a Theme to know if the Tenant is loaded from https://demo.oc.com versus https://www.oc.com/demo? In other words, is there a way in C# Layout to read the Tenant settings for URLPrefix or Hostname?
36 replies
somecodeguy
@dafergu2:matrix.org
[m]
@deanmarcussen: Thanks for the review on the PR. I updated it.
somecodeguy
@dafergu2:matrix.org
[m]
What's the best way to pass a shape property down from the parent content item to all of the children in the content item tree (flowparts with content items etc). I added a template for the main parent content item and I'm getting the shape property but I'm having trouble rendering all of the child content from the overridden template.
11 replies
Jean-Philippe Tissot
@jptissot
Does anyone know how to render a shape to a string in a Razor view ?
17 replies
John Morgan
@john-s-morgan
What's the best way to add a noscript tag to liquid content? Adding scriptblock to head decouples it from the content and ideally would like them both to be together.
4 replies
Troy Parkinson
@trousyt
Has anyone tried to use the CORS module with GraphQL and succeeded? When I try, I don't get any of the CORS headers back on the response.
Jasmin Savard
@Skrypt
There's a trick
You need to uncheck the first checkbox in the policy
as stated in the documentation
!!! warning
As using AllowCredentials and AllowAnyOrigin at the same time is considered as a security risk, policies containing BOTH these options will NOT be activated.
Also, the GraphQL endpoint needs to have a proper permission.
You can try to give permission to the endpoint to your Anonymous user for example to try it.
We don't do any mutations so it should be fine.
Troy Parkinson
@trousyt
I am explicitly specifying the origin (ie. "Allow any origin" is not checked) and have turned off Allow Credentials. I've given the Execute GraphQL permission to the Anonymous role. Still no CORS response headers on a preflight request.