- Relocated code from App.vue to their respective stores
- Linked to privacy page in wiki (related to #15)
This commit is contained in:
Shiny Nematoda 2022-09-09 18:49:13 +00:00
parent 1b5ee1d2d5
commit 44db54737b
No known key found for this signature in database
GPG key ID: 6506D50F5613A42D
17 changed files with 666 additions and 620 deletions

View file

@ -26,3 +26,33 @@ export function useStore() {
};
}
}
export function useMetadata(url, urls, data) {
if ('mediaSession' in navigator) {
const now = urls.filter(u => u.url === url)[0];
let artwork = [],
album = undefined;
if (now) {
album = now.subtitle;
if (now.thumbnails) {
artwork = now.thumbnails.map(t => ({
sizes: t.width && t.height ? t.width + 'x' + t.height : '512x512',
src: t.url,
type: 'image/webp',
}));
} else artwork = [{ src: data.art, type: 'image/webp' }];
console.log(album, artwork);
}
navigator.mediaSession.metadata = new MediaMetadata({
title: data.title,
artist: data.artist,
album: album,
artwork: artwork,
});
}
}