Friendica, version parsing fixes
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
66f48ca982
commit
afd4a39337
3 changed files with 8 additions and 6 deletions
|
@ -1,3 +1,4 @@
|
|||
import { List as ImmutableList } from 'immutable';
|
||||
import React, { useState, useEffect, useMemo } from 'react';
|
||||
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
||||
|
||||
|
@ -125,7 +126,7 @@ const accountToCredentials = (account: Account): AccountCredentials => {
|
|||
display_name: account.display_name,
|
||||
note: account.source.get('note'),
|
||||
locked: account.locked,
|
||||
fields_attributes: [...account.source.get<Iterable<AccountCredentialsField>>('fields', []).toJS()],
|
||||
fields_attributes: [...account.source.get<Iterable<AccountCredentialsField>>('fields', ImmutableList()).toJS()],
|
||||
stranger_notifications: account.getIn(['pleroma', 'notification_settings', 'block_from_strangers']) === true,
|
||||
accepts_email_list: account.getIn(['pleroma', 'accepts_email_list']) === true,
|
||||
hide_followers: hideNetwork,
|
||||
|
|
|
@ -624,6 +624,7 @@ const getInstanceFeatures = (instance: Instance) => {
|
|||
* @see GET /api/v1/timelines/public
|
||||
*/
|
||||
publicTimeline: any([
|
||||
v.software === FRIENDICA,
|
||||
v.software === MASTODON,
|
||||
v.software === PLEROMA,
|
||||
v.software === TAKAHE,
|
||||
|
@ -739,7 +740,6 @@ const getInstanceFeatures = (instance: Instance) => {
|
|||
* @see {@link https://docs.joinmastodon.org/methods/accounts/suggestions/}
|
||||
*/
|
||||
suggestions: any([
|
||||
v.software === FRIENDICA,
|
||||
v.software === MASTODON && gte(v.compatVersion, '2.4.3'),
|
||||
v.software === TRUTHSOCIAL,
|
||||
features.includes('v2_suggestions'),
|
||||
|
@ -750,6 +750,7 @@ const getInstanceFeatures = (instance: Instance) => {
|
|||
* @see GET /api/v2/suggestions
|
||||
*/
|
||||
suggestionsV2: any([
|
||||
v.software === FRIENDICA,
|
||||
v.software === MASTODON && gte(v.compatVersion, '3.4.0'),
|
||||
v.software === TRUTHSOCIAL,
|
||||
features.includes('v2_suggestions'),
|
||||
|
@ -830,9 +831,9 @@ export const parseVersion = (version: string): Backend => {
|
|||
const regex = /^([\w+.]*)(?: \(compatible; ([\w]*) (.*)\))?$/;
|
||||
const match = regex.exec(version);
|
||||
|
||||
const semver = match ? semverParse(semverCoerce(match[3] || match[1], { loose: true })) : null;
|
||||
const compat = match ? semverParse(match[1]) : null;
|
||||
|
||||
const semverString = match && (match[3] || match[1]);
|
||||
const semver = match ? semverParse(semverString) || semverCoerce(semverString) : null;
|
||||
const compat = match ? semverParse(match[1]) || semverCoerce(match[1]) : null;
|
||||
|
||||
if (match && semver && compat) {
|
||||
return {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** Convert HTML to a plaintext representation, preserving whitespace. */
|
||||
// NB: This function can still return unsafe HTML
|
||||
export const unescapeHTML = (html: string): string => {
|
||||
export const unescapeHTML = (html: string = ''): string => {
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.innerHTML = html.replace(/<br\s*\/?>/g, '\n').replace(/<\/p><[^>]*>/g, '\n\n').replace(/<[^>]*>/g, '');
|
||||
return wrapper.textContent || '';
|
||||
|
|
Loading…
Reference in a new issue