V1P3R-FMG / free-map-genie

Chromium/Firefox extension that unlocks mapgenie pro features for free.
MIT License
155 stars 11 forks source link

[BUG] Unable to select filters #21

Closed Tim040 closed 10 months ago

Tim040 commented 1 year ago

Extension largely works as intended on iOS, using Orion Browser having installed the Firefox version if this extension, but I cannot click on the filters while the extension is active. Without the extension this does work.

Not too sure if this is an issue because I am using it from my phone

MrFusiion commented 1 year ago

Well filters should work for both the chrome and firefox versions. But because I don't own an iOS device I can't actively target/debug for this platform.

BasedOnPixels commented 1 year ago

I can't toggle any of the filters on firefox. I can mark objects on the map but I can't interact with the filters on the left in any way. Game I tried it on was Elden Ring.

firefox_2023-11-15_18-00-11

MrFusiion commented 1 year ago

Well tested it on firefox-desktop-120.0b9, And it still seems to work for me. Do the filters work occasionally or non at all?

It would also be helpful to provide:

Errors for FMG are prefixed.

image

Errors for mapgenie will have map.js as src.

image

BasedOnPixels commented 1 year ago

I'm running Firefox 119.0.1 (64bit) on Windows 11

When I open the site it refreshes like 4-5 times by itself or something, during which I'm able to turn filters on/off. Only after it stops I can't interact with it anymore.

I have turned off all my browser add-ons just in case but it didn't help either.

Errors/warnings I don't see any on the site itself, I'm not sure if the error from the console will help much.

https://puu.sh/JUzIo/02dec08d40.mp4


Error: NetworkError when attempting to fetch resource.
    l ajax.js:161
    promise callback*l ajax.js:156
    xt ajax.js:190
    xt ajax.js:247
    bt ajax.js:262
    At ajax.js:348
    i ajax.js:341
    a ajax.js:350
    p ajax.js:181
    promise callback*p ajax.js:170
    l ajax.js:151
    promise callback*l ajax.js:148
    xt ajax.js:190
    xt ajax.js:247
    bt ajax.js:262
    At ajax.js:348
    _spriteRequest load_sprite.js:28
    _loadSprite style.js:285
    _load style.js:257
    _request style.js:235
    frame browser.js:35
    loadJSON style.js:233
    _updateStyle map.js:1377
    setStyle map.js:1346
    r map.js:467
    value map.js:1
    value map.js:1
    46675 map.js:1
    o map.js:1
    <anonymous> map.js:1
    O map.js:1
    <anonymous> map.js:1
    <anonymous> map.js:1
[mapbox-gl.js:31:21229](https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js)
Object { message: "NetworkError when attempting to fetch resource.", stack: "" }
[mapbox-gl.js:31:21229](https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js)
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    _tileLoaded https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    request https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    processTask https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    receive https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    (Async: EventListener.handleEvent)
    Fl https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    e https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    i https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    _updateStyle https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    setStyle https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    r https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    value https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    value https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    46675 https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    o https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    O https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
Object { message: "NetworkError when attempting to fetch resource.", stack: "" }
[mapbox-gl.js:31:21229](https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js)
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    _tileLoaded https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    request https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    processTask https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    receive https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    (Async: EventListener.handleEvent)
    Fl https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    e https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    i https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    _updateStyle https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    setStyle https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    r https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    value https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    value https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    46675 https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    o https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    O https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
Object { message: "NetworkError when attempting to fetch resource.", stack: "" }
[mapbox-gl.js:31:21229](https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js)
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    _tileLoaded https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    request https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    processTask https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    receive https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    (Async: EventListener.handleEvent)
    Fl https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    e https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    i https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    _updateStyle https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    setStyle https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    r https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    value https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    value https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    46675 https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    o https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    O https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
Object { message: "NetworkError when attempting to fetch resource.", stack: "" }
[mapbox-gl.js:31:21229](https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js)
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    _tileLoaded https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    request https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    processTask https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    receive https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    (Async: EventListener.handleEvent)
    Fl https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    e https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    i https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    _updateStyle https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    setStyle https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    r https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    value https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    value https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    46675 https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    o https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    O https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
