Fork me on GitHub
#clojurescript
<
2020-02-29
>
Pavel Klavík10:02:15

Hi, I am trying to allow my app to be embedded into other websites. I am removing X-Frame-Options on embedding routes to allow cross origin embeddings. But Sente handshake fails with 403. Any idea what might be wrong? If I open the route directly, everything works.

Pavel Klavík12:02:24

Removing Samesite from cookies makes it work. Not sure what is correct from security standpoint.

thiru20:02:10

Not sure what I'm missing but can't seem to disable console printing. E.g. entering (println 123) always prints in the browser console. I setting *print-fn* to nil and also tried using (set-print-fn!) but they don't seem to have any effect. Any ideas guys?

p-himik20:02:04

Are you sure set-print-fn! is not called later by something else?

p-himik20:02:34

Print the value of *print-fn* at some point in your program where js/console.log still works.

p-himik20:02:57

Or alternatively, call set-print-fn! with something and immediately call js/console.log.

p-himik20:02:19

Note: *print-fn* cannot be nil.

thiru20:02:35

Yeah I'm actually calling set-print-fn! from a repl, so nothing is running after

thiru20:02:41

E.g. I run: (set-print-fn! (fn [] (js/console.log 123)))

thiru20:02:58

then I call (println "A") and I see A in the browser console

thiru20:02:10

I should see 123 right?

p-himik20:02:49

What do you see if you output the *print-fn* itself?

p-himik20:02:15

Also, try doing (do (set-print-fn! (fn [] (js/console.log 123))) (println "A")) - what do you see then?

thiru20:02:19

Nothing useful really. It's always: #object[Function]

p-himik20:02:40

Ah, right, because it turns into a string beforehand.

p-himik20:02:58

Ah, wait, output it with just js/console.log, not with println.

thiru20:02:03

Oh interesting.. you're sample workss

p-himik20:02:12

Your REPL does something funky.

p-himik20:02:30

It seems like it calls set-print-fn! before or after each command.

thiru20:02:33

Hmm ok. I am using rebel-readline. Maybe that's the cause

p-himik20:02:42

Or maybe it calls enable-console-print!.

thiru20:02:55

Ah ya could be

thiru20:02:03

Thanks for your help! 🙂

p-himik20:02:16

rebel-readline is CLJS-agnostic, right? If so, then it shouldn't be it.

p-himik20:02:50

What REPL do you use?

p-himik20:02:58

Do you have any middleware?

thiru20:02:01

agnostic? not sure how. It has custom interop for it as far as I can see

thiru20:02:14

with nrepl I'm using piggieback

thiru20:02:54

I'm also using figwheel-main

thiru20:02:41

Maybe it's one of those? I'll try removing each and see.. thanks again!

👍 4
thheller21:02:31

I think figwheel binds print-fn with every eval

thiru21:02:16

Setting :client-print-to to [:repl] does what I want

thiru21:02:22

thank you!

knubie21:02:24

How do you run a single test (with fixtures)?