Add support for local instance posts

A new platform feature is defined, `@akkoma/local-only`, which is marked as present only if the string `akkoma` is found in the instance version string.

If this feature is supported, a new post visibility option is added to the post compose visibility selector, "Local instance", which sets the visibility to `"local"`.

The post viewer is also updated accordingly; while local-only posts could already be seen previously, they didn't have anything written in the `.extra-meta` section, and didn't display a visibility icon.

The `building` icon has been selected as the symbol for "Local instance" posts, as it's already used in the main menu to denote the Local timeline.
This commit is contained in:
Stefano Pigozzi 2024-08-20 18:54:00 +02:00
parent 4e5cb133d0
commit 1e1d6e40bc
No known key found for this signature in database
GPG key ID: 5ADA3868646C3FC0
4 changed files with 10 additions and 0 deletions

View file

@ -1178,6 +1178,11 @@ function Compose({
<option value="direct">
<Trans>Private mention</Trans>
</option>
{supports('@akkoma/local-only') &&
<option value="local">
<Trans>Local instance</Trans>
</option>
}
</select>
</label>{' '}
</div>

View file

@ -94,6 +94,7 @@ const visibilityText = {
unlisted: msg`Unlisted`,
private: msg`Followers only`,
direct: msg`Private mention`,
local: msg`Local instance`,
};
const isIOS =

View file

@ -7,6 +7,8 @@ import { getCurrentInstance } from './store-utils';
// Non-semver(?) UA string detection
const containPixelfed = /pixelfed/i;
const notContainPixelfed = /^(?!.*pixelfed).*$/i;
const containAkkoma = /akkoma/i
const notContainAkkoma = /^(?! *akkoma) *$/i
const platformFeatures = {
'@mastodon/lists': notContainPixelfed,
'@mastodon/filters': notContainPixelfed,
@ -20,6 +22,7 @@ const platformFeatures = {
'@pixelfed/trending': containPixelfed,
'@pixelfed/home-include-reblogs': containPixelfed,
'@pixelfed/global-feed': containPixelfed,
'@akkoma/local-only': containAkkoma,
};
const supportsCache = {};

View file

@ -3,4 +3,5 @@ export default {
unlisted: 'group',
private: 'lock',
direct: 'message',
local: 'building',
};