This commit is contained in:
Julien Maille 2026-01-11 00:58:55 +01:00
parent c3fd191072
commit a419f38024
4 changed files with 62 additions and 76 deletions

View file

@ -69,10 +69,7 @@ export class LosslessAPI {
}
if (response.status === 401) {
let errorData;
try {
errorData = await response.clone().json();
} catch {}
let errorData = await response.clone().json();
if (errorData?.subStatus === 11002) {
lastError = new Error(errorData?.userMessage || 'Authentication failed');

View file

@ -166,12 +166,10 @@ export const apiSettings = {
async getInstances(type = 'api') {
let instancesObj;
try {
const stored = localStorage.getItem(this.STORAGE_KEY);
if (stored) {
instancesObj = JSON.parse(stored);
}
} catch (e) {}
if (!instancesObj) {
instancesObj = await this.loadInstancesFromGitHub();

View file

@ -1311,12 +1311,7 @@ export class UIRenderer {
}
// Render API playlist
let apiResult;
try {
apiResult = await this.api.getPlaylist(playlistId);
} catch (error) {
throw error;
}
let apiResult = await this.api.getPlaylist(playlistId);
const { playlist, tracks } = apiResult;

View file

@ -75,7 +75,6 @@ export function getVibrantColorFromImage(imgElement) {
const ctx = canvas.getContext('2d');
if (!ctx) return null;
try {
const maxDimension = 64;
let w = imgElement.naturalWidth || imgElement.width;
let h = imgElement.naturalHeight || imgElement.height;
@ -145,7 +144,4 @@ export function getVibrantColorFromImage(imgElement) {
const best = candidates[0];
return hslToHex(best.h, best.s, best.l);
} catch (e) {
throw e; // Re-throw to allow UI to handle CORS retry
}
}