Closed jesus2099 closed 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.
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.
It sounds complex, though… :/
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.
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?
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.
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.
Currently blocked on https://tickets.metabrainz.org/browse/MBS-6033 - the ws/2 endpoints do not allow authenticated cross-domain ws requests.
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.
https://magic-isrc-beta.kepstin.ca/
→ https://magicisrc-beta.kepstin.ca/
;-P
It was quite tedious without #2 (which can be closed, maybe) but it worked! Thanks very much. :)
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)
Congratulations 🎉
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
:scream: