Fork me on GitHub
#hoplon
<
2016-05-26
>
onetom03:05:08

@jumblerg: i was using your version of ring cors [jumblerg/ring.middleware.cors "1.0.1"] is it still necessary or the default ring cors middleware is already ok to use?

jumblerg03:05:03

@onetom: i haven't kept track since i wrote it... is there middleware as part of ring that does this now?

onetom04:05:08

@jumblerg: yeah, this one: https://github.com/r0man/ring-cors i thought yours was a fork

jumblerg04:05:55

oh, no. the api is different

jumblerg04:05:24

i think there's an issue with the way it handles errors in some cases though, prs welcome.

leontalbot09:05:23

@flyboarder Oh, the "null" only appear in hoplon files, not html static files

leontalbot09:05:38

jquery problem?

leontalbot09:05:57

Does it have anything to do with compojure way of serving routes

(GET "/" req (-> "index.html"
                   response/resource-response
                   (response/content-type "text/html")))
vs
(GET "/eglise"  [] (io/resource "public/pages/eglise/index.html"))

dm309:05:13

did you upgrade to alpha-15? maybe that's related

leontalbot09:05:36

yes, I'll try alpha14

leontalbot09:05:38

I still have the problem with either alpha13 alpha14 and alpha15

leontalbot09:05:19

My public resources files are in /resources/public

leontalbot09:05:32

maybe that is where it fails

leontalbot09:05:29

I use :resource-paths #{"resources" "src/clj"} in build.boot and

