Fixed proxying
This commit is contained in:
@@ -20,8 +20,8 @@ export async function getPopular(): Promise<Video[]> {
|
||||
return await resp.json();
|
||||
}
|
||||
|
||||
export async function getVideo(videoId: string): Promise<VideoPlay> {
|
||||
const resp = await fetch(buildPath(`videos/${videoId}`));
|
||||
export async function getVideo(videoId: string, local: boolean = false): Promise<VideoPlay> {
|
||||
const resp = await fetch(buildPath(`videos/${videoId}?local=${local}`));
|
||||
return await resp.json();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<svg height="100%" version="1.0" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"
|
||||
<svg
|
||||
class="m l"
|
||||
height="100%"
|
||||
version="1.0"
|
||||
viewBox="0 0 512 512"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
><g
|
||||
><path
|
||||
d="m247.17 455.95c-19.792-0.78921-38.719-4.2564-57.154-10.47-60.968-20.55-108.68-68.579-127-127.86-7.8955-25.538-10.062-53.943-6.2586-82.067 3.7105-27.439 13.603-53.515 29.342-77.344 12.069-18.273 29.138-36.277 47.228-49.816 36.891-27.61 85.944-42.49 132.38-40.157 25.88 1.3001 49.939 6.765 73.106 16.606 8.1948 3.481 20.024 9.6845 27.696 14.525 14.15 8.9272 22.367 15.498 34.482 27.573 13.254 13.211 22.128 24.276 30.398 37.906 7.2081 11.879 14.099 27.15 18.229 40.397 1.5996 5.1305 4.442 16.456 5.6852 22.653 2.3908 11.917 2.6998 15.722 2.7049 33.312 6e-3 18.515-0.46256 24.413-2.9166 36.758-9.3274 46.92-35.58 88.167-74.872 117.64-22.814 17.112-50.027 29.535-78.547 35.858-16.714 3.7059-35.421 5.2453-54.498 4.4846zm-35.1-78.786c-5.3e-4 -0.52647-0.0741-2.0564-0.16311-3.3999l-0.16178-2.4427-4.7018-0.26271c-4.0477-0.22614-4.7968-0.33363-5.3847-0.77253-2.0235-1.5108-1.4679-6.0695 2.2494-18.457 0.8637-2.8781 3.3371-11.321 5.4966-18.762 2.1594-7.4409 5.2002-17.836 6.7573-23.101 1.5571-5.2648 4.1948-14.282 5.8615-20.038 1.6667-5.7562 3.6145-12.4 4.3284-14.764 0.71391-2.3641 3.2583-11.037 5.6542-19.272 4.9475-17.007 8.1626-27.723 8.9438-29.811 0.51852-1.3858 0.54785-1.4139 0.99761-0.95317 0.25486 0.26106 3.8462 7.3667 7.9807 15.79 4.1345 8.4236 13.089 26.573 19.898 40.331 17.188 34.73 37.849 76.578 43.261 87.622l4.5356 9.257 11.359-0.0895c6.2475-0.0492 11.615-0.19623 11.929-0.32672 0.5614-0.23385 0.54167-0.2959-1.3723-4.3176-1.068-2.2442-8.1436-16.601-15.724-31.904-48.687-98.293-61.22-123.86-67.889-138.48-4.7022-10.309-6.9031-14.807-7.7139-15.762-0.82931-0.97742-1.6319-1.0638-2.3704-0.25525-1.1993 1.313-4.1046 10.063-9.3869 28.27-2.0569 7.0899-6.5372 22.425-9.9562 34.077-6.6396 22.629-8.5182 29.037-14.33 48.883-2.0354 6.9495-4.7977 16.369-6.1385 20.931-1.3408 4.5628-4.033 13.81-5.9826 20.549-4.304 14.877-6.136 20.889-7.3886 24.25-2.1371 5.7334-2.5723 6.3292-4.9216 6.7384-0.88855 0.15472-2.4102 0.28196-3.3815 0.28275-2.1993 3e-3 -3.5494 0.36339-4.0558 1.0863-0.42176 0.60215-0.56421 4.8802-0.18251 5.4812 0.20573 0.32388 2.4672 0.37414 23.34 0.51873l8.6151 0.0597-7e-4 -0.95723zm36.751-205.59c4.3282-0.92335 8.4607-4.943 9.4374-9.1796 0.36569-1.5862 0.32543-4.9758-0.077-6.4799-0.85108-3.1813-3.2688-6.291-6.039-7.7675-3.8111-2.0313-9.456-2.0295-13.272 5e-3 -5.9828 3.1888-8.1556 11.089-4.7878 17.408 2.6995 5.0648 8.3611 7.3754 14.738 6.015z"
|
||||
|
||||
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.4 KiB |
@@ -40,20 +40,16 @@
|
||||
|
||||
player = new Plyr(videoElement, {
|
||||
controls: [
|
||||
'play-large', // The large play button in the center
|
||||
'restart', // Restart playback
|
||||
'rewind', // Rewind by the seek time (default 10 seconds)
|
||||
'play', // Play/pause playback
|
||||
'fast-forward', // Fast forward by the seek time (default 10 seconds)
|
||||
'progress', // The progress bar and scrubber for playback and buffering
|
||||
'current-time', // The current time of playback
|
||||
'duration', // The full duration of the media
|
||||
'mute', // Toggle mute
|
||||
'volume', // Volume control
|
||||
'captions', // Toggle captions
|
||||
'settings', // Settings menu
|
||||
'download', // Show a download button with a link to either the current source or a custom URL you specify in your options
|
||||
'fullscreen' // Toggle fullscreen
|
||||
'play-large',
|
||||
'play',
|
||||
'progress',
|
||||
'current-time',
|
||||
'duration',
|
||||
'volume',
|
||||
'captions',
|
||||
'settings',
|
||||
'download',
|
||||
'fullscreen'
|
||||
]
|
||||
});
|
||||
|
||||
@@ -128,9 +124,22 @@
|
||||
dash.initialize(videoElement, data.video.dashUrl + '?local=true', get(playerAutoPlay));
|
||||
} else {
|
||||
const proxyVideos = get(playerProxyVideos);
|
||||
|
||||
let src;
|
||||
sourceInfo.sources = data.video.formatStreams.map((format) => {
|
||||
if (proxyVideos) {
|
||||
const rawSrc = new URL(format.url);
|
||||
rawSrc.host = import.meta.env.VITE_DEFAULT_INVIDIOUS_INSTANCE.replace(
|
||||
'http://',
|
||||
''
|
||||
).replace('https://', '');
|
||||
|
||||
src = rawSrc.toString();
|
||||
} else {
|
||||
src = format.url;
|
||||
}
|
||||
return {
|
||||
src: format.url + (proxyVideos ? '?local=true' : ''),
|
||||
src: src,
|
||||
size: Number(format.size.split('x')[1]),
|
||||
type: format.type
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { amSubscribed, getComments, getDislikes, getVideo, postHistory } from '$lib/Api/index.js';
|
||||
import { get } from 'svelte/store';
|
||||
import { auth } from '../../../store';
|
||||
import { auth, playerProxyVideos } from '../../../store';
|
||||
|
||||
export async function load({ params }) {
|
||||
const video = await getVideo(params.slug);
|
||||
const video = await getVideo(params.slug, get(playerProxyVideos));
|
||||
if (get(auth)) {
|
||||
postHistory(video.videoId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user