Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 14 18:32
    ingted opened #218
  • Apr 14 02:26
    acdsign starred dotnet-websharper/core
  • Apr 13 08:18

    Jand42 on websharper50

    C# record cloning #1123 fix build error on new .N… update Microsoft.CodeAnalysis.C… (compare)

  • Apr 09 06:17
    ttkk1024 starred dotnet-websharper/core
  • Apr 06 07:30

    Jand42 on websharper50

    WIP record inheritance (compare)

  • Apr 03 14:40

    Jand42 on websharper50

    WIP C# records (compare)

  • Mar 23 05:32
    ingted closed #1124
  • Mar 22 10:55
    Jand42 commented #1123
  • Mar 22 10:54

    Jand42 on master

    #1123 Use suitable dotnet SDK o… (compare)

  • Mar 22 10:47
    Jand42 commented #1124
  • Mar 14 19:01
    Kaliumhexacyanoferrat starred dotnet-websharper/core
  • Mar 12 14:11

    Jand42 on websharper50

    restore runngen scripts publish net50 tests for Chutzpah fix for WS.Tests package (compare)

  • Mar 12 10:21

    Jand42 on websharper50

    restore double frameworks merge ws5 revert to net461 and 5 more (compare)

  • Mar 10 21:12

    Jand42 on websharper50

    revert to stable try to fix F# issue builds (compare)

  • Mar 09 08:37

    Jand42 on websharper50

    optimizations, cleanup, tests update to FCS 39 cleanup net4x refs and 1 more (compare)

  • Mar 08 09:26
    timothyliu starred dotnet-websharper/core
  • Mar 06 10:04
    ingted edited #1124
  • Mar 06 10:04
    ingted opened #1124
  • Mar 05 15:01
    granicz assigned #1123
  • Mar 03 10:26

    Jand42 on fsharp50

    minor fixes update frameworks preview fsc (compare)

Adam Granicz
@granicz
2) calls from the client are dispatched by the RPC handler, so an API mismatch will be first seen on the server, which will send an error back to the client
on both tiers, there is a marshaling process happening, taking JSON to an object - this will fail on one of the ends, depending on the API change in question
3) websockets would be more appropriate for a chat app, on .NET Core see WebSharper.AspNetCore.WebSocket. For plain .NET, there are quite a few libs out there
If you need a websocket example, just look at the above lib's sources
Ash Bhaskar
@ashokkbhaskar
Re: 2. What triggers a mismatch error error? Is it any change in the CLR machine/object code for that function, or does it only match the number of parameters and their types with the arguments received?
1 reply
Re: 3. Why are Websockets preferred over SignalR? My understanding was that SignalR abstracts over Websockets and long-polling to provide fallback options.
2 replies
Adam Granicz
@granicz
C:\granicz\shopping-cart>dotnet new websharper-spa -lang f# -n MyShoppingCart                                                                                 The template "WebSharper 4 Single Page Application" was created successfully.                                                                                 
An update for template pack WebSharper.Templates::4.7.0.395 is available.
    install command: dotnet new -i WebSharper.Templates::4.6.7.382
@Jand42 the above looks fishy
1 reply
I have the latest 4.7.x templates, why would it tell me about an "update" that is 4.6.x?
Adam Granicz
@granicz
has anyone encountered 404 when debugging a websharper-spa in VSC? @Jand42 can you check on what's going on?
4 replies
rbauduin
@rbauduin_gitlab

Is this a working endpoint definition (it is a case in a EndPoint DU):

    | [<EndPoint("/validate/{email}/{token}")>] Validate of email:string * token:string

I can't seem to generate the link correctly when calling (ctx.Link (Validate(u.Email,token1))) and all examples I see are using a class for the endpoint.

Adam Granicz
@granicz
| [<EndPoint("/validate")>] Validate of email:string * token:string should be fine
also, you should be looking at the f# version of that doc ;)
1 reply
Adam Granicz
@granicz
@tarmil Would anything break if a UI template was defined inside a <table> as follows?
                                <table>
                                    <tbody>
                                        <div ws-replace="CartItems">
                                            <div ws-children-template="CartItem">
                                                <tr>
                                                    <td class="col1">
                                                        <button ws-onclick="Decrement">-</button>
                                                        <span class="count">1</span>
                                                        <button ws-onclick="Increment">+</button>
                                                        <button ws-onclick="Remove">X</button>
                                                        <span class="title">${Name}</span>
                                                    </td>
                                                    <td class="col2">
                                                        <code>$${Amount}</code>
                                                    </td>
                                                </tr>
                                            </div>
