derat / yambs

Moved to codeberg.org/derat/yambs
https://codeberg.org/derat/yambs
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Seed cover art edits #3

Closed derat closed 2 years ago

derat commented 2 years ago

It'd be nice if there were some way to seed cover art edits instead of just opening the image in a tab.

https://wiki.musicbrainz.org/Development/Release_Editor_Seeding describes a redirect_uri parameter:

A URI to redirect to after the release is submitted. The release's MBID will be added to this URI under the 'release_mbid' query parameter. E.g., if 'http://example.com/' is provided for this, the user will be redirected to a URI like 'http://example.com/?release_mbid=4587fe99-db0e-4553-a56a-164dd38ab380'

Failing any other options, maybe I could find a way to make the seeded release edit redirect to https://musicbrainz.org/release/<release_mbid>/cover-art after it's submitted. Adding a redirector that looks at the release_mbid parameter to redirect to the MB URL feels pretty gross, though. :-/

derat commented 2 years ago

https://musicbrainz.org/release/<mbid>/add-cover-art skips a click on the "Add Cover Art" button, but it seems like I may still need a redirector.

Here's the relevant redirection code from root/static/scripts/release-editor/edits.js:

    if (!current) {
      // We're done!

      // Don't ask for confirmation before redirecting.
      root.redirecting = true;

      if (releaseEditor.redirectURI) {
        var a = document.createElement('a');
        a.href = releaseEditor.redirectURI;

        a.search += /^\?/.test(a.search) ? '&' : '?';
        a.search += 'release_mbid=' + release.gid();

        window.location.href = a.href;
      } else {
        window.location.pathname = '/release/' + release.gid();
      }
      return;
    }

I wonder if I can do something disgusting using a javascript: URL...

derat commented 2 years ago

It is possible to do something disgusting with a javascript: URL, but it's disgusting enough that I reported it as a bug: https://tickets.metabrainz.org/browse/MBS-12719

So I'm just going to go the redirector route instead.