New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] Report Masto version in /api/v1/instance #1977
[feature] Report Masto version in /api/v1/instance #1977
Conversation
) | ||
|
||
var instanceStatusesSupportedMimeTypes = []string{ | ||
string(apimodel.StatusContentTypePlain), | ||
string(apimodel.StatusContentTypeMarkdown), | ||
} | ||
|
||
func toMastodonVersion(in string) string { | ||
return instanceMastodonVersion + "+" + strings.ReplaceAll(in, " ", "-") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went for +
here in order to turn our version into "build metadata" according to SemVer, so it should parse correctly for any clients that look at it. SemVer doesn't seem to like spaces which we have between the version and the git hash so that's replaced by a hyphen.
For context, this is where we had the discussion: #778 Since we resolved a while ago that we're only supporting the Mastodon API up to v4.1.x (https://gts.superseriousbusiness.org/@gotosocial/statuses/01GZEBDK1JGTNJZ8SCPXA274RY) we could use that version number instead of 3.5.3. Although we don't actually support all features from 4.1.x yet. But then again, we don't support all features from 3.5.3 yet either :D |
Since version numbers are being fiddled with here, here's a link to a related issue: #1953 Not that we have to include the above in this PR necessarily, but it's worth bearing in mind for another PR. |
FWIW I'm now using nodeinfo in Feditext because it's the easier way to get the real server software name and version number, instead of a fake Mastodon version number that doesn't actually correspond to the features of that Mastodon version (see also: Pleroma, Akkoma). I'm in favor of this change, because as noted, not everybody is going to bother testing against non-Mastodon implementations, and a Mastodon 3 or 4 version number is a lie that's certainly closer to the truth. But smart cross-platform clients have to use nodeinfo software name and version as well as the instance API to get an idea of which APIs should be available. |
From what I've been able to see, most libraries seem to check for "at least v3" in order to use some v2 endpoints like instance and search. So as long as we report something in 3.x we're probably fine. Mastodon.py has a whole parade of version strings for certain features |
A number of applications use the version reported by /api/v1/instance as a way to do feature detection for the Mastodon client API. Due to the current GtS versions in 0.x, this often means GtS gets determined to be non-compatible by clients and libraries that only ever test against Mastodon proper. This adds a configuration value that allows the admin to decide to inject a Mastodon version in that response instead, in order to cajool clients into working correctly with GtS. This is only done for /api/v1/instance as that's the Masto client API, nodeinfo is left as it is as that should not be used by Masto clients for feature detection. Since the clients we recommend don't need to be tricked this way, this feature defaults to being off. Admins can enable it if so desired, which may be useful for small communities where admins might have less say over which clients people use.
6cde49d
to
b26da73
Compare
Description
A number of applications use the version reported by /api/v1/instance as a way to do feature detection for the Mastodon client API. Due to the current GtS versions in 0.x, this often means GtS gets determined to be non-compatible by clients and libraries that only ever test against Mastodon proper.
This adds a configuration value that allows the admin to decide to inject a Mastodon version in that response instead, in order to cajole clients into working correctly with GtS. This is only done for /api/v1/instance as that's the Masto client API, nodeinfo is left as it is as that should not be used by Masto clients for feature detection.
Since the clients we recommend don't need to be tricked this way, this feature defaults to being off. Admins can enable it if so desired, which may be useful for small communities where admins might have less say over which clients people use.
Checklist
Please put an x inside each checkbox to indicate that you've read and followed it:
[ ]
->[x]
If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).
go fmt ./...
andgolangci-lint run
.