...
I have this in an index.html, which I bind with .Bind() in a SPA, filling CartItems with items based off of CartItem instantiations
yet, the page shows up as if it hasn't been processed, ie. with ws-replaces left intact
(other parts use similar templates, but they get instantiated fine)
it's almost as if Bind just breaks because of ill-formed HTML inside the table tag
Adam Granicz
@granicz
AFAIK, Bind should process and remove all ws-replace - why on earth would it leave only those above?
Adam Granicz
@granicz
It's clearly due to being inside <table>, if I switch those to plain divs, the placeholders/templates work
1 reply
Adam Granicz
@granicz
rbauduin
@rbauduin_gitlab
I wanted to share that I've had some success using ASP.Net endpoint routing with Websharper! I am currently manually attaching the WebSharper QueryHandler to the endpoints. When defining the endpoint, it is possible to require some authorization level, which lets me use the ASP.Net facilities. This greatly simplifies the code and provides authorization by the ASP.Net middleware. What's really cool (in my opinion anyway :-)) is that I can use ASP.Net policies, hence base my authorization on claims. I suppose that using reflection, this could be automated in a call to something like UseWebSharperEndpoints that would setup all endpoints. Now there's still a need to handle remoting requests. I'm wondering if it would be possible to map these to endpoints somehow based on the header x-websharper-rpc....
5 replies
Ash Bhaskar
@ashokkbhaskar
How complex of a task is it to update the Websharper SignalR bindings at https://github.com/ChrisDobby/Chrisjdobson.Websharper.SignalR to work with .NET 5 and Websharper 4? I pulled the repo and started to work through the compiler errors, but I don't know enough about .NET or Websharper internals to work through them efficiently or estimate the scope of the work. Most of them seem to be related to breaking changes in dependency libs.
3 replies
There's also https://github.com/mrboh/WebSharper.SignalR, but the code is much more granular and I'm not sure why.
Ganesh Kurcheti
@GaneshKurcheti
Hi @all, I have worked for a while on WebSockets implementation using WebSharper for live communication between different clients. Here is the sample project for the same https://github.com/GaneshKurcheti/TwitterClone-Websharper-WebSockets . Hope this will be helpful for someone.
4 replies
Adam Granicz
@granicz
@jand42 How up to date is the release schedule? https://github.com/orgs/dotnet-websharper/projects/1
5 replies
rbauduin
@rbauduin_gitlab
Regarding enpoint routing, I mapped RPC requests using MapWhen like this, but I'm afraid this could introduce vulnerabilities (policies are not checked in that case). Does the presence of x-websharper-rpc limit the actions taken server side to functions published as rpc? I mean could someone send a post with a dummy x-websharper-rpc header to the endpoint /delete/48 bypassing the claims checks on aspnet endpoints as these are set after the rpc calls handling?
9 replies
Adam Granicz
@granicz
as @ashokkbhaskar 's rough start with existing SignalR WebSharper libs shows, we could use an up-to-date binding/abstraction with SignalR - any takers to help out on that?
3 replies
rbauduin
@rbauduin_gitlab

The Websharper forms introduction says:

You should use Formlets in one of these cases:
    You want your code to be extremely concise and define at the same time how input data is composed and validated, and how input fields are rendered.
    You are developing a back-office application, prioritizing speed of development over pixel-perfect design.

I'm in this case :-)
But there's no documentation for Formlets in Websharper 4. Are they obsolete or are they replaced by something else in Websharper 4?
Btw, this looks amazing, exactly what I need, and should speed up my app's development! I had to share my enthousiasm :-D

