Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 15:36

    ddworak on silencer

    (compare)

  • 15:36

    ddworak on master

    Replace silent with nowarn Scala 2.12.13, remove silencer Fix recursive implicits in Prop… and 2 more (compare)

  • 15:36
    ddworak closed #722
  • 15:36
    ddworak closed #719
  • 15:36

    ddworak on scalacss-0.7.0

    (compare)

  • 15:36

    ddworak on master

    Update scalacss:core to 0.7.0 Merge branch 'update/scalacss-0… Typed content attribute migrati… and 1 more (compare)

  • 15:36
    ddworak closed #721
  • 09:06
    ddworak review_requested #722
  • 08:52
    ddworak synchronize #722
  • 08:52

    ddworak on silencer

    Update CI Scala versions (compare)

  • 08:45
    ddworak synchronize #722
  • 08:45

    ddworak on silencer

    Fix recursive implicits in Prop… (compare)

  • Jan 15 14:14
    ddworak assigned #722
  • Jan 15 14:14
    ddworak opened #722
  • Jan 15 14:11

    ddworak on silencer

    Replace silent with nowarn Scala 2.12.13, remove silencer (compare)

  • Jan 15 13:57

    ddworak on scala-collection-compat-2.3.1

    (compare)

  • Jan 15 13:41
    ddworak review_requested #721
  • Jan 15 13:33
    ddworak assigned #721
  • Jan 15 13:33
    ddworak opened #721
  • Jan 15 13:33

    ddworak on scalacss-0.7.0

    Update scalacss:core to 0.7.0 Merge branch 'update/scalacss-0… Typed content attribute migrati… (compare)

Kirill A. Korinsky
@catap
@ddworak yeah, honestly it is some "dump" class for easy debuging and I covered it by a few case. But it is still pretty shity code but I guess it is impossibly to make the code better.
Kirill A. Korinsky
@catap
[and thanks for review, I'll try to response on this week]
Dawid Dworak
@ddworak
no rush, thanks :)
Kirill A. Korinsky
@catap
Hey, how can I do a redirect from / to /something? Create a dedicated state RootState and make a Factory with fake view that makes redirect?
Kirill A. Korinsky
@catap
Screenshot 2020-09-29 at 01.43.52.png

Footnotes regarding UdashFramework/udash-core#656.

I can't test locally guide because I defently missed something.

I build it as sbt clean guide/docker:publishLocal and run it as docker run -p 8080:8080 --rm udash-guide:0.9.0-SNAPSHOT but when I go to http://127.0.0.1:8080/frontend I have 404 (see a picture)

Dawid Dworak
@ddworak
@catap that is correct. Udash Guide binds on 127.0.0.1 for the udash.io homepage and on 127.0.0.2 for the guide. See http://127.0.0.1:8080/ vs http://127.0.0.2:8080/ vs http://localhost:8080/
The URL you provided would obviously be o 404 in that context
As far as redirects are concerned, I think I need more context - why would you need a fake view etc.? For the simple case, dom.window.href = "???" or dom.window.replace(...) are fully expected to work. If you have states, you can also rely on application.goTo.
Kirill A. Korinsky
@catap

@ddworak I see. Anyway, it isn't "bind" because jetty binds to 0.0.0.0:8080. It is vhost. I understand why you are using 127.0.0.2 as second virtual host and I assume that you're using ubuntu or another system that routes 127.0.0.0/8 to loopback interface.

As nice hack is it fine for you to add two more virtual host udash.local and guide.udash.local?

If you agree can you review UdashFramework/udash-core#660
Kirill A. Korinsky
@catap

About redirect. Let assume that I have:

class RoutingRegistryDef extends RoutingRegistry[RoutingState] {
  def matchUrl(url: Url): RoutingState = {
    val stripped = "/" + url.value.stripPrefix("/").stripSuffix("/")
    val state = url2State.applyOrElse(stripped, (_: String) => ErrorState)
    state
  }

  def matchState(state: RoutingState): Url =
    Url(state2Url.apply(state))

  private val (url2State, state2Url) = bidirectional {
    case "/" => RootState
    case "/chat" => ChatState
    case "/login" => LoginPageState
  }
}

RootState should:

  • AuthRequires.requireAuthenticated()
  • application.goTo(ChatState)

How can I achive that?

Dawid Dworak
@ddworak
@catap sure, it's a vhost :)
Dawid Dworak
@ddworak