(-> x
      (wrap-resource "public")
      (wrap-content-type)
      (wrap-not-modified)
      (d/wrap-defaults d/api-defaults)
      (castra/wrap-castra-session "a 16-byte secret")
      (castra/wrap-castra 'vpc-hoplon.api))

leontalbot10:05:15

@dm3 Interesting, the IE console says:

SCRIPT5007: Unable to get value of the property 'EMBED' of undefined or null reference
File: safehtml.js, Line: 311

leontalbot10:05:10

so it has to do with resources/public vs assets

leontalbot10:05:03

Folks, please have a look at hoplon-castra-template and please guys tell me how to fix it while still be able to have files in resources/public so that we can store config files in resources/private without exposing it to the browser!!

mynomoto14:05:02

@leontalbot: why not have a config path outside resources? You can add resource/public to resources and resources/private to sources and you should have what you want. You will need to tell ring wrap-resources that the root is "" instead of "public" that is the default iirc.

leontalbot14:05:11

@mynomoto: Thanks. Trying...

leontalbot15:05:07

@mynomoto: I was wrong the problem seems else where as if I use assets without public, I still get the error

leontalbot15:05:23

I'm trying with different version of hoplon now

mynomoto15:05:41

@leontalbot: is the project public on gh?

leontalbot15:05:57

yes, hoplon-castra template

leontalbot15:05:25

if you have IE 11 or any IE, you can test!

leontalbot15:05:14

oh... with alpha9 it works

mynomoto15:05:55

Oh, the problem is ie only?

leontalbot15:05:13

as always ☠️

leontalbot15:05:36

alpha10 ok...

leontalbot15:05:42

alpha13 problem

leontalbot15:05:57

will try to empty my .m2

leontalbot15:05:59

ok so I got this bug with alpha13 alpha14 and alpha15

micha15:05:45

@leontalbot: the best way to make things private is not to make a path convention, i don't think

micha15:05:06

the best way to do that is to have middleware that prevents unwanted things from being sent

micha15:05:35

you could have middleware in your server stack that whitelists or blacklists by extension

micha15:05:51

usually that's totally sufficient and way easier to audit and understand

micha15:05:26

so i never use the public/... and private/... convention, because it's a leaky abstraction

micha16:05:42

(defn wrap-blacklist [handler extensions]
  (let [match? (fn [uri] (some #(.endsWith uri %) extensions))]
    (fn [request]
      (if (match? (:uri request))
        {:status 403 :body "Forbidden"}
        (handler request)))))

leontalbot17:05:05

I still have the "null" issue on IE with alpha13-15 though

micha17:05:26

does ie have anything like extensions or plugins?

micha17:05:34

maybe there is some interaction with that?

leontalbot17:05:37

A customer I have alterted me. I don't know for him. But I can reproduce this with http://browserstack.com fresh IE VMs

micha17:05:07

interesting

leontalbot17:05:24

Null appears both as the first element of <head> and <body>

flyboarder18:05:03

^I wonder if it’s a jquery thing?

leontalbot18:05:15

were there changes from alpha12 to alpha13 that could corroborate this?

flyboarder18:05:06

@leontalbot: anyway to just not support IE? 😛 …… if only

flyboarder18:05:39

i wonder if it happens on Edge tho?

micha18:05:34

seems like it might be something related to that constructor function for making the singletons

micha18:05:37

like head and body

leontalbot19:05:29

@flyboarder: I see the same problem with IE 13 on windows 10

leontalbot19:05:17

@micha WOuld there be an easy way out?

jumblerg19:05:30

i think i introduced this regression while fixing another; most likely fix is to set innerHTML in the singleton ctor to empty string

micha19:05:45

we might want to roll that back

micha19:05:10

i don't think we want to support the reload in place until we know how to do it

micha19:05:36

like i just do window.location.reload() when the boot-reload task fires

micha20:05:05

yeah i think we want to roll back

jumblerg20:05:44

i suspect an empty string will fix the issue in ie

micha20:05:01

well i think there are more bugs in there

jumblerg20:05:09

wrt reload?

micha20:05:19

well definitely with reload

micha20:05:23

but just regular too

jumblerg20:05:37

it did fix another regression though

jumblerg20:05:03

i can take care of it if you like

jumblerg20:05:07

i would have chimed in much earlier, but thought i saw upstream that the issue was occurring in previous versions

micha20:05:24

the issue was with boot-reload originally?

micha20:05:20

ah i see what you mean now

micha20:05:41

(set! (.innerHTML elem) "") is what you want, instead of nil right?

micha20:05:51

ah that makes sense

jumblerg20:05:56

that will fix that specific bug, pretty straigtforward

jumblerg20:05:12

(i suspect, i don’t have ie on this box)

jumblerg20:05:43

i also need to make a change to properly handle nil on namespaced attributes

jumblerg20:05:04

yeah, i use it

jumblerg20:05:24

but not in this case, apparently 🙂

jumblerg20:05:50

@micha: incidentally, reload broke completely after i did boot -u yesterday, i just commented it out and kept going, something induced by the change to the boot template macro as i recall

leontalbot20:05:58

On another subject

(defmethod do! :selectize [elem _ opts]
  (.selectize (js/jQuery elem) (clj->js opts)))

(defelem select-field [{:keys [cell small] :as attrs} data]
  (div :selectize
       (select)
       {:options [(clj->js {"item" "1"})
                  (clj->js {"item" "2"})]
        :valueField "item"
        :labelField "item"}))
gives me: views.cljs:94 Uncaught TypeError: jQuery(...).selectize is not a function any ideas?

jumblerg20:05:31

@leontalbot: do your problems go away when your roll back to alpha14?

leontalbot20:05:43

Still a problwm

jumblerg20:05:00

the nil in the page body

leontalbot20:05:21

Body and head

jumblerg20:05:35

@leontalbot: just made a quick commit on master for the sake of expediency that i think may resolve your problem, can you clone and test?

jumblerg20:05:44

checkout master,`boot build-jar`, then try running your app in ie and let me know if the null in the body goes away.

leontalbot20:05:52

Ok. I am.on it tonight ! Thanks

jumblerg20:05:08

if this bug exists in alpha13 as well, however, this won’t fix it

leontalbot21:05:06

@jumblerg: bingo! it works!

leontalbot21:05:28

Much thanks! Would you or @micha bump a new release?

micha22:05:51

sure i'll doit

jumblerg22:05:31

@micha before the bumping, let me look quick at what is improperly handling the nils on ns’d attributes

jumblerg23:05:39

this is the boot-reload exception i started getting after upgrading boot, btw:

java.lang.IllegalStateException: template already refers to: #'boot.core/template in namespace: adzerk.boot-reload

micha23:05:12

ah bummer

micha23:05:18

it's harmless though

jumblerg23:05:10

@micha: i gave myself another thing i wanted (splitting up the protocols), but can’t seem to reproduce the nil reverting to less-than-sensibles-defaults issue i recall getting before. maybe i fixed it in a previous commit.

jumblerg23:05:03

also removed one of the monkeypatched Element fns that’s no longer being used

jumblerg23:05:10

i don’t have time tonight, but maybe we can remove them from the protocotype as discussed on alpha17 or whatever. in the interim, tag and deploy to clojars if the changes seem sensible to you.

micha23:05:22

sweet, i'll check it out