6 replies
rbauduin
@rbauduin_gitlab
I think I've reached a usable point for my needs regarding the endpoint routing and identity core authentication/authorization. I don't think I'll have the time to propose a PR myself in the coming months, but I've put it under the Apache License as Websharper, so feel free to reuse or look at it for inspiration if you want to integrate it in the next WebSharper release. It's available at https://gitlab.com/rbauduin/websharper-identity.
2 replies
rbauduin
@rbauduin_gitlab
I will build a Web application using a backend library that is well covered by tests. I would like the web app to be well tested too. By that I mean what is displayed but also the behaviour. Some examples that would make sense to test in https://gitlab.com/rbauduin/websharper-identity:
  • when an unauthenticated user tries to access a page requiring authentication, check there is a redirection to the login page with the correct query string (with ReturnUrl)
  • check the login displayed with the expected fields with expected values
  • if incorrect credentials are provided, check login is refused
  • if correct credentials are provided, check there is a redirect to the ReturlUrl
  • etc...
    What's the advised way to test a websharper application? I've used Selenium a long time ago, but maybe there's another solution that's easier/better integrated? I've used ruby on rails (a long time ago too), and they had good testing support, eg providing response assertions making it easy to test a lot of scenarios. What's the advised approach for WebSharper applications?
7 replies
amieres
@amieres
Someone should do this for Websharper: https://davedawkins.github.io/Fable.Sveltish/
Adam Granicz
@granicz
@amieres what would one get that's not in WebSharper.UI already?
amieres
@amieres
Nothing. I am referring to the webpage, which is an excellent way to demo the features and code.
András Jankó
@Jand42
@amieres @granicz A quick way to do this would be is to have a more structured (tree instead of flat list) and expanded (with many smaller feature-specific demos) featured samples on https://try.websharper.com/
and maybe some intro.js bubbles for newcomers to let them know about the left-hand hamburger menu
Adam Granicz
@granicz
@amieres is right, we need a good, statically hosted demo site that can be easily extended by anyone
the problem with try.websharper is that it's closed source and it would be a PITA to open source it given the SSO entanglement with the other subsites
i was thinking of spinning off the documentation/developer side as such a standalone site, it would be a weekend's work but definitely worth it
then it could serve as a template for a static demo site
anyhow, I will ping here when I have a repo for it, then anyone is welcome to join me in developing it further
rbauduin
@rbauduin_gitlab
I've had no luck posting a question on the forum, so I link it from here: https://forums.websharper.com/topic/88492
Seems that when using Asp.net's TestServer, I need to create a scope with app.ApplicationServices.CreateScope() to get to the service provider with scope.ServiceProvider. So in my Websharper function, ctx.Environment.["WebSharper.AspNetCore.Services"] doesn't have the scoped service when running in TestServer. Is there a way around this?
3 replies
András Jankó
@Jand42

@rbauduin_gitlab Sorry for dropping this so long, I also have catchup to do on ANC authentication/authorization, was researching into it.

let httpContext = ctx.HttpContext() // needs open WebSharper.AspNetCore
                                    // short for unbox<HttpContext> (ctx.Environment.["WebSharper.AspNetCore.HttpContext"])
let signInManager = httpContext.RequestServices.GetService<SignInManager<ApplicationUser>>()
let userManager = httpContext.RequestServices.GetService<UserManager<ApplicationUser>>()

This way you get the SignInManager/UserManager instances that are scoped to the request.

3 replies
you also need open Microsoft.Extensions.DependencyInjection for httpContext.RequestServices.GetService
Evan Bachert
@ebachert
random question, is there any way to get the user id and/or email address of a user who Approves and/or Denies an 'Approval workflow email' from an Azure Logic App?
to11mtm
@to11mtm
Question, how would one use a remoting endpoint that returns csv data, such they can click button on page and download?
I'm not sure one can use Content.Custom that way on client side code?
Adam Granicz
@granicz
You need Content.File from the server
Ghost
@ghost~6001a95ad73408ce4ff8e462
hi
rbauduin
@rbauduin_gitlab
I've updated my example of using Identity Core with WebSharper with unit and selenium tests as well as a small README to guide interested readers. I don't plan to expand it further, but I will use this technique in a web app I'm developing, so feedback is always welcome ;-)
3 replies
ingted
@ingted

Hi^^

I try to invoke external JS library function but failed... Could someone kindly help me?

https://stackoverflow.com/questions/67106626/external-js-library-not-applied-to-tag-generated-by-websharper