mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
enh: youtube watch param support
This commit is contained in:
22
src/routes/watch/+page.svelte
Normal file
22
src/routes/watch/+page.svelte
Normal file
@@ -0,0 +1,22 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
onMount(() => {
|
||||
// Get the current URL search parameters
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
|
||||
// Check if 'v' parameter exists
|
||||
if (params.has('v')) {
|
||||
// Get the value of 'v' parameter
|
||||
const videoId = params.get('v');
|
||||
|
||||
// Redirect to root with 'youtube' parameter
|
||||
|
||||
goto(`/?youtube=${encodeURIComponent(videoId)}`);
|
||||
} else {
|
||||
// Redirect to root if 'v' parameter doesn't exist
|
||||
goto('/');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user