kepstin / magicisrc

JS web tool to batch-submit ISRCs to MusicBrainz
18 stars 6 forks source link

MB web service v1 will be dropped #3

Closed jesus2099 closed 5 years ago

jesus2099 commented 6 years ago

As written in https://blog.musicbrainz.org/?p=6942 they will abandon version 1 web services.

https://github.com/kepstin/magicisrc/blob/339bd94ec021f28325a3005b4661773291105486/index.html#L399

If you are one of the few authors of software that has not updated your software to use the newer ws/2 endpoint, your software’s MusicBrainz functionality will cease to work after 1 August.

:scream:

kepstin commented 5 years ago

Oh no.

Sadly, ws/2 isn't really an option here, since it doesn't (as far as I know?) support submissions with "form" format, so there's no easy way to do the submission from the browser without them providing their authentication credentials to the web application.

kepstin commented 5 years ago

It looks like implementing an OAuth2 authentication flow that runs purely in the browser (js) should be possible, it's fairly similar to how it works for a standalone app like picard. I'll take a look at adding this.

jesus2099 commented 5 years ago

It sounds complex, though… :/

jesus2099 commented 5 years ago

I don’t know anything about oauth or oauth2… I found this and that which show that we could require so many lines of codes just to log in, now.

kepstin commented 5 years ago

I'm currently working on a prototype of OAuth2 flow. You can follow the status by poking at https://magicisrc-beta.kepstin.ca/ - preferably with a browser console open and persistent logs enabled.

I'm currently blocked by MBS-9993 (MusicBrainz server should allow CORS requests to /oauth/token), which is preventing me from getting back the auth token to use when making future musicbrainz webservice requests.

jesus2099 commented 5 years ago

If we ran the ISRC submit form hosted on the musicbrainz.org/release/mbid page itself through a userscript, maybe it would not ask for athentication?

kepstin commented 5 years ago

Huh. it looks like the /ws/2 endpoints do actually use the musicbrainz.org web site session as authentication. At the very least, things like ?inc=user-tags works for my currently logged in user. If this is also true for the isrc submission endpoint, implementing it as a userscript running on the musicbrainz.org origin should be doable, yes.

I'd still like to have a version externally hosted, so it can be used without a userscript installed.

kepstin commented 5 years ago

OAuth2 flow is currently functional on https://magicisrc-beta.kepstin.ca/ (using the "beta" branch from this repo) - you can login, logout, and load the release editor. (Note that the beta site is currently backended on the https://test.musicbrainz.org/ server, which has passwords reset to "mb")

ISRC validation and submission is still to be implemented.

kepstin commented 5 years ago

Currently blocked on https://tickets.metabrainz.org/browse/MBS-6033 - the ws/2 endpoints do not allow authenticated cross-domain ws requests.

kepstin commented 5 years ago

https://magic-isrc-beta.kepstin.ca/ now works using beta.musicbrainz.org

Note that if you use the link https://www.kepstin.ca/magicisrc/ with parameters, the parameters will be preserved when you click on the "Please try the Beta version" link, and the prefill works.

jesus2099 commented 5 years ago

https://magic-isrc-beta.kepstin.ca/https://magicisrc-beta.kepstin.ca/ ;-P

jesus2099 commented 5 years ago

It was quite tedious without #2 (which can be closed, maybe) but it worked! Thanks very much. :)

kepstin commented 5 years ago

The required changes were included in the 2019-06-30 Musicbrainz Server update, so I've pushed the ws/2 version of MagicISRC live now.

It can be accessed at https://magicisrc.kepstin.ca/ or via the legacy URL https://www.kepstin.ca/magicisrc/ (the latter is a redirect that preserves seeded parameters)

jesus2099 commented 5 years ago

Congratulations 🎉