murdos / musicbrainz-userscripts

Collection of userscripts for MusicBrainz, by various authors
536 stars 90 forks source link

Discogs import script broken after firefox/greasemonkey update #354

Open eharris opened 3 years ago

eharris commented 3 years ago

Yesterday I rebooted and updated my firefox-esr on Debian Buster with the 78.7.0esr-1~deb10u1 version security update.

After restarting, I discovered that the discogs import script, even though it appears to still be installed and enabled, isn't showing anything on discogs pages where I would expect it.

Looking into it further, I also see that greasemonkey was updated to 4.11 yesterday, so I'm not sure if the problem was caused by firefox or greasemonkey.

I have downgraded firefox-esr back to version 78.5.0esr-1~deb10u1 (what's in stable without security fixes), and also downgraded greasemonkey back to 4.10, but the script still isn't working, so I'm at a loss as to the cause. Why it isn't working now after downgrading both is really strange, but maybe something was changed with the updates that didn't get reverted by downgrading?

Reporting here in case there is something that needs changing in the script to accommodate either the firefox-esr or greasemonkey updates. and for help in how to get it working again.

ggalan87 commented 3 years ago

Same issue with firefox/chrome and latest tampermonkey, so assume it is the discogs page that changed?

atj commented 3 years ago

Works fine for me using Violentmonkey on Brave. Can you open the web console and check if there any error messages?

atj commented 3 years ago

Based on this thread it appears you need to login to Discogs for the script to work:

https://community.metabrainz.org/t/discogs-import-script-not-working/516221

eharris commented 3 years ago

Based on this thread it appears you need to login to Discogs for the script to work: https://community.metabrainz.org/t/discogs-import-script-not-working/516221

I've never had to login before, and it has always worked, I've been using it a lot up until about 2 days ago when it broke.

If it really is the case that it doesn't work anymore without being logged in, seems like that should still be able to be fixed, since the data is still displayed without being logged in.

eharris commented 3 years ago

I checked the web console in Firefox, doesn't show any errors.

atj commented 3 years ago

I'm unable to replicate this in Firefox 85 with Tampermonkey 4.11.6120 or Greasemonkey 4.11 on Linux, or in Brave with Violentmonkey. The import buttons appear whether I'm logged in or out.

The only thing I can suggest at this point is try clearing your Discogs cookies. You can do this by opening the Storage Inspector (shift+F9), expand "Cookies" on the left, then right click on "https://www.discogs.com" and click "Delete All" from the context menu:

image

eharris commented 3 years ago

I've got my browser set to remove all cookies whenever I close it, so stale cookies isn't an issue. I've since tried the import script on Violentmonkey on the same browser, and it works there. So it seems to be a problem with Greasemonkey on Firefox.

atj commented 3 years ago

Glad you got it working. I'm afraid there's not much we can do unless it's reproducible.

@ggalan87 is it still not working for you? Can you try Violentmonkey if not?

ggalan87 commented 3 years ago

@atj I will check it later and will report back.

lexguy2007 commented 3 years ago

Based on this thread it appears you need to login to Discogs for the script to work:

https://community.metabrainz.org/t/discogs-import-script-not-working/516221

I was having the same problem with the script not working but as soon as I signed in, BINGO, working again. Thank you.

ggalan87 commented 3 years ago

So @atj I made some tests and the following hold for both Tampermonkey (4.11.6120) and Violentmonkey (2.12.8) in Firefox 85

atj commented 3 years ago

Thanks @ggalan87 this is helpful. I can't see how the cookies themselves could be the cause - my guess would be that Discogs must be generating slightly different HTML based on the presence of these cookies. I'll try to replicate the issue.

atj commented 3 years ago

OK, I've finally been able to reproduce this. Discogs returns completely different markup if you're not logged in, which contains class names like:

<div class="side_3-xID" style="order:3">
  <section class="section_9nUx6 open_BZ6Zt">
    <header class="header_W2hzl">
      <div class="header_3eShg">
        <h3>Marketplace</h3>

The order:3 in the style attribute indicates that flex-box is being used for the sidebar layout. This means that even if we update the script to recognise the the weird class names the page will be messed up because the inserted MB element doesn't work with flex-box:

image

The only option I can see at the moment, that won't require making significant changes to the script, would be to add the buttons before the tracklist, like so:

image

However this doesn't fix the MB artist/label/release links, so some functionality of the script will still be lost. @murdos: any thoughts? Should we just require users to be logged in?

zas commented 3 years ago

Layout is totally different when logged in or not...

discogs_fmt

So it will take a lot of time to fix.

Daniel15 commented 3 years ago

I wonder if Discogs are redesigning / refactoring / modernizing their site and the redesign is currently only visible to logged out users? Has anyone tried reaching out to Discogs and asking them about it?

any thoughts? Should we just require users to be logged in?

I doubt that's a long-term solution; I'm sure if they're changing the site, the changes will eventually roll out to logged-in users too.

redactedscribe commented 3 years ago

Should we just require users to be logged in?

Please add some kind of note on the non-logged-in version if possible; I've been thinking the script was broken for quite a while now. Logging in fixed it for me. Many people may be suffering from the same issue so some kind of tip to log in would be appreciated.

jdaviescoates commented 3 years ago

I'm logged in and the script is clearly doing it's thing because all the little Musicbrainz icons show up on the page, but there is no "import to Musicbrainz" button like there used to be. Help!

I'm on Ubuntu 20.04 and it's the same in both Firefox and Chromium:

e.g. no_import_button

Normally the button appears on the right underneath that Marketplace section, but it's currently nowhere to be seen.

Doh! Ignore me. It's because I was looking at the Master Release instead of a specific release, actually working fine if I look at a specific release:

actually_working_fine

djdembeck commented 3 years ago

This is an issue for me, even when logged in now.

kellnerd commented 3 years ago

Can you please update the userscript and check whether version 2021.8.10.1 fixes your problem?

redactedscribe commented 3 years ago

I now see the import button without being logged into Discogs. Thanks!