mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-22 16:46:28 +01:00
Add support for Pleroma instances
This commit is contained in:
parent
67cce5b9cc
commit
8f6d1da008
2 changed files with 5 additions and 4 deletions
|
@ -1178,7 +1178,7 @@ function Compose({
|
|||
<option value="direct">
|
||||
<Trans>Private mention</Trans>
|
||||
</option>
|
||||
{supports('@akkoma/local-only') &&
|
||||
{supports('@pleroma/local-only') &&
|
||||
<option value="local">
|
||||
<Trans>Local instance</Trans>
|
||||
</option>
|
||||
|
|
|
@ -7,8 +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 containAnyOma = /(?:pler|akk)oma/i
|
||||
const notContainAnyOma = /^(?! *(?:pler|akk)oma) *$/i
|
||||
const platformFeatures = {
|
||||
'@mastodon/lists': notContainPixelfed,
|
||||
'@mastodon/filters': notContainPixelfed,
|
||||
|
@ -22,13 +22,14 @@ const platformFeatures = {
|
|||
'@pixelfed/trending': containPixelfed,
|
||||
'@pixelfed/home-include-reblogs': containPixelfed,
|
||||
'@pixelfed/global-feed': containPixelfed,
|
||||
'@akkoma/local-only': containAkkoma,
|
||||
'@pleroma/local-only': containAnyOma,
|
||||
};
|
||||
const supportsCache = {};
|
||||
|
||||
function supports(feature) {
|
||||
try {
|
||||
const { version, domain } = getCurrentInstance();
|
||||
console.debug(version)
|
||||
const key = `${domain}-${feature}`;
|
||||
if (supportsCache[key]) return supportsCache[key];
|
||||
|
||||
|
|
Loading…
Reference in a new issue