js fixes
This commit is contained in:
parent
c3fd191072
commit
a419f38024
4 changed files with 62 additions and 76 deletions
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
7
js/ui.js
7
js/ui.js
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue