Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 10 03:35
    sanity commented #86
  • Dec 10 03:35

    sanity on master

    revert changes made while hunti… (compare)

  • Dec 09 19:20
    GenerRR closed #86
  • Dec 09 19:20
    GenerRR commented #86
  • Dec 09 18:35
    sanity commented #86
  • Dec 09 15:57
    sanity commented #86
  • Dec 09 15:54
    sanity commented #86
  • Dec 09 15:53
    sanity commented #86
  • Dec 09 09:28
    GenerRR edited #86
  • Dec 09 09:26
    GenerRR commented #86
  • Dec 09 09:26
    GenerRR edited #86
  • Dec 09 09:24
    GenerRR reopened #86
  • Dec 09 09:24
    GenerRR commented #86
  • Dec 09 09:24
    GenerRR edited #86
  • Dec 09 08:51
    GenerRR closed #86
  • Dec 09 08:51
    GenerRR opened #86
  • Dec 08 02:34

    sanity on master

    static files plugin was causing… (compare)

  • Dec 08 02:24

    sanity on master

    static files plugin was causing… (compare)

  • Dec 05 16:05
    sanity opened #85
  • Dec 05 07:58
    hannespernpeintner closed #83
Ian Clarke
@sanity
@rpanic Hmm, it should, I will investigate
Ian Clarke
@sanity
@rpanic (cc: kwebio/shoebox#6)
Raphael Panic
@rpanic
@sanity Is there any way to get access to ktor at the moment? I specifically need it for TLS / HTTPS usage. Is kwebio/core#39 needed for TLS?
Ian Clarke
@sanity
@rpanic I'm not sure if this will quite cut it, but I just added open fun ktorApplicationConfigurator(applicationHandler : Application) to KwebPlugin, that will allow you to configure Ktor via the plugin mechanism.
@rpanic However, I haven't configured Ktor for TLS/HTTPS before so I'm not quite sure if this will work, you can see where it hooks in to Ktor here: https://github.com/kwebio/core/blob/master/src/main/kotlin/io/kweb/Kweb.kt#L111
@rpanic Let me know if that's insufficient for what you need, I can modify it easily.
Raphael Panic
@rpanic
@sanity Well, SSL has to be configured before the Jetty Server starts
You can either configure it with the application.conf file or by code using
embeddedServer(Jetty, applicationEngineEnvironment {
        config = MapApplicationConfig().apply { put("ktor.security.ssl.keyStore", "<path>\\keystore.jks") }
    })
I guess that would be a bit more complicated to configure that
I don´t neccecarily need it at the moment, but I guess it has to be implemented at some point in the future
Should I create an issue for it?
Ian Clarke
@sanity
@rpanic Yes, please create an issue, it will be easy enough to add this functionality, we just need to decide on how best to do it
Raphael Panic
@rpanic
@sanity Ok, perfect
Ian Clarke
@sanity
FYI - work-in-progress, cleaning up Kweb "god" class: https://github.com/kwebio/core/pull/63/files
Ethan Davidson
@ethanmdavidson
@sanity re: #64 (people searching for validation)
just curious, how do you know this?
Ian Clarke
@sanity
@ethanmdavidson It's through an analytics tool called Inspectlet which I have on the user manual, it tracks search terms among other things.
@ethanmdavidson I'm not sure of the priority, but I try to note when I see people are searching for something and not finding it in the user manual - it can be a good indicator of what needs improvement.
Benjamin Dupont
@Benjozork
hello, do you accept donations/bounties ?
Ian Clarke
@sanity
@Benjozork We haven't done that before, but we're certainly open to it. Did you have something specific in mind?
Patrick Cousins
@patrickcousins
(posted in kotlinlang slack as well) anyone get an error like this?
22:19:38.858 [qtp2129221032-26] ERROR io.kweb.WebBrowser - JavaScript message: 'Cannot read property 'parentNode' of null' Caused by executing: 'document.getElementById("Kg").parentNode.removeChild(document.getElementById("Kg"));': at io.kweb.Kweb.execute(Kweb.kt:323) at io.kweb.WebBrowser.execute(WebBrowser.kt:48) at io.kweb.dom.element.Element.execute(Element.kt:40) at io.kweb.dom.element.Element.delete(Element.kt:290)
for reference I am trying to do something like this
render(boolKVar) { if (boolKVar.value) { div().new { p().text("Loaded.") } } else { div().new { p().text("Loading...") } } }
Ian Clarke
@sanity
@patrickcousins I'm not sure if this is the cause of your problem, but that should be render(boolKVar) { bool -> if (bool) {...

A more idiomatic and slightly more efficient version would be something like:

    div().new {
      p().text(boolKVar.map { if (it) "Loaded." else "Loading..." })
    }

If that doesn't fix it, could you file an issue, with as much relevant info as you can provide? https://github.com/kwebio/core/issues/new - I'll look into it ASAP.

Patrick Cousins
@patrickcousins
that looks much cleaner thank you. I had wondered if I should be using .map but got confused by the reversable function stuff. I ended up finding a different hacky work around but I will try .map next time I dig in. Thanks again for the reply! kweb is amazing!
Ian Clarke
@sanity
@patrickcousins Hmm, it should be rare that library users need to use reversible mappings - it's mostly useful for internal stuff. Perhaps I'll add a note to the docs to that effect.
Raphael Panic
@rpanic
@sanity as we discussed a few weeks ago, there are a lot of cases where you need reversible mapping. Thats why you added it to the docs in the first place 😏
Ian Clarke
@sanity
@rpanic Don't worry, it's still documented :)
Linus Brimstedt
@brimstedt_twitter
Hi! One question I'm missing on the faq is if you (keen)
(keen) handles web server failovers. For example, if one server dies and use is forwarded to another backend node
(#
(sorry for the bad writing, my phone is playing tricks on me .. keen=kweb above)
Linus Brimstedt
@brimstedt_twitter
(sorry for the bad writing, my phone is playing tricks on me .. keen=kweb above)
Linus Brimstedt
@brimstedt_twitter
I.e. how important is the server session and what is kept in it? I see you compare a bit to vaadin, where session is quite heavy
Ian Clarke
@sanity
@brimstedt_twitter Kweb’s architectural approach means that you can hit “reload” in your browser and rarely lose anything of importance. This is because, while it does maintain session state, this state can be “reconstructed” automatically in the event that the session is lost.
@brimstedt_twitter For this to work well it’s important to represent the important state of the UI (eg. what part are you looking at) in the URL, but Kweb’s routing makes that easy, and that’s best practice anyway.
@brimstedt_twitter You can try it out by going to the demo at http://demo.kweb.io:7659/, making some edits - and then refresh the page, note how it is reconstructed identically.
@brimstedt_twitter Does that answer your question?
Linus Brimstedt
@brimstedt_twitter
No, not really.. the question was more about how dependent kweb is on server session
I.e. do I need sticky sessions and shared session storage of some sort?
If one webserver crashes and another one takes over, will the end user notice?
Ian Clarke
@sanity
The page would refresh when the websocket is broken, but assuming the page routing had been implemented intelligently - that should be barely noticeable.
So the simple answer to your question is: No, you shouldn’t need to worry about persisting sessions across servers, sessions in Kweb are assumed to be quite transient.
Linus Brimstedt
@brimstedt_twitter
Ok, thanks :-)
Ian Clarke
@sanity
Announcement: New version, I've reworked the render mechanism to make it more robust, by wrapping the rendered content in a <span>: https://github.com/kwebio/kweb-core/releases/tag/0.4.26
Ian Clarke
@sanity
I'm a little concerned about "silently" inserting a "span", but avoiding it would require doing a lot of housekeeping to allow elements to be replaced in-place (something that wasn't working previously)
Damian Lall
@PotatoCurry
How do I generate head/meta HTML via the DSL?
Ian Clarke
@sanity

@PotatoCurry Something like this should work:

Kweb(port = 7659) {

        doc.head.new {
            title().text("Hello")
        }

You can also add stuff to the <head> by creating a simple plugin to add to the <head> element by overriding KwebPlugin.decorate().

Raphael Panic
@rpanic
Hello,
Im not quite sure if thats duplicate or not.
But is there a way to use static files like images?