bartbutenaers / node-red-contrib-ui-svg

A Node-RED widget node to show interactive SVG (vector graphics) in the dashboard
Apache License 2.0
94 stars 27 forks source link

Layer : Feature is available only with expert mode #108

Open sniicker opened 2 years ago

sniicker commented 2 years ago

Hi, what happened with the Layer function. I'm getting this message now: Feature is available only with expert mode?? How to activate?

Some Weeks ago i could use layers without problems?

V 2.2.4 Thx

bartbutenaers commented 2 years ago

Hi @sniicker,

Indeed you are right. I have quickly tested the layers and now it is only available in expert mode...

I have send a mail to the DrawSvg developer to ask about this change. I would have expected that he would add new features to the (newly introduced) expert mode, but not existing features. Especially the layers, because that is something that we - at the time being - have asked him to implement, because it was a basic requirements for us (e.g. for floorplans). When he added the layers for us, @Steve-Mcl and I decided to integrate DrawSvg (instead of svgedit which was our second choice).

As soon as I get an answer, I will give you an update here.

Bart

bartbutenaers commented 2 years ago

Hi @sniicker, Got feedback from the DrawSvg developer, and he confirms your observations... So if you want to use the layers, you need to pay for his expert profile or start using an old version of node-red-contrib-drawsvg (I have added a link for more information here). Note that it is currently not possible to show the expert mode icon when accessing DrawSvg via Node-RED. The developer is looking for a solution.

I am going to close this issue, since unfortunately I can't do anything about this... Bart

Steve-Mcl commented 2 years ago

Its a shame about the DrawSVG situation.

sniicker commented 2 years ago

Oh Boy ...

Thats not what i wanted to hear, but thx @bartbutenaers for asking. So looks like i go back to V8.0 ...

sniicker commented 2 years ago

Hi @bartbutenaers ,

i now came to the point where i have to pay for this abo. I made an account at Patreon & bought the expert feature. Now i want to log in
image

but browser says "www.patreon.com refused the connection" image

Can you please help out? Also tried with other browsers. Node is up to date!

Thx! Nice Greetings

bartbutenaers commented 2 years ago

Hi @sniicker,

I am very sorry to hear that you finally had to pay to have layers, since layers was our feature request (at the time being).

Well I don't think I can test this myself, since I don't have an identification on Patreon. For the simple reason that I don't buy software, while I am developing free software for others in my spare time. That would feel a bit too weird, if you know what I mean...

I have forwarded your question to the author of DrawSvg, and hopefully he knows how to solve this. Perhaps some changes need to be done in the SVG node, but I don't know at the moment. Because I don't see anything about Patreon or OAuth in his API.

I will keep you updated, as soon as I get feedback! Bart

sniicker commented 2 years ago

Hi @bartbutenaers

yes its really bad. :-/

Yes i know what you mean, but if you try and click on "identify on patreon" it should link you somewhere. This should work for you also..

I also had a mail conversastion with joseph yesterday. He helped me out and sent me an expert access code, but i think thats not the way it should work and its important to solve it for others too.

Thank you so much for you hard work!

Nice greetings sniicker

bartbutenaers commented 2 years ago

I was indeed able to reproduce this quickly, by clicking the patreon button. Then I see this in my Chrome browser:

image

The svg node opens DrawSvg embedded within an iframe. And it is not allowed by modern browsers to open an http connection (to Patreon in this case) from within an iframe, when the iframe is embedded within a webapp (i.e. the Node-RED flow editor web app) that uses https.

Which is kind of normal, because otherwise you would think all your data travels safely via an SSL connection (because you see https in your browser address bar, pointing to your Node-RED system). While everything is send behind your back over plain unsecure http. Which is of course not a good idea...

So I have now send a mail to Joseph to aks him to use a https connection to Patreon instead of http. Note that I don't have his code, so I can only assume that is the problem... And no guarantee that this will solve all your problems, because modern browsers have secured cross origin resource access quite heavily. Which means there are a lot of other security checks!! See [CORS](https://geekflare.com/cors-basics/#:~:text=Cross%2DOrigin%20Resource%20Sharing%20(CORS,resources%20from%20a%20different%20origin) if you are interested in technical details...

P.S. It might be that it works correctly when you navigate directly to drawsvg.org (without using Node-RED in between). Because in that case you arrive at the DrawSvg webapp immediately, i.e. there is no iframe around it. That is a completely other kind of setup...

To be continued...

bartbutenaers commented 2 years ago

Hey @sniicker,

Had some futher conversation with Joseph... It seems that he calls a https connection to Patreon, but that site redirects it from some point to a http connection. And modern browser don't allow that in an iframe, like we use Drawsvg.

When I turn off my SSL in Node-RED and connect to Node-RED via a http connection (instead of https), then the above error is of course solved. But then I get another error: image

Unfortunately my free time is too limited to figure out the root cause of this.

The best (read: less worst) workaround I can think of: copy your svg source into a third party editor, change it in that editor, and at the end past it back into the SVG source tabsheet of this node. Not as convenient, but it will probably work...