Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion src/modules/fetchList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) || '';
Expand All @@ -32,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 => {
Expand Down
33 changes: 23 additions & 10 deletions src/modules/getStreamData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -73,7 +74,7 @@ export default async function(
else return useInvidious(index + 1);
});

const usePiped = (src = piped, index = 0): Promise<Piped> => fetchDataFromPiped(src[index])
const usePiped = (src: string[], index = 0): Promise<Piped> => fetchDataFromPiped(src[index])
.catch(() => {
if (index + 1 === src.length)
return useInvidious();
Expand All @@ -97,8 +98,20 @@ 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();

return (location.port === '9999') ? useLocal() : state.HLS ? useHls() : status === 'I' ? useInvidious() : status === 'N' ? fetchDataFromPiped(fallback) : usePiped(status === 'U' ? piped : proxy);

switch (status) {
case 'U':
return usePiped(piped);
case 'P':
return usePiped(proxy);
case 'I':
return useInvidious();
default:
return emergency(Error('Playback Unsuccesful'));
}
}

4 changes: 2 additions & 2 deletions src/modules/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down