Tucsky / aggr

Cryptocurrency trades aggregator
https://charts.aggr.trade/
GNU General Public License v3.0
836 stars 241 forks source link

Embedded website render error #210

Closed VanessaE closed 1 year ago

VanessaE commented 2 years ago

Describe the issue

I have https://market24hclock.com/?set_theme=dark docked into a "website" pane in v3.aggr.trade. However, the clock renders in light mode, not dark mode, as though the bit after "?" in the URL is being discarded.

image

I see only two entries in the browser's console related to the page in question:

image image

My database file: aggr-lrnm.txt

Steps to reproduce

Just create a layout, add a "website" pane, and put the above URL in.

adeacetis commented 1 year ago

Hello,

I have tested your issue and I could reproduce the issue in production. In my local dev instance, the clock appears black as it should.

Searching why.

EDIT: It doesn't work on dev. Even though, we're hitting the server with the right request. The server doesn't send us the right assets. However, it downloads the light theme every single time.

EDIT 2: Alright, the dark theme works in Firefox (left) but not in Chrome (right). Can you confirm this?

image

VanessaE commented 1 year ago

I can confirm it, the dark theme works fine inside the embedded pane in Firefox but not Chrome.

adeacetis commented 1 year ago

Hello,

I think I have a lead on why it's happening.

The clock script takes the theme attribute from a cookie it saved on your machine. The problem is that Firefox and Chrome/Edge have stricter CRSF policies than Firefox - they changed it around 2020.

Read on here: https://stackoverflow.com/a/45095345

Normally, the site editor should set the cookie parameters on his end. However, you can edit manually the cookie in the developer console (in Chrome ) - still need to test if this persists. Just make sure that the theme cookie has Secure set to true (checkbox) and SameSite set to "None". If you delete the cookie, you'll have to redo it again.

1) Open the developer console 2) Under Storage > Cookies select the market24clock domain and change the values directly in the columns like so:

image

Results on Chrome 114:

image

In Edge 114 - the problem is different:

The cookie isn't even added to the browser. So, I added it manually and it worked. It's definitely not a problem specific to Aggr, but I am glad I found out the problem wasn't related to our code. image

Close the issue if this is resolved.

VanessaE commented 1 year ago

Well, manually editing/adding a cookie as you describe is simply unworkable -- I'll never remember that, and besides, it's the browser's job to do that. :stuck_out_tongue:

But that's okay... it's sufficient to just leave the clock in light mode, and then switch the aggr pane to "inverted" color mode -- a mode which did not exist when I originally filed this issue. The colors may be somewhat "wrong" compared to what the website designer intended, but it still achieves the desired effect.

adeacetis commented 1 year ago

I agree with you, although that's the best we could do. I already wrote down to Market24hclock on Twitter asking if they were willing to change the cookie parameters. That's all I can do.

I learned something while helping you out. All is not lost. :)

Have a good day.