NicolasConstant / sengi

Mastodon & Pleroma Multi-account Desktop Client
https://nicolasconstant.github.io/sengi/
GNU Affero General Public License v3.0
524 stars 34 forks source link

#606 Implement v2 media endpoint #607

Open Lastorder-DC opened 10 months ago

Lastorder-DC commented 10 months ago

https://docs.joinmastodon.org/methods/media/

It replaces v1 media endpoint with v2 media endpoint.

NicolasConstant commented 10 months ago

Thanks for contributing to Sengi!

Unfortunately we can't remove v1 support: since other software (like Pleroma) might rely on it, we could call v1 or v2 depending on the software/version used, a bit like how it's done in the search API call wrapping.

Lastorder-DC commented 10 months ago

Okay. will change code to implement both v1 and v2.

Lastorder-DC commented 10 months ago

Can I implement v1 as a fallback? since v2 is more reliable than v1(if supported), and both mastodon compatible sw I know(pleroma and its fork akkoma) supports v2 media endpoint.

(edit) You can edit this PR to what you want. I can start working on this after 8/18

NicolasConstant commented 10 months ago

Take all the time you need. 🙂

Instead of a fallback (that would mean calling twice in the worth case) I would rather analyses the instance's version and call the appropriate version. For example the search api is called after this analysis was done;

https://github.com/NicolasConstant/sengi/blob/c3cd6fe79ecfe2dda457dcd071a203131ae86a8c/src/app/components/create-status/autosuggest/autosuggest.component.ts#L68-L74

I would reuse a similar pattern before calling the new media implementation.

(Of course, if we migrate more and more v2 implementation, that would be useful to regroup this particular logic in a dedicated layer, but lest keep things as they are for now)