As far as the redirect is concerned, what I'd do is revert the check - redirect to login page on auth failure, not the other way around. Otherwise someone is always able to skip your code by going directly to the chat state (e.g. by correct URL). The way to do this is:

  1. Structure your RPC so that it has endpoints hidden behind a "secure" RPC

    trait MainServerRpc {
    /** Returns an Rpc for authentication. */
    def auth: AuthRpc
    
    /** Verifies provided UserToken and returns a [[SecureRpc]] if the token is valid. */
    def secure(token: UserToken): SecureRpc

    Login page uses the auth RPC, other RPCs are encapsulated so they can't be used without a valid token.
    secure should throw a shared exception (as in https://guide.udash.io/rpc/client-server -> Exceptions handling) in case the token is invalid, let's assume InvalidTokenException.

  2. Handle auth errors in Udash RPC.
    You can register a callback in io.udash.rpc.internals.UsesServerRPC#onCallFailure which will redirect to login page whenever InvalidTokenException happens.

Kirill A. Korinsky
@catap
@ddworak but I haven't need [yet] backend :)
so, this should be "frontend" redirect only
Kirill A. Korinsky
@catap
Anyway, the question is: how to redirect user from / to /chat ?
Dawid Dworak
@ddworak
@catap I see :) then as mentioned previously, application.goTo and dom.window.href = are both viable options for frontend redirects, Udash routing engine can handle this
Kirill A. Korinsky
@catap
@ddworak ok, I don't understand how to describe in inside something that extends RoutingRegistry
This message was deleted
Kirill A. Korinsky
@catap
Let me rephase question.
How can I call application.goTo(SomeState) [with change url, reinizialize it, etc] when user came to /.
As far as I see the easy way it introduce excetion and add handler to application.onRoutingFailure; but it is a bit wired, isn't it?
Kirill A. Korinsky
@catap
@ddworak and second question (I feel that it is similar things): how can I implement /logout url?
Dawid Dworak
@ddworak
Let me start with answering the second one then - I'd just usually just stick a button in the RootView and on the click callback just:
      userContextService.logout() //basically whatever you do to keep context
      application.goTo(LoginPageState)
For the first question, you can call application.goTo anywhere basically. There are no limits, once the app is initialized and you can get a handle on the reference, the sky is the limit ;) Whether it's a presenter, a button click handler, static code - doesn't matter at all.
Kirill A. Korinsky
@catap

@ddworak I did the same things about logout. Before I thougt to add /logout URL but I realised that it makes things just more complicated.

Regarding routing: I doubt that application.goTo inside matchUrl is good idea, but, again, throw an exeception here is more than fine for now. So, please ignore this.

Kirill A. Korinsky
@catap

@ddworak about #656: I have to try to work with big file (100mb and bigger) and noticed some issue.

Because I'm overload on another topics, I can't finish it right now => requires some time

But, if you have a loock to the code I will be appricieted

Kirill A. Korinsky
@catap
This message was deleted
Dawid Dworak
@ddworak
@catap will do when I can :) thanks for helping out
Kirill A. Korinsky
@catap

@ddworak about #664 and why I did it. I tried to use FileInput.single and I don't understand how.

I feel that it is a typo and it should be implemeted via Option[File] and my code right now use the same technic.

But, probably, I've missed something (how to use it). If no => I can open a PR to change API of FileInput.single

Dawid Dworak
@ddworak
I'm not sure, but I'll analyze the usage patterns in our internal codebase once I get to the property issue.
Kirill A. Korinsky
@catap
Thanks!
Kirill A. Korinsky
@catap

@ddworak Hey! I marked as ready for review UdashFramework/udash-core#656

It contains a bit more code and I'd like to hear your thoughts about this.

Dawid Dworak
@ddworak
@catap cool, I'll try to take a look this week :) thanks!
Kirill A. Korinsky
@catap
@ddworak any news?
Dawid Dworak
@ddworak
@catap sorry for the delay, we had more pressing matters to solve this week with scalamock not working on SJS and a bug in the view renderer - let's hope for a better one
Kirill A. Korinsky
@catap
:)
Thanks, I just would like to merge it somehow in the next release
Kirill A. Korinsky
@catap
@ddworak thanks. I try to do it this week
Dawid Dworak
@ddworak
@catap no problem, sorry for taking so long. Let's keep it simple so it can get merged easily :)
Kirill A. Korinsky
@catap
@ddworak I hope you can answer a few question soon
Gerald Mixa
@gmixa
Hello is there a migration concept somewhere from udash 0.8 to 0.9 or an running example App for 0.9 ?
Dawid Dworak
@ddworak
@gmixa hey, this will get published when we finally release 0.9, high time I guess ;) please ask here if you need any help, we'll be happy to
Gerald Mixa
@gmixa

i tried to adapt the g.8 generated example for 8.0 to 0.9-M4. things that i did not manage to fix are:

the multi language support (it seems 0.9 does not support setting a current lang) - theres no set method anymore
registration of model validation seems to have changed from handmade to macros? i have no clue how to transform these so that they are working again. If anybody is interested i could put what i have done so far on github so that somone else might be able to check the changes!
I have taken out all non existing dependencies. The Backend part seems to compile and pass tests. The changes in frontend are not that obvious to me that i could resolve them on my own!

Kirill A. Korinsky
@catap
@gmixa you can put your question here. I've migrated g.8 from 0.8 to 0.9; it was a bit strange but I managed it
Dawid Dworak
@ddworak
@gmixa no significant features were removed, I'll take my shot at migrating a template-generated project and let you know how it went
Dawid Dworak
@ddworak
@gmixa this would be the migration of the default (template) project ddworak/udash-0.9-migration@1e696fa
Kirill A. Korinsky
@catap
@ddworak my guess is removing model validation is confised @gmixa
Gerald Mixa
@gmixa
@ddworak seems i did not get that i just can delete some parts
Kirill A. Korinsky
@catap
@gmixa it also confused me a lot