ddworak on silencer
ddworak on master
Replace silent with nowarn Scala 2.12.13, remove silencer Fix recursive implicits in Prop… and 2 more (compare)
ddworak on scalacss-0.7.0
ddworak on master
Update scalacss:core to 0.7.0 Merge branch 'update/scalacss-0… Typed content attribute migrati… and 1 more (compare)
ddworak on silencer
Update CI Scala versions (compare)
ddworak on silencer
Fix recursive implicits in Prop… (compare)
ddworak on silencer
Replace silent with nowarn Scala 2.12.13, remove silencer (compare)
ddworak on scala-collection-compat-2.3.1
ddworak on scalacss-0.7.0
Update scalacss:core to 0.7.0 Merge branch 'update/scalacss-0… Typed content attribute migrati… (compare)
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)
dom.window.href = "???"
or dom.window.replace(...)
are fully expected to work. If you have states, you can also rely on application.goTo
.
@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
?
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?
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:
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
.
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.
application.onRoutingFailure
; but it is a bit wired, isn't it?
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.
@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.
@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
@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
@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.
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!