feat: add custom piped and invidious embeds
This commit is contained in:
1 parent
74701ffe3f
commit
3721630cc8
4 files changed
+38
-2
No files matched your search
@@ -5,10 +5,10 @@
|
|||||||
return 'www.youtube-nocookie.com'
|
return 'www.youtube-nocookie.com'
|
||||||
}
|
}
|
||||||
case 'invidious': {
|
case 'invidious': {
|
||||||
return 'vid.puffyan.us'
|
return get(userSettings).embeds.invidious || 'yewtu.be'
|
||||||
}
|
}
|
||||||
case 'piped': {
|
case 'piped': {
|
||||||
return 'piped.video'
|
return get(userSettings).embeds.piped || 'piped.video'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import { optimizeImageURL, type IframeType, type MediaType } from '../helpers'
|
import { optimizeImageURL, type IframeType, type MediaType } from '../helpers'
|
||||||
import { userSettings } from '$lib/settings'
|
import { userSettings } from '$lib/settings'
|
||||||
|
import { get } from 'svelte/store'
|
||||||
|
|
||||||
export let type: IframeType = 'none'
|
export let type: IframeType = 'none'
|
||||||
export let thumbnail: string | undefined = undefined
|
export let thumbnail: string | undefined = undefined
|
||||||
|
|||||||
@@ -620,6 +620,11 @@
|
|||||||
},
|
},
|
||||||
"youtube": {
|
"youtube": {
|
||||||
"description": "The website to embed YouTube content in."
|
"description": "The website to embed YouTube content in."
|
||||||
|
},
|
||||||
|
"instance": {
|
||||||
|
"invidious": "Invidious instance",
|
||||||
|
"piped": "Piped instance",
|
||||||
|
"description": "The instance to embed YouTube content in."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lemmy": {
|
"lemmy": {
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ interface Settings {
|
|||||||
embeds: {
|
embeds: {
|
||||||
clickToView: boolean
|
clickToView: boolean
|
||||||
youtube: 'youtube' | 'invidious' | 'piped'
|
youtube: 'youtube' | 'invidious' | 'piped'
|
||||||
|
invidious: string | undefined
|
||||||
|
piped: string | undefined
|
||||||
}
|
}
|
||||||
dock: {
|
dock: {
|
||||||
noGap: boolean | null
|
noGap: boolean | null
|
||||||
@@ -129,6 +131,8 @@ export const defaultSettings: Settings = {
|
|||||||
embeds: {
|
embeds: {
|
||||||
clickToView: true,
|
clickToView: true,
|
||||||
youtube: 'youtube',
|
youtube: 'youtube',
|
||||||
|
invidious: undefined,
|
||||||
|
piped: undefined,
|
||||||
},
|
},
|
||||||
dock: {
|
dock: {
|
||||||
noGap: toBool(env.PUBLIC_DOCK_PANEL) ?? null,
|
noGap: toBool(env.PUBLIC_DOCK_PANEL) ?? null,
|
||||||
|
|||||||
@@ -261,6 +261,32 @@
|
|||||||
<option value="piped">Piped</option>
|
<option value="piped">Piped</option>
|
||||||
</Select>
|
</Select>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
{#if $userSettings.embeds.youtube == 'invidious'}
|
||||||
|
<Setting>
|
||||||
|
<span slot="title">{$t('settings.embeds.instance.invidious')}</span>
|
||||||
|
<span slot="description">
|
||||||
|
{$t('settings.embeds.instance.description')}
|
||||||
|
</span>
|
||||||
|
<TextInput
|
||||||
|
label={$t('settings.embeds.instance.invidious')}
|
||||||
|
pattern={DOMAIN_REGEX_FORMS}
|
||||||
|
bind:value={$userSettings.embeds.invidious}
|
||||||
|
/>
|
||||||
|
</Setting>
|
||||||
|
{/if}
|
||||||
|
{#if $userSettings.embeds.youtube == 'piped'}
|
||||||
|
<Setting>
|
||||||
|
<span slot="title">{$t('settings.embeds.instance.piped')}</span>
|
||||||
|
<span slot="description">
|
||||||
|
{$t('settings.embeds.instance.description')}
|
||||||
|
</span>
|
||||||
|
<TextInput
|
||||||
|
label={$t('settings.embeds.instance.piped')}
|
||||||
|
pattern={DOMAIN_REGEX_FORMS}
|
||||||
|
bind:value={$userSettings.embeds.piped}
|
||||||
|
/>
|
||||||
|
</Setting>
|
||||||
|
{/if}
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
<Section title={$t('settings.lemmy.title')}>
|
<Section title={$t('settings.lemmy.title')}>
|
||||||
|
|||||||
Reference in new issue
Block a user