mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-29 11:36:36 +08:00
fix cloud library mounts and artwork caching
This commit is contained in:
@@ -151,9 +151,15 @@ export function hlsURL(mediaId: string): string {
|
||||
export function imageURL(remote?: string): string {
|
||||
if (!remote) return ''
|
||||
if (remote.startsWith('/api/img')) return remote
|
||||
if (remote.startsWith('/api/')) return withQuery(remote, tokenQuery())
|
||||
return `/api/img?url=${encodeURIComponent(remote)}&${tokenQuery()}`
|
||||
}
|
||||
|
||||
function withQuery(url: string, query: string): string {
|
||||
if (!query) return url
|
||||
return `${url}${url.includes('?') ? '&' : '?'}${query}`
|
||||
}
|
||||
|
||||
// getToken returns the current auth token
|
||||
export function getToken(): string | null {
|
||||
return useAuthStore.getState().token
|
||||
|
||||
Reference in New Issue
Block a user