Object { message: "NetworkError when attempting to fetch resource.", stack: "" }
[mapbox-gl.js:31:21229](https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js)
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    _tileLoaded https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    request https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    processTask https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    receive https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    (Async: EventListener.handleEvent)
    Fl https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    e https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    i https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    _updateStyle https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    setStyle https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    r https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    value https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    value https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    46675 https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    o https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    O https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
Object { message: "NetworkError when attempting to fetch resource.", stack: "" }
[mapbox-gl.js:31:21229](https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js)
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    fire https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    _tileLoaded https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    request https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    processTask https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    receive https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    (Async: EventListener.handleEvent)
    Fl https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:31
    e https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    i https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    _updateStyle https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    setStyle https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    r https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js:35
    value https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    value https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    46675 https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    o https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    O https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
    <anonymous> https://cdn.mapgenie.io/js/map.js?id=e14ebee6f48db8cde588:1
Uncaught Error: Style is not done loading
    _checkLoaded style.js:373
    setFilter style.js:831
    setFilter map.js:2002
    value map.js:1
    value map.js:1
    Uo map.js:1
    Uo map.js:1
    Bo map.js:1
    o map.js:1
    toggleCategory map.js:1
    onClick map.js:1
    We map.js:1
    Ke map.js:1
    _o map.js:1
    _o map.js:1
    Oo map.js:1
    No map.js:1
    De map.js:1
    No map.js:1
    No map.js:1
    Jt map.js:1
    Qt map.js:1
    unstable_runWithPriority map.js:1
    Hr map.js:1
    Re map.js:1
    Yt map.js:1
    Io map.js:1
    Mo map.js:1
    To map.js:1
    To map.js:1
    tc map.js:1
    _reactRootContainer map.js:1
    oc map.js:1
    render map.js:1
    46675 map.js:1
    o map.js:1
    <anonymous> map.js:1
    O map.js:1
    <anonymous> map.js:1
    <anonymous> map.js:1
