|
|
@ -4,7 +4,7 @@ import React from 'react';
|
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
|
|
|
|
|
|
|
|
|
import Icon from 'soapbox/components/icon';
|
|
|
|
import Icon from 'soapbox/components/icon';
|
|
|
|
import { Text } from 'soapbox/components/ui';
|
|
|
|
import { HStack, Stack, Text } from 'soapbox/components/ui';
|
|
|
|
import { useAppSelector } from 'soapbox/hooks';
|
|
|
|
import { useAppSelector } from 'soapbox/hooks';
|
|
|
|
|
|
|
|
|
|
|
|
import type { Map as ImmutableMap } from 'immutable';
|
|
|
|
import type { Map as ImmutableMap } from 'immutable';
|
|
|
@ -16,6 +16,23 @@ const hasRestrictions = (remoteInstance: ImmutableMap<string, any>): boolean =>
|
|
|
|
.reduce((acc: boolean, value: boolean) => acc || value, false);
|
|
|
|
.reduce((acc: boolean, value: boolean) => acc || value, false);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface IRestriction {
|
|
|
|
|
|
|
|
icon: string,
|
|
|
|
|
|
|
|
children: React.ReactNode,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Restriction: React.FC<IRestriction> = ({ icon, children }) => {
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<HStack space={3}>
|
|
|
|
|
|
|
|
<Icon className='flex-none w-5 h-5' src={icon} />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Text theme='muted'>
|
|
|
|
|
|
|
|
{children}
|
|
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
|
|
</HStack>
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
interface IInstanceRestrictions {
|
|
|
|
interface IInstanceRestrictions {
|
|
|
|
remoteInstance: ImmutableMap<string, any>,
|
|
|
|
remoteInstance: ImmutableMap<string, any>,
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -40,57 +57,52 @@ const InstanceRestrictions: React.FC<IInstanceRestrictions> = ({ remoteInstance
|
|
|
|
|
|
|
|
|
|
|
|
if (followers_only) {
|
|
|
|
if (followers_only) {
|
|
|
|
items.push((
|
|
|
|
items.push((
|
|
|
|
<Text key='followers_only' className='flex items-center gap-2' theme='muted'>
|
|
|
|
<Restriction key='followersOnly' icon={require('@tabler/icons/lock.svg')}>
|
|
|
|
<Icon src={require('@tabler/icons/lock.svg')} />
|
|
|
|
|
|
|
|
<FormattedMessage
|
|
|
|
<FormattedMessage
|
|
|
|
id='federation_restriction.followers_only'
|
|
|
|
id='federation_restriction.followers_only'
|
|
|
|
defaultMessage='Hidden except to followers'
|
|
|
|
defaultMessage='Hidden except to followers'
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</Text>
|
|
|
|
</Restriction>
|
|
|
|
));
|
|
|
|
));
|
|
|
|
} else if (federated_timeline_removal) {
|
|
|
|
} else if (federated_timeline_removal) {
|
|
|
|
items.push((
|
|
|
|
items.push((
|
|
|
|
<Text key='federated_timeline_removal' className='flex items-center gap-2' theme='muted'>
|
|
|
|
<Restriction key='federatedTimelineRemoval' icon={require('@tabler/icons/lock-open.svg')}>
|
|
|
|
<Icon src={require('@tabler/icons/lock-open.svg')} />
|
|
|
|
|
|
|
|
<FormattedMessage
|
|
|
|
<FormattedMessage
|
|
|
|
id='federation_restriction.federated_timeline_removal'
|
|
|
|
id='federation_restriction.federated_timeline_removal'
|
|
|
|
defaultMessage='Fediverse timeline removal'
|
|
|
|
defaultMessage='Fediverse timeline removal'
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</Text>
|
|
|
|
</Restriction>
|
|
|
|
));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (fullMediaRemoval) {
|
|
|
|
if (fullMediaRemoval) {
|
|
|
|
items.push((
|
|
|
|
items.push((
|
|
|
|
<Text key='full_media_removal' className='flex items-center gap-2' theme='muted'>
|
|
|
|
<Restriction key='fullMediaRemoval' icon={require('@tabler/icons/photo-off.svg')}>
|
|
|
|
<Icon src={require('@tabler/icons/photo-off.svg')} />
|
|
|
|
|
|
|
|
<FormattedMessage
|
|
|
|
<FormattedMessage
|
|
|
|
id='federation_restriction.full_media_removal'
|
|
|
|
id='federation_restriction.full_media_removal'
|
|
|
|
defaultMessage='Full media removal'
|
|
|
|
defaultMessage='Full media removal'
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</Text>
|
|
|
|
</Restriction>
|
|
|
|
));
|
|
|
|
));
|
|
|
|
} else if (partialMediaRemoval) {
|
|
|
|
} else if (partialMediaRemoval) {
|
|
|
|
items.push((
|
|
|
|
items.push((
|
|
|
|
<Text key='partial_media_removal' className='flex items-center gap-2' theme='muted'>
|
|
|
|
<Restriction key='partialMediaRemoval' icon={require('@tabler/icons/photo-off.svg')}>
|
|
|
|
<Icon src={require('@tabler/icons/photo-off.svg')} />
|
|
|
|
|
|
|
|
<FormattedMessage
|
|
|
|
<FormattedMessage
|
|
|
|
id='federation_restriction.partial_media_removal'
|
|
|
|
id='federation_restriction.partial_media_removal'
|
|
|
|
defaultMessage='Partial media removal'
|
|
|
|
defaultMessage='Partial media removal'
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</Text>
|
|
|
|
</Restriction>
|
|
|
|
));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!fullMediaRemoval && media_nsfw) {
|
|
|
|
if (!fullMediaRemoval && media_nsfw) {
|
|
|
|
items.push((
|
|
|
|
items.push((
|
|
|
|
<Text key='media_nsfw' className='flex items-center gap-2' theme='muted'>
|
|
|
|
<Restriction key='mediaNsfw' icon={require('@tabler/icons/eye-off.svg')}>
|
|
|
|
<Icon src={require('@tabler/icons/eye-off.svg')} />
|
|
|
|
|
|
|
|
<FormattedMessage
|
|
|
|
<FormattedMessage
|
|
|
|
id='federation_restriction.media_nsfw'
|
|
|
|
id='federation_restriction.media_nsfw'
|
|
|
|
defaultMessage='Attachments marked NSFW'
|
|
|
|
defaultMessage='Attachments marked NSFW'
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</Text>
|
|
|
|
</Restriction>
|
|
|
|
));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -105,46 +117,45 @@ const InstanceRestrictions: React.FC<IInstanceRestrictions> = ({ remoteInstance
|
|
|
|
|
|
|
|
|
|
|
|
if (remoteInstance.getIn(['federation', 'reject']) === true) {
|
|
|
|
if (remoteInstance.getIn(['federation', 'reject']) === true) {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Text className='flex items-center gap-2' theme='muted'>
|
|
|
|
<Restriction icon={require('@tabler/icons/shield-x.svg')}>
|
|
|
|
<Icon src={require('@tabler/icons/x.svg')} />
|
|
|
|
|
|
|
|
<FormattedMessage
|
|
|
|
<FormattedMessage
|
|
|
|
id='remote_instance.federation_panel.restricted_message'
|
|
|
|
id='remote_instance.federation_panel.restricted_message'
|
|
|
|
defaultMessage='{siteTitle} blocks all activities from {host}.'
|
|
|
|
defaultMessage='{siteTitle} blocks all activities from {host}.'
|
|
|
|
values={{ host, siteTitle }}
|
|
|
|
values={{ host, siteTitle }}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</Text>
|
|
|
|
</Restriction>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} else if (hasRestrictions(remoteInstance)) {
|
|
|
|
} else if (hasRestrictions(remoteInstance)) {
|
|
|
|
return [
|
|
|
|
return (
|
|
|
|
(
|
|
|
|
<>
|
|
|
|
<Text theme='muted'>
|
|
|
|
<Restriction icon={require('@tabler/icons/shield-lock.svg')}>
|
|
|
|
<FormattedMessage
|
|
|
|
<FormattedMessage
|
|
|
|
id='remote_instance.federation_panel.some_restrictions_message'
|
|
|
|
id='remote_instance.federation_panel.some_restrictions_message'
|
|
|
|
defaultMessage='{siteTitle} has placed some restrictions on {host}.'
|
|
|
|
defaultMessage='{siteTitle} has placed some restrictions on {host}.'
|
|
|
|
values={{ host, siteTitle }}
|
|
|
|
values={{ host, siteTitle }}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</Text>
|
|
|
|
</Restriction>
|
|
|
|
),
|
|
|
|
|
|
|
|
renderRestrictions(),
|
|
|
|
{renderRestrictions()}
|
|
|
|
];
|
|
|
|
</>
|
|
|
|
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Text className='flex items-center gap-2' theme='muted'>
|
|
|
|
<Restriction icon={require('@tabler/icons/shield-check.svg')}>
|
|
|
|
<Icon src={require('@tabler/icons/check.svg')} />
|
|
|
|
|
|
|
|
<FormattedMessage
|
|
|
|
<FormattedMessage
|
|
|
|
id='remote_instance.federation_panel.no_restrictions_message'
|
|
|
|
id='remote_instance.federation_panel.no_restrictions_message'
|
|
|
|
defaultMessage='{siteTitle} has placed no restrictions on {host}.'
|
|
|
|
defaultMessage='{siteTitle} has placed no restrictions on {host}.'
|
|
|
|
values={{ host, siteTitle }}
|
|
|
|
values={{ host, siteTitle }}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</Text>
|
|
|
|
</Restriction>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className='py-1 pl-4 mb-4 border-solid border-l-[3px] border-gray-300 dark:border-gray-500'>
|
|
|
|
<Stack space={3}>
|
|
|
|
{renderContent()}
|
|
|
|
{renderContent()}
|
|
|
|
</div>
|
|
|
|
</Stack>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|