fix: stuff
This commit is contained in:
parent
eba9e8b5d0
commit
77ed4a6de6
2
src/app.d.ts
vendored
2
src/app.d.ts
vendored
@ -11,4 +11,4 @@ declare global {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export {};
|
export { };
|
||||||
|
@ -9,11 +9,23 @@ interface MusicInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function load({ params }) {
|
export async function load({ params }) {
|
||||||
const resp = await fetch(`${LOCAL_MUSIKQUAD_SERVER}/share/info/${params.token}`);
|
const token = params.token;
|
||||||
|
let color = '#222222';
|
||||||
|
|
||||||
|
const resp = await fetch(`${LOCAL_MUSIKQUAD_SERVER}/share/info/${token}`);
|
||||||
const info: MusicInfo = await resp.json();
|
const info: MusicInfo = await resp.json();
|
||||||
|
|
||||||
|
/*const thumb_resp = await fetch(`${LOCAL_MUSIKQUAD_SERVER}/share/thumbnail/${token}`);
|
||||||
|
if (thumb_resp.ok) {
|
||||||
|
const thumb = await thumb_resp.blob();
|
||||||
|
const rawColor = await getColor(thumb);
|
||||||
|
color = rgbToHex(rawColor[0], rawColor[1], rawColor[2]);
|
||||||
|
}*/
|
||||||
|
|
||||||
return {
|
return {
|
||||||
info,
|
info,
|
||||||
thumbnail_url: `${scheme}://${PUBLIC_MUSIKQUAD_SERVER}/share/thumbnail/${params.token}`,
|
color,
|
||||||
audio_url: `${scheme}://${PUBLIC_MUSIKQUAD_SERVER}/share/audio/${params.token}`
|
thumbnail_url: `${scheme}://${PUBLIC_MUSIKQUAD_SERVER}/share/thumbnail/${token}`,
|
||||||
|
audio_url: `${scheme}://${PUBLIC_MUSIKQUAD_SERVER}/share/audio/${token}`
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
const hasAlbum = data.info.album;
|
const hasAlbum = data.info.album;
|
||||||
|
|
||||||
if (hasArtist && hasAlbum) {
|
if (hasArtist && hasAlbum) {
|
||||||
return `from ${data.info.album} by ${data.info.artist}`;
|
return `from ${data.info.album}\nby ${data.info.artist}`;
|
||||||
} else if (hasArtist) {
|
} else if (hasArtist) {
|
||||||
return `by ${data.info.artist}`;
|
return `by ${data.info.artist}`;
|
||||||
} else if (hasAlbum) {
|
} else if (hasAlbum) {
|
||||||
@ -44,6 +44,7 @@
|
|||||||
<meta property="og:description" content={getAlbumArtistInfo()} />
|
<meta property="og:description" content={getAlbumArtistInfo()} />
|
||||||
<meta property="og:image" content={data.thumbnail_url} />
|
<meta property="og:image" content={data.thumbnail_url} />
|
||||||
<meta property="og:audio" content={data.audio_url} />
|
<meta property="og:audio" content={data.audio_url} />
|
||||||
|
<meta name="theme-color" content={data.color} />
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@ -59,7 +60,6 @@
|
|||||||
bind:paused
|
bind:paused
|
||||||
bind:currentTime
|
bind:currentTime
|
||||||
bind:duration
|
bind:duration
|
||||||
on:loadstart={(event) => event.currentTarget.play()}
|
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
class="relative rounded placeholder w-16 h-16"
|
class="relative rounded placeholder w-16 h-16"
|
||||||
|
@ -78,3 +78,12 @@ export function interceptKeys(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function componentToHex(c: number) {
|
||||||
|
var hex = c.toString(16);
|
||||||
|
return hex.length == 1 ? '0' + hex : hex;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function rgbToHex(r: number, g: number, b: number) {
|
||||||
|
return '#' + componentToHex(r) + componentToHex(g) + componentToHex(b);
|
||||||
|
}
|
||||||
|
@ -323,9 +323,9 @@
|
|||||||
svelte "^3.58.0"
|
svelte "^3.58.0"
|
||||||
|
|
||||||
"@sveltejs/kit@^1.15.9":
|
"@sveltejs/kit@^1.15.9":
|
||||||
version "1.16.2"
|
version "1.16.3"
|
||||||
resolved "https://registry.yarnpkg.com/@sveltejs/kit/-/kit-1.16.2.tgz#639fd71abbb48ec819b909f051418bd4193f40e0"
|
resolved "https://registry.yarnpkg.com/@sveltejs/kit/-/kit-1.16.3.tgz#2b7540dbe08ce5d2eb46a282043c5a345f25691e"
|
||||||
integrity sha512-yxcpA4nvlVlJ+VyYnj0zD3QN05kfmoh4OyitlPrVG34nnZSHzFpE4eZ33X1A/tc9prslSFRhpM6rWngCs0nM8w==
|
integrity sha512-8uv0udYRpVuE1BweFidcWHfL+u2gAANKmvIal1dN/FWPBl7DJYbt9zYEtr3bNTiXystT8Sn0Wp54RfwpbPqHjQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@sveltejs/vite-plugin-svelte" "^2.1.1"
|
"@sveltejs/vite-plugin-svelte" "^2.1.1"
|
||||||
"@types/cookie" "^0.5.1"
|
"@types/cookie" "^0.5.1"
|
||||||
|
Loading…
Reference in New Issue
Block a user