[style.js:373:18](https://api.mapbox.com/mapbox-gl-js/src/style/style.js)
    _checkLoaded style.js:373
    setFilter style.js:831
    setFilter map.js:2002
    value map.js:1
    value map.js:1
    Uo map.js:1
    Uo map.js:1
    Bo map.js:1
    o map.js:1
    toggleCategory map.js:1
    onClick map.js:1
    We map.js:1
    Ke map.js:1
    _o map.js:1
    _o map.js:1
    Oo map.js:1
    No map.js:1
    De map.js:1
    No map.js:1
    No map.js:1
    Jt map.js:1
    Qt map.js:1
    unstable_runWithPriority map.js:1
    Hr map.js:1
    Re map.js:1
    Yt map.js:1
    (Async: EventListener.handleEvent)
    Io map.js:1
    Mo map.js:1
    To map.js:1
    forEach self-hosted:4356
    To map.js:1
    tc map.js:1
    _reactRootContainer map.js:1
    oc map.js:1
    render map.js:1
    46675 map.js:1
    o map.js:1
    <anonymous> map.js:1
    O map.js:1
    <anonymous> map.js:1
    <anonymous> map.js:1
​```
MrFusiion commented 1 year ago

~~The refreshing is because the extension can't communicate with the extension script. One case I know this can happen is when permissions are not enabled for the extension. And Firefox/Chrome won't append the extension script to the page.~~

~~Another case is when the extension is added after you went to a map page. That's why it refreshes the page.~~

~~Just to make sure can you check if permissions are enabled for the extension. Step 6 in Firefox install guide. Firefox installation guide~~

For now I maybe work on something that will try to detect this and warn the user instead of refreshing the page.

Edit: Well the refreshing is done by the content script and not the popup. So that means it had enough permission to inject the script. The reason the content script refreshes is because the window.strore object is already defined. I have to look further into this.

The issue is probably with the background script for Firefox which prevents the map script from loading. So my extension has time to setup. And it tells the background script to load the map script after its done. But probably in your case the background script is unable to block the script and hence why window.store is defined.

MrFusiion commented 1 year ago

One thing for sure is that I will remove the auto reload and instead change it to a warning/error, and request the user to reload the page.

MrFusiion commented 1 year ago

@BasedOnPixels It could be helpful for me if you could check this for me.

As of now I'm unable to reproduce the bug which makes it harder to fix.

I'm also providing my latest dev build which removed the auto-reloading and changed to an error instead. You can try installing this as a temporary add-on in about:debugging#/runtime/this-firefox page. And see without reloading if the extension works. fmg-firefox-v2.0.2-dev.zip

BasedOnPixels commented 1 year ago

The background script is stopped on the about:debugging page. If I load it in as a temporary add-on, i can reload it and it is running at first but stops seemingly after a while or after visiting mapgenie.
Edit: After stopping a few times on it's own, it seems to be running now but still doesn't work on mapgenie.

The regular and the dev build didn't have any errors.

On the mapgenie.io page it tells me that window.store is already defined and asks me to reload the page.

MrFusiion commented 1 year ago

Well the background script stopping is normal to save resources, the important thing is that the background script should turn on when you go to a mapgenie map page.

You can check if the background script blocks the map script correctly by clicking on the inspect button in the about:debugging page and it will open a dev tools window, go to the console tab. And open a mapgenie map and if everything is right it should print a block request, redirect request and a allow request.

[!IMPORTANT] Make sure you do this with the dev build version as info and dev log messages are disabled on the release version of the exrension.

image

MrFusiion commented 1 year ago

On the mapgenie.io page it tells me that window.store is already defined and asks me to reload the page.

By mapgenie.io page do you mean the homepage? image Because that should not be happening. If so open the dev tools on the homepage you can do this by pressing f12. And type window.store in the console. image It should return undefined.

BasedOnPixels commented 1 year ago

Oh no, i meant generally on mapgenie.io, as in the Elden Ring map, sorry for not being clear about it. On the main page it doesn't show the error and window.store returns undefined.

The console on the dev add-on doesn't say more than "Background script loaded".

image

MrFusiion commented 1 year ago

Ok so there is one problem the backgrounds script is unable to block the script hence why window.store is already defined. Now to find out why its unable to block.

BasedOnPixels commented 1 year ago

I just figured it out.

I had to enable "Access your data for all websites". I thought turning on data for mapgenie.io was enough due to it only requiring access to the site?

image

image

MrFusiion commented 1 year ago

Ok good, But does that fix the filter bug?

I had to enable "Access your data for all websites". I thought turning on data for mapgenie.io was enough due to it only requiring access to the site?

To be honest I'm not completely sure why that fixes the background script. For the background script the *://mapgenie.io permission should be enough I think. One reason it needs access to all sites is some maps are hosted on different hosts than mapgenie.io, example fallout 4.

MrFusiion commented 1 year ago

image Maybe I can finally switch over to declarativeNetRequest for Firefox. Which I already use for the chrome version.

BasedOnPixels commented 1 year ago

It does fix the problem, I can set filters and they all save and load when I refresh the page. It seems to be completely working now after giving it full permission to all sites.

MrFusiion commented 1 year ago

That is good,

Well just implemented declarativeNetRequest for the Firefox version, which doesn't need any extra permissions as far as I know. As for the OP case its probably the same issue. So I will mark this as solved for now. It can always be reopened.

Solution:

I just figured it out.

I had to enable "Access your data for all websites". I thought turning on data for mapgenie.io was enough due to it only requiring access to the site? image

Tim040 commented 1 year ago

I tried the new release and I get the new ‘window.store is already defined’ error pop-up, but I assume this is because the browser I am using on my phone does not allow to set the optional permissions.

I think a fix for this could be to have these permissions set as required instead of optional, but that’s probably not a desirable solution.

MrFusiion commented 1 year ago

I think a fix for this could be to have these permissions set as required instead of optional, but that’s probably not a desirable solution.

Its a manifest v3 issue which makes some permissions optional on some browsers. I don't have the agility to force these permissions as far as I know.

Well I found out what breaks the filter, The map.js script is loaded twice the default one because my background is unable to block it, and once after my extension is done with the setup phase. So one easy fix is to check if the store is already defined and not load the map a second time. But some features may not work.

A second solution is add a second Firefox version for manifest v2 which I don't think has the optional permissions by default.

Edit: For some reason a idea came to mind, currently simulating a script block by intentionally crashing the map.js script. This is maybe a solution without extra needed permissions.

MrFusiion commented 10 months ago

Its possible that this issue is fixed by disabling the declarative net request option in the browser action. If it still does not work reopen this thread or post a new issue.