Remove KLIPY from external media settings (#10496)
This commit is contained in:
@@ -8,7 +8,10 @@ import {useLingui} from '@lingui/react'
|
|||||||
import {parseAltFromGIFDescription} from '#/lib/gif-alt-text'
|
import {parseAltFromGIFDescription} from '#/lib/gif-alt-text'
|
||||||
import {useHaptics} from '#/lib/haptics'
|
import {useHaptics} from '#/lib/haptics'
|
||||||
import {shareUrl} from '#/lib/sharing'
|
import {shareUrl} from '#/lib/sharing'
|
||||||
import {parseEmbedPlayerFromUrl} from '#/lib/strings/embed-player'
|
import {
|
||||||
|
exemptExternalEmbedSources,
|
||||||
|
parseEmbedPlayerFromUrl,
|
||||||
|
} from '#/lib/strings/embed-player'
|
||||||
import {toNiceDomain} from '#/lib/strings/url-helpers'
|
import {toNiceDomain} from '#/lib/strings/url-helpers'
|
||||||
import {useExternalEmbedsPrefs} from '#/state/preferences'
|
import {useExternalEmbedsPrefs} from '#/state/preferences'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
@@ -40,8 +43,9 @@ export const ExternalEmbed = ({
|
|||||||
const imageUri = link.thumb
|
const imageUri = link.thumb
|
||||||
const embedPlayerParams = useMemo(() => {
|
const embedPlayerParams = useMemo(() => {
|
||||||
const params = parseEmbedPlayerFromUrl(link.uri)
|
const params = parseEmbedPlayerFromUrl(link.uri)
|
||||||
|
if (!params) return
|
||||||
if (params && externalEmbedPrefs?.[params.source] !== 'hide') {
|
const canShow = externalEmbedPrefs?.[params.source] !== 'hide'
|
||||||
|
if (canShow || exemptExternalEmbedSources.has(params.source)) {
|
||||||
return params
|
return params
|
||||||
}
|
}
|
||||||
}, [link.uri, externalEmbedPrefs])
|
}, [link.uri, externalEmbedPrefs])
|
||||||
|
|||||||
@@ -65,6 +65,15 @@ export const externalEmbedLabels: Record<EmbedPlayerSource, string> = {
|
|||||||
bandcamp: 'Bandcamp',
|
bandcamp: 'Bandcamp',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These sources are proxied through our CDN and do not leak any user data,
|
||||||
|
* thus are safe to embed without a warning.
|
||||||
|
*/
|
||||||
|
export const exemptExternalEmbedSources = new Set<EmbedPlayerSource>([
|
||||||
|
'tenor',
|
||||||
|
'klipy',
|
||||||
|
])
|
||||||
|
|
||||||
export interface EmbedPlayerParams {
|
export interface EmbedPlayerParams {
|
||||||
type: EmbedPlayerType
|
type: EmbedPlayerType
|
||||||
playerUri: string
|
playerUri: string
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
} from '#/lib/routes/types'
|
} from '#/lib/routes/types'
|
||||||
import {
|
import {
|
||||||
type EmbedPlayerSource,
|
type EmbedPlayerSource,
|
||||||
|
exemptExternalEmbedSources,
|
||||||
externalEmbedLabels,
|
externalEmbedLabels,
|
||||||
} from '#/lib/strings/embed-player'
|
} from '#/lib/strings/embed-player'
|
||||||
import {
|
import {
|
||||||
@@ -54,8 +55,10 @@ export function ExternalMediaPreferencesScreen({}: Props) {
|
|||||||
<View style={[a.mt_sm, a.w_full]}>
|
<View style={[a.mt_sm, a.w_full]}>
|
||||||
{native(<SettingsList.Divider style={[a.my_0]} />)}
|
{native(<SettingsList.Divider style={[a.my_0]} />)}
|
||||||
{Object.entries(externalEmbedLabels)
|
{Object.entries(externalEmbedLabels)
|
||||||
// TODO: Remove special case when we disable the old integration.
|
.filter(
|
||||||
.filter(([key]) => key !== 'tenor')
|
([key]) =>
|
||||||
|
!exemptExternalEmbedSources.has(key as EmbedPlayerSource),
|
||||||
|
)
|
||||||
.map(([key, label]) => (
|
.map(([key, label]) => (
|
||||||
<Fragment key={key}>
|
<Fragment key={key}>
|
||||||
<PrefSelector
|
<PrefSelector
|
||||||
|
|||||||
Reference in New Issue
Block a user