Revert "style: auto-fix linting issues"
This reverts commit 4b6f81b2ec.
This commit is contained in:
parent
a4c33a35fb
commit
d4f6c5911f
3 changed files with 16 additions and 36 deletions
34
js/HiFi.ts
34
js/HiFi.ts
|
|
@ -1717,11 +1717,7 @@ class HiFiClient {
|
|||
const artist_url = `https://openapi.tidal.com/v2/artists/${id}`;
|
||||
const payload = await this.#fetchJson<any>(
|
||||
artist_url,
|
||||
{
|
||||
countryCode: this.#countryCode,
|
||||
include: 'albums,albums.coverArt,tracks,tracks.albums,biography,profileArt',
|
||||
collapseBy: 'FINGERPRINT',
|
||||
},
|
||||
{ countryCode: this.#countryCode, include: 'albums,albums.coverArt,tracks,tracks.albums,biography,profileArt', collapseBy: 'FINGERPRINT' },
|
||||
signal
|
||||
);
|
||||
|
||||
|
|
@ -1750,7 +1746,7 @@ class HiFiClient {
|
|||
picture: getPic(data, 'profileArt') || data?.attributes?.selectedAlbumCoverFallback || null,
|
||||
};
|
||||
|
||||
const picture = artist_data.picture;
|
||||
let picture = artist_data.picture;
|
||||
let cover: ArtistCover | null = null;
|
||||
if (picture) {
|
||||
const slug = picture.replace(/-/g, '/');
|
||||
|
|
@ -1776,7 +1772,7 @@ class HiFiClient {
|
|||
releaseDate: al.attributes?.releaseDate,
|
||||
type: al.attributes?.albumType,
|
||||
cover: getPic(al, 'coverArt'),
|
||||
artist: { id: artist_data.id, name: artist_data.name },
|
||||
artist: { id: artist_data.id, name: artist_data.name }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1788,34 +1784,24 @@ class HiFiClient {
|
|||
if (tr) {
|
||||
let albumInfo = undefined;
|
||||
if (tr.relationships?.albums?.data?.[0]) {
|
||||
const aRef = tr.relationships.albums.data[0];
|
||||
const aItem = includedMap.get(`albums:${aRef.id}`);
|
||||
if (aItem) {
|
||||
albumInfo = {
|
||||
id: Number(aItem.id),
|
||||
title: aItem.attributes?.title,
|
||||
cover: getPic(aItem, 'coverArt'),
|
||||
};
|
||||
}
|
||||
const aRef = tr.relationships.albums.data[0];
|
||||
const aItem = includedMap.get(`albums:${aRef.id}`);
|
||||
if (aItem) {
|
||||
albumInfo = { id: Number(aItem.id), title: aItem.attributes?.title, cover: getPic(aItem, 'coverArt') };
|
||||
}
|
||||
}
|
||||
tracks.push({
|
||||
id: Number(tr.id),
|
||||
title: tr.attributes?.title,
|
||||
duration: tr.attributes?.duration ? 100 : undefined,
|
||||
album: albumInfo,
|
||||
artist: { id: artist_data.id, name: artist_data.name },
|
||||
artist: { id: artist_data.id, name: artist_data.name }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HiFiClient.#jsonResponse({
|
||||
version: HiFiClient.API_VERSION,
|
||||
artist: artist_data,
|
||||
cover,
|
||||
albums: { items: albums },
|
||||
tracks,
|
||||
});
|
||||
return HiFiClient.#jsonResponse({ version: HiFiClient.API_VERSION, artist: artist_data, cover, albums: { items: albums }, tracks });
|
||||
}
|
||||
|
||||
// fallback to original f logic
|
||||
|
|
|
|||
|
|
@ -1049,8 +1049,8 @@ ul {
|
|||
gap: 0.375rem;
|
||||
padding: 0.4rem 0.6rem;
|
||||
margin-bottom: 1rem;
|
||||
background: rgb(245, 158, 11, 0.12);
|
||||
border: 1px solid rgb(245, 158, 11, 0.25);
|
||||
background: rgba(245, 158, 11, 0.12);
|
||||
border: 1px solid rgba(245, 158, 11, 0.25);
|
||||
border-radius: var(--radius-md);
|
||||
color: #f59e0b;
|
||||
font-size: 0.7rem;
|
||||
|
|
|
|||
|
|
@ -4,13 +4,7 @@ import { LosslessAPI } from './js/api.js';
|
|||
// mock out modules to make LosslessAPI load in bun
|
||||
import { mock } from 'bun:test';
|
||||
mock.module('./js/icons.ts', () => ({}));
|
||||
mock.module('./js/settings.js', () => ({
|
||||
devModeSettings: { isEnabled: () => false },
|
||||
syncManager: {},
|
||||
musicProviderSettings: {},
|
||||
audioSettings: {},
|
||||
apiSettings: {},
|
||||
}));
|
||||
mock.module('./js/settings.js', () => ({ devModeSettings: { isEnabled: () => false }, syncManager: {}, musicProviderSettings: {}, audioSettings: {}, apiSettings: {} }));
|
||||
|
||||
globalThis.localStorage = { getItem: () => null, setItem: () => {}, removeItem: () => {} };
|
||||
globalThis.window = { matchMedia: () => ({ matches: false }) };
|
||||
|
|
@ -22,12 +16,12 @@ async function test() {
|
|||
// mock cache
|
||||
api.cache = { get: () => null, set: () => {} };
|
||||
|
||||
api.fetchWithRetry = async function (relativePath, options) {
|
||||
console.log('fetchWithRetry called:', relativePath);
|
||||
api.fetchWithRetry = async function(relativePath, options) {
|
||||
console.log("fetchWithRetry called:", relativePath);
|
||||
return HiFiClient.instance.query(relativePath);
|
||||
};
|
||||
|
||||
const res = await api.search('coldplay');
|
||||
console.log('Returned tracks:', res.tracks?.items?.length);
|
||||
console.log("Returned tracks:", res.tracks?.items?.length);
|
||||
}
|
||||
test().catch(console.error);
|
||||
|
|
|
|||
Loading…
Reference in a new issue