From 063154676152bcab28ee6f46a3a68b3aef8e6a50 Mon Sep 17 00:00:00 2001 From: Animesh <69345507+n-ce@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:15:24 +0530 Subject: [PATCH 1/7] Update getStreamData.ts --- src/modules/getStreamData.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/modules/getStreamData.ts b/src/modules/getStreamData.ts index 5c5ffa922..43611c80a 100644 --- a/src/modules/getStreamData.ts +++ b/src/modules/getStreamData.ts @@ -96,9 +96,21 @@ export default async function( }); const useLocal = async () => await import('./localExtraction.ts').then(mod => mod.fetchDataFromLocal(id)); - - - return (location.port === '9999') ? useLocal() : state.HLS ? useHls() : status === 'I' ? useInvidious() : status === 'N' ? fetchDataFromPiped(fallback) : usePiped(status === 'U' ? piped : proxy); - + + if (location.port === '9999') + return useLocal(); + if (state.HLS) + return useHls(); + + switch (status) { + case 'U': + return usePiped(piped); + case 'P': + return usePiped(proxy); + case 'I': + return useInvidious(); + case 'N': + return usePiped(['']); + } } From 42c2a52cfc7a48c960342f883e95d53cf0dcbb76 Mon Sep 17 00:00:00 2001 From: Animesh <69345507+n-ce@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:18:07 +0530 Subject: [PATCH 2/7] Update fetchList.ts --- src/modules/fetchList.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/modules/fetchList.ts b/src/modules/fetchList.ts index 541c9712f..7e1752d70 100644 --- a/src/modules/fetchList.ts +++ b/src/modules/fetchList.ts @@ -19,7 +19,6 @@ export default async function fetchList( let listData: StreamItem[] = []; const useHyperpipe = !mix && (store.actionsMenu.author.endsWith(' - Topic') || store.list.name.startsWith('Artist')); - const musicEnforcer = url.includes('OLAK5uy'); if (useHyperpipe) { url = await getPlaylistIdFromArtist(url) || ''; @@ -61,7 +60,7 @@ export default async function fetchList( if (listContainer.classList.contains('reverse')) listContainer.classList.remove('reverse'); - if (musicEnforcer) + if (url.includes('OLAK5uy')) group.relatedStreams = group.relatedStreams.map( (item: StreamItem) => { if (!item.uploaderName.endsWith(' - Topic')) From 7c737c660463ae950517d825f900706c31425b5b Mon Sep 17 00:00:00 2001 From: Animesh <69345507+n-ce@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:21:43 +0530 Subject: [PATCH 3/7] Update fetchList.ts --- src/modules/fetchList.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/fetchList.ts b/src/modules/fetchList.ts index 7e1752d70..8c1d92231 100644 --- a/src/modules/fetchList.ts +++ b/src/modules/fetchList.ts @@ -31,6 +31,7 @@ export default async function fetchList( const api = getApi('piped'); const type = url.includes('channel') ? 'channel' : 'playlist'; + const musicEnforcer = url.includes('OLAK5uy'); const group = await fetch(api + url) .then(res => res.json()) .then(data => { @@ -60,7 +61,7 @@ export default async function fetchList( if (listContainer.classList.contains('reverse')) listContainer.classList.remove('reverse'); - if (url.includes('OLAK5uy')) + if (musicEnforcer) group.relatedStreams = group.relatedStreams.map( (item: StreamItem) => { if (!item.uploaderName.endsWith(' - Topic')) From ac90dba4510cb4eaab39c016df1f7d4bee127965 Mon Sep 17 00:00:00 2001 From: Animesh <69345507+n-ce@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:36:12 +0530 Subject: [PATCH 4/7] Update getStreamData.ts --- src/modules/getStreamData.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/getStreamData.ts b/src/modules/getStreamData.ts index 43611c80a..430ebfe86 100644 --- a/src/modules/getStreamData.ts +++ b/src/modules/getStreamData.ts @@ -110,7 +110,7 @@ export default async function( case 'I': return useInvidious(); case 'N': - return usePiped(['']); + return usePiped([fallback]); } } From 97a710e3b92747206be95d3acd772129763e63bd Mon Sep 17 00:00:00 2001 From: Animesh <69345507+n-ce@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:41:49 +0530 Subject: [PATCH 5/7] Update getStreamData.ts --- src/modules/getStreamData.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/getStreamData.ts b/src/modules/getStreamData.ts index 430ebfe86..c0eda878a 100644 --- a/src/modules/getStreamData.ts +++ b/src/modules/getStreamData.ts @@ -73,7 +73,7 @@ export default async function( else return useInvidious(index + 1); }); - const usePiped = (src = piped, index = 0): Promise => fetchDataFromPiped(src[index]) + const usePiped = (src, index = 0): Promise => fetchDataFromPiped(src[index]) .catch(() => { if (index + 1 === src.length) return useInvidious(); From b7f6b7af83f2595e38dda658628e99d79fcae056 Mon Sep 17 00:00:00 2001 From: Animesh <69345507+n-ce@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:44:55 +0530 Subject: [PATCH 6/7] Update getStreamData.ts --- src/modules/getStreamData.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/getStreamData.ts b/src/modules/getStreamData.ts index c0eda878a..5041164f5 100644 --- a/src/modules/getStreamData.ts +++ b/src/modules/getStreamData.ts @@ -73,7 +73,7 @@ export default async function( else return useInvidious(index + 1); }); - const usePiped = (src, index = 0): Promise => fetchDataFromPiped(src[index]) + const usePiped = (src: string[], index = 0): Promise => fetchDataFromPiped(src[index]) .catch(() => { if (index + 1 === src.length) return useInvidious(); From 0127bc8dbc22d7b733dfe26785644395b7e62c80 Mon Sep 17 00:00:00 2001 From: n-ce Date: Fri, 1 Aug 2025 13:07:24 +0530 Subject: [PATCH 7/7] fix playback --- package.json | 2 +- src/modules/getStreamData.ts | 23 ++++++++++++----------- src/modules/start.ts | 4 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index edf71a662..e91063265 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "@types/sortablejs": "^1.15.8", "autoprefixer": "^10.4.21", "eruda": "^3.4.3", - "typescript": "^5.8.3", + "typescript": "^5.9.2", "vite": "^7.0.6", "vite-plugin-pwa": "^1.0.2" }, diff --git a/src/modules/getStreamData.ts b/src/modules/getStreamData.ts index 5041164f5..25f949be7 100644 --- a/src/modules/getStreamData.ts +++ b/src/modules/getStreamData.ts @@ -10,13 +10,14 @@ export default async function( const fetchDataFromPiped = ( api: string - ) => fetch(`${api}/streams/${id}`) - .then(res => res.json()) - .then(data => { - if (state.HLS ? data.hls : data.audioStreams.length) - return data; - else throw new Error(data.message); - }); + ) => + fetch(`${api}/streams/${id}`) + .then(res => res.json()) + .then(data => { + if (state.HLS ? data.hls : data.audioStreams.length) + return data; + else throw new Error(data.message); + }); const fetchDataFromInvidious = ( api: string @@ -96,12 +97,12 @@ export default async function( }); const useLocal = async () => await import('./localExtraction.ts').then(mod => mod.fetchDataFromLocal(id)); - + if (location.port === '9999') return useLocal(); if (state.HLS) return useHls(); - + switch (status) { case 'U': return usePiped(piped); @@ -109,8 +110,8 @@ export default async function( return usePiped(proxy); case 'I': return useInvidious(); - case 'N': - return usePiped([fallback]); + default: + return emergency(Error('Playback Unsuccesful')); } } diff --git a/src/modules/start.ts b/src/modules/start.ts index e70f5aaab..b8ca125f9 100644 --- a/src/modules/start.ts +++ b/src/modules/start.ts @@ -25,9 +25,9 @@ export default async function() { .then(res => res.json()) .then(data => { document.querySelector('samp')!.textContent = { - U: "⬛⬛⬛⬛", P: "⬛⬛⬛⬜", I: "🟧⬛⬛⬜⬜", N: "⬛⬜⬜⬜" + U: "⬛⬛⬛⬛", P: "⬛⬛⬛⬜", I: "⬛⬛⬜⬜", N: "⬛⬜⬜⬜" }[data.health as 'U']; - + store.api.status = data.health; store.api.piped = data.piped; store.api.proxy = data.proxy; store.api.invidious = data.invidious;