Client-side language detection

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-05-18 15:47:36 +02:00
parent 0d2b7f026f
commit 15ad2ea91f
9 changed files with 89 additions and 16 deletions

View File

@ -567,6 +567,11 @@ const getInstanceFeatures = (instance: Instance) => {
v.software === PLEROMA && v.build === REBASED && gte(v.version, '2.5.54'),
]),
/**
* TODO: Replace with proper feature gate.
*/
languageDetection: v.software === PLEROMA && v.build === REBASED,
/**
* Can create, view, and manage lists.
* @see {@link https://docs.joinmastodon.org/methods/lists/}
@ -909,8 +914,11 @@ const parseVersion = (version: string): Backend => {
}) : null;
const compat = match ? semverParse(match[1]) || semverCoerce(match[1]) : null;
if (match && semver && compat) {
let build = semver.build[0];
if (build === 'pl') build = 'soapbox';
return {
build: semver.build[0],
build,
compatVersion: compat.version,
software: match[2] || MASTODON,
version: semver.version.split('-')[0],