glitch-soc / mastodon

A glitchy but lovable microblogging server
https://glitch-soc.github.io/docs/
GNU Affero General Public License v3.0
688 stars 184 forks source link

Suggestion: instance API should include supported MIME types for statuses #2091

Closed VyrCossont closed 1 year ago

VyrCossont commented 1 year ago

Pitch

I propose that we add a supported_mime_types list to the .configuration.statuses object in /api/v1/instance and /api/v2/instance, alongside max_characters, analogous to the existing .configuration.media_attachments.supported_mime_types list. Third-party clients would be able to look at this field and get a list of MIME types that they can author posts in.

Glitch supports text/plain, text/markdown, and text/html, and is not admin-configurable, so the values can be hardcoded as in example PR #2090.

If the field is missing (which it will not be in future Glitch versions, but will be in mainline Mastodon), and there is no out-of-band list of supported content types (like the one hardcoded into the Glitch web GUI), clients should not send a content_type parameter when creating a status, which is what they mostly do today anyway.

Motivation

This would benefit third-party native and web clients that want to support rich text post authoring using the content_type parameter to /api/v1/statuses. Right now, a client can use the instance API to discover the post length limit and supported image formats, but not supported post formats, or even that a given instance supports rich text through the content_type parameter.

I would directly benefit from this since I'm working on a community fork of Metatext and want to add rich text support without having to guess at it based on the version string of the instance server.

Alternatives

Pleroma and its forks use Pleroma-specific extensions to /api/v1/instance (a MIME type list in .pleroma.metadata.post_formats) to deliver the same information, so there may be clients looking for that, but it'd be weird to split status info (logically part of the .configuration.statuses) across the existing object and a Pleroma extension.

Ecosystem

VyrCossont commented 1 year ago

Fixed by #2090. Thanks!