Zero-to-Heroes / firestone

Hearthstone companion for Overwolf
123 stars 25 forks source link

Firestone twitch extension always shows BG elements regardless if in BG (or hs), and settings don't work #71

Closed g-k-m closed 2 years ago

g-k-m commented 2 years ago

Like, i get it, 90% of hs streamers are BG streamers. But for us plebs who still play hs, it's very annoying, if u wanna have the "mouseover on card tooltip" u need firestone enabled, but then you get these 3 stuff that always show no matter:

image

Left: settings (this one can remain i guess, but maybe more transparent?) Top: Win Tie Loss chance Top right: Turn and encyclopedia of minions

The latter two are very annoying and take a decent amount of space for when u're playing hearthstone and not BG. If not playing hs then one can hide the extension (the viewer not the streamer), but since i don't play BG and i only stream hs, viewers either have to not use the extension at all by hiding it, or put up with the annoying Top and Top right banners. Left is also a bit annoying but less so, but some transparency could definitely be applied on it, u only need the Settings once, not all the time, so they should be somewhat visible but not 100% visible.

On another note, the settings don't work at all

image

Even with this setup, the top and top right banners still show. Perhaps this is the whole problem.

sebastientromp commented 2 years ago

Hey, thanks for the report!

There are actually several issues at play here:

  1. I accidentally committed a version that adds a "debug state" when loading the extension for the first time (this is what the Turn 14 is about). It will be fixed in the next Twitch release
  2. When going into a non-BG game, the BG widgets should disappear. I just tested it myself, and that's the case for me
  3. The settings should properly hide the widgets. Again this is working on my side.

For 1), the main issue is that releasing an update to Twitch is really cumbersome. It basically requires that I leave my PC running for a full week streaming, so I can't fix small bugs easily. 2) and 3) look like issues either on your side, or on the streamer's side.

I tested the extension with Chrome and Firefox (both latest versions). Are you using one of these browsers? Could you send me the link to the Twitch channel with the issue?

Thanks again for the report :)

g-k-m commented 2 years ago

Ok so I figured out the problem. Now we know that in newer Browsers like Tor or hardened firefox, block third party cookies is enabled by default, and honestly, there is no reason why it shouldn't be. I always have it enabled. But for some reason, twitch extension, like the plebs they are (or you idk xD) stores the settings on the extension in "localstorage" as on my friend's pc latest version of Edge Version 99.0.1150.36 (Official build) (64-bit) the settings for hiding the BG bars work perfectly (BG bars still don't hide auto hide)

However on my pc with latest edge same version, i get this:

image

And the important one:

image image

So i googled about this error and apparently it's caused when blocking third party cookies, but that's pretty much mandatory if u don't wanna be tracked everywhere i go, i've never had issues with having them blocked, so idk if it's twitch fault's or yours but imo it should not use third party cookies to store the settings.

If "decktracker.js" is your doing, then it's probably you, otherwise it's probably twitch

So if i unblock the top cookies

image

It works normally.

The part that is underline with the red curvy line as wrong in decktracker.js, is this:

const prefsStr=localStorage.getItem("firestone-twitch-preferences"),prefs=prefsStr?Object.assign(new twitch_preferences_1.TwitchPreferences,JSON.parse(prefsStr)):new twitch_preferences_1.TwitchPreferences;this.prefs.next(prefs)}async savePrefs(value){localStorage.setItem("firestone-twitch-preferences",JSON.stringify(value)),this.prefs.next(value)}}},"./src/js/components/decktracker/overlay/twitch/twitch-preferences.ts":function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TwitchPreferences=void 0;exports.TwitchPreferences=class TwitchPreferences{constructor(){this.showHeroCards=!0,this.showMinionsList=!0,this.showMinionsListGoldenCards=!0,this.showBattleSimulator=!0,this.battleSimScale=100,this.minionsListScale=100,this.heroBoardScale=100}}},"./src/js/components/filter-dropdown.component.ngfactory.js":function [and so on not gonna paste the entire code]

I used hs deck tracker before and i don't think i had that error, so idk how they did it but i don't think firestone should work this way

once i enabled the cookies, this window appears

image tho i think this was on m.twitch.com/streamname, not sure if it appears on the desktop version without "m." too

so once i had this exception for third party cookies in Chromium image image

everything worked correctly. Of course bg bars still don't hide auto when not playing BG.

sebastientromp commented 2 years ago

localStorage (which I use to store the user's preferences) is a pretty standard way to store user data.

Looking a bit into it, it seems to be related to how Twitch loads the extension, which could cause the localStorage to fail. I don't think I have a way around this (so your settings will not be persisted), but I will see if I can at least make the setting work for the duration of the current session.

Thanks for the investigations :)

sebastientromp commented 2 years ago

This will be fixed with the next release of the Twitch extension.

If you block third-party sites from storing data, the settings won't be saved across sessions, but you will still be able to modify them for the duration of your current session.