style: auto-fix linting issues
This commit is contained in:
parent
5c6c342c64
commit
1188a2dcce
6 changed files with 115 additions and 101 deletions
|
|
@ -4,7 +4,7 @@ class ServerAPI {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.INSTANCES_URLS = [
|
this.INSTANCES_URLS = [
|
||||||
'https://tidal-uptime.jiffy-puffs-1j.workers.dev/',
|
'https://tidal-uptime.jiffy-puffs-1j.workers.dev/',
|
||||||
'https://tidal-uptime.props-76styles.workers.dev/'
|
'https://tidal-uptime.props-76styles.workers.dev/',
|
||||||
];
|
];
|
||||||
this.apiInstances = null;
|
this.apiInstances = null;
|
||||||
}
|
}
|
||||||
|
|
@ -28,25 +28,25 @@ class ServerAPI {
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
this.apiInstances = (data.api || [])
|
this.apiInstances = (data.api || [])
|
||||||
.map(item => item.url || item)
|
.map((item) => item.url || item)
|
||||||
.filter(url => !url.includes('spotisaver.net'));
|
.filter((url) => !url.includes('spotisaver.net'));
|
||||||
return this.apiInstances;
|
return this.apiInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error('Failed to load instances from all uptime APIs');
|
console.error('Failed to load instances from all uptime APIs');
|
||||||
return [
|
return [
|
||||||
"https://eu-central.monochrome.tf",
|
'https://eu-central.monochrome.tf',
|
||||||
"https://us-west.monochrome.tf",
|
'https://us-west.monochrome.tf',
|
||||||
"https://arran.monochrome.tf",
|
'https://arran.monochrome.tf',
|
||||||
"https://triton.squid.wtf",
|
'https://triton.squid.wtf',
|
||||||
"https://api.monochrome.tf",
|
'https://api.monochrome.tf',
|
||||||
"https://monochrome-api.samidy.com",
|
'https://monochrome-api.samidy.com',
|
||||||
"https://maus.qqdl.site",
|
'https://maus.qqdl.site',
|
||||||
"https://vogel.qqdl.site",
|
'https://vogel.qqdl.site',
|
||||||
"https://katze.qqdl.site",
|
'https://katze.qqdl.site',
|
||||||
"https://hund.qqdl.site",
|
'https://hund.qqdl.site',
|
||||||
"https://tidal.kinoplus.online",
|
'https://tidal.kinoplus.online',
|
||||||
"https://wolf.qqdl.site"
|
'https://wolf.qqdl.site',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ class ServerAPI {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.INSTANCES_URLS = [
|
this.INSTANCES_URLS = [
|
||||||
'https://tidal-uptime.jiffy-puffs-1j.workers.dev/',
|
'https://tidal-uptime.jiffy-puffs-1j.workers.dev/',
|
||||||
'https://tidal-uptime.props-76styles.workers.dev/'
|
'https://tidal-uptime.props-76styles.workers.dev/',
|
||||||
];
|
];
|
||||||
this.apiInstances = null;
|
this.apiInstances = null;
|
||||||
}
|
}
|
||||||
|
|
@ -28,25 +28,25 @@ class ServerAPI {
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
this.apiInstances = (data.api || [])
|
this.apiInstances = (data.api || [])
|
||||||
.map(item => item.url || item)
|
.map((item) => item.url || item)
|
||||||
.filter(url => !url.includes('spotisaver.net'));
|
.filter((url) => !url.includes('spotisaver.net'));
|
||||||
return this.apiInstances;
|
return this.apiInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error('Failed to load instances from all uptime APIs');
|
console.error('Failed to load instances from all uptime APIs');
|
||||||
return [
|
return [
|
||||||
"https://eu-central.monochrome.tf",
|
'https://eu-central.monochrome.tf',
|
||||||
"https://us-west.monochrome.tf",
|
'https://us-west.monochrome.tf',
|
||||||
"https://arran.monochrome.tf",
|
'https://arran.monochrome.tf',
|
||||||
"https://triton.squid.wtf",
|
'https://triton.squid.wtf',
|
||||||
"https://api.monochrome.tf",
|
'https://api.monochrome.tf',
|
||||||
"https://monochrome-api.samidy.com",
|
'https://monochrome-api.samidy.com',
|
||||||
"https://maus.qqdl.site",
|
'https://maus.qqdl.site',
|
||||||
"https://vogel.qqdl.site",
|
'https://vogel.qqdl.site',
|
||||||
"https://katze.qqdl.site",
|
'https://katze.qqdl.site',
|
||||||
"https://hund.qqdl.site",
|
'https://hund.qqdl.site',
|
||||||
"https://tidal.kinoplus.online",
|
'https://tidal.kinoplus.online',
|
||||||
"https://wolf.qqdl.site"
|
'https://wolf.qqdl.site',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ class ServerAPI {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.INSTANCES_URLS = [
|
this.INSTANCES_URLS = [
|
||||||
'https://tidal-uptime.jiffy-puffs-1j.workers.dev/',
|
'https://tidal-uptime.jiffy-puffs-1j.workers.dev/',
|
||||||
'https://tidal-uptime.props-76styles.workers.dev/'
|
'https://tidal-uptime.props-76styles.workers.dev/',
|
||||||
];
|
];
|
||||||
this.apiInstances = null;
|
this.apiInstances = null;
|
||||||
}
|
}
|
||||||
|
|
@ -28,25 +28,25 @@ class ServerAPI {
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
this.apiInstances = (data.api || [])
|
this.apiInstances = (data.api || [])
|
||||||
.map(item => item.url || item)
|
.map((item) => item.url || item)
|
||||||
.filter(url => !url.includes('spotisaver.net'));
|
.filter((url) => !url.includes('spotisaver.net'));
|
||||||
return this.apiInstances;
|
return this.apiInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error('Failed to load instances from all uptime APIs');
|
console.error('Failed to load instances from all uptime APIs');
|
||||||
return [
|
return [
|
||||||
"https://eu-central.monochrome.tf",
|
'https://eu-central.monochrome.tf',
|
||||||
"https://us-west.monochrome.tf",
|
'https://us-west.monochrome.tf',
|
||||||
"https://arran.monochrome.tf",
|
'https://arran.monochrome.tf',
|
||||||
"https://triton.squid.wtf",
|
'https://triton.squid.wtf',
|
||||||
"https://api.monochrome.tf",
|
'https://api.monochrome.tf',
|
||||||
"https://monochrome-api.samidy.com",
|
'https://monochrome-api.samidy.com',
|
||||||
"https://maus.qqdl.site",
|
'https://maus.qqdl.site',
|
||||||
"https://vogel.qqdl.site",
|
'https://vogel.qqdl.site',
|
||||||
"https://katze.qqdl.site",
|
'https://katze.qqdl.site',
|
||||||
"https://hund.qqdl.site",
|
'https://hund.qqdl.site',
|
||||||
"https://tidal.kinoplus.online",
|
'https://tidal.kinoplus.online',
|
||||||
"https://wolf.qqdl.site"
|
'https://wolf.qqdl.site',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class ServerAPI {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.INSTANCES_URLS = [
|
this.INSTANCES_URLS = [
|
||||||
'https://tidal-uptime.jiffy-puffs-1j.workers.dev/',
|
'https://tidal-uptime.jiffy-puffs-1j.workers.dev/',
|
||||||
'https://tidal-uptime.props-76styles.workers.dev/'
|
'https://tidal-uptime.props-76styles.workers.dev/',
|
||||||
];
|
];
|
||||||
this.apiInstances = null;
|
this.apiInstances = null;
|
||||||
}
|
}
|
||||||
|
|
@ -40,25 +40,25 @@ class ServerAPI {
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
this.apiInstances = (data.api || [])
|
this.apiInstances = (data.api || [])
|
||||||
.map(item => item.url || item)
|
.map((item) => item.url || item)
|
||||||
.filter(url => !url.includes('spotisaver.net'));
|
.filter((url) => !url.includes('spotisaver.net'));
|
||||||
return this.apiInstances;
|
return this.apiInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error('Failed to load instances from all uptime APIs');
|
console.error('Failed to load instances from all uptime APIs');
|
||||||
return [
|
return [
|
||||||
"https://eu-central.monochrome.tf",
|
'https://eu-central.monochrome.tf',
|
||||||
"https://us-west.monochrome.tf",
|
'https://us-west.monochrome.tf',
|
||||||
"https://arran.monochrome.tf",
|
'https://arran.monochrome.tf',
|
||||||
"https://triton.squid.wtf",
|
'https://triton.squid.wtf',
|
||||||
"https://api.monochrome.tf",
|
'https://api.monochrome.tf',
|
||||||
"https://monochrome-api.samidy.com",
|
'https://monochrome-api.samidy.com',
|
||||||
"https://maus.qqdl.site",
|
'https://maus.qqdl.site',
|
||||||
"https://vogel.qqdl.site",
|
'https://vogel.qqdl.site',
|
||||||
"https://katze.qqdl.site",
|
'https://katze.qqdl.site',
|
||||||
"https://hund.qqdl.site",
|
'https://hund.qqdl.site',
|
||||||
"https://tidal.kinoplus.online",
|
'https://tidal.kinoplus.online',
|
||||||
"https://wolf.qqdl.site"
|
'https://wolf.qqdl.site',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
17
js/api.js
17
js/api.js
|
|
@ -48,7 +48,7 @@ export class LosslessAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.minVersion) {
|
if (options.minVersion) {
|
||||||
instances = instances.filter(instance => {
|
instances = instances.filter((instance) => {
|
||||||
if (!instance.version) return false;
|
if (!instance.version) return false;
|
||||||
return parseFloat(instance.version) >= parseFloat(options.minVersion);
|
return parseFloat(instance.version) >= parseFloat(options.minVersion);
|
||||||
});
|
});
|
||||||
|
|
@ -789,7 +789,10 @@ export class LosslessAPI {
|
||||||
if (cached) return cached;
|
if (cached) return cached;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await this.fetchWithRetry(`/artist/similar/?id=${artistId}`, { type: 'api', minVersion: '2.3' });
|
const response = await this.fetchWithRetry(`/artist/similar/?id=${artistId}`, {
|
||||||
|
type: 'api',
|
||||||
|
minVersion: '2.3',
|
||||||
|
});
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
// Handle various response structures
|
// Handle various response structures
|
||||||
|
|
@ -840,7 +843,10 @@ export class LosslessAPI {
|
||||||
if (cached) return cached;
|
if (cached) return cached;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await this.fetchWithRetry(`/album/similar/?id=${albumId}`, { type: 'api', minVersion: '2.3' });
|
const response = await this.fetchWithRetry(`/album/similar/?id=${albumId}`, {
|
||||||
|
type: 'api',
|
||||||
|
minVersion: '2.3',
|
||||||
|
});
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
const items = data.items || data.albums || data.data || (Array.isArray(data) ? data : []);
|
const items = data.items || data.albums || data.data || (Array.isArray(data) ? data : []);
|
||||||
|
|
@ -987,7 +993,10 @@ export class LosslessAPI {
|
||||||
if (cached) return cached;
|
if (cached) return cached;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await this.fetchWithRetry(`/recommendations/?id=${id}`, { type: 'api', minVersion: '2.4' });
|
const response = await this.fetchWithRetry(`/recommendations/?id=${id}`, {
|
||||||
|
type: 'api',
|
||||||
|
minVersion: '2.4',
|
||||||
|
});
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
const data = json.data || json;
|
const data = json.data || json;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ export const apiSettings = {
|
||||||
STORAGE_KEY: 'monochrome-api-instances-v9',
|
STORAGE_KEY: 'monochrome-api-instances-v9',
|
||||||
INSTANCES_URLS: [
|
INSTANCES_URLS: [
|
||||||
'https://tidal-uptime.jiffy-puffs-1j.workers.dev/',
|
'https://tidal-uptime.jiffy-puffs-1j.workers.dev/',
|
||||||
'https://tidal-uptime.props-76styles.workers.dev/'
|
'https://tidal-uptime.props-76styles.workers.dev/',
|
||||||
],
|
],
|
||||||
defaultInstances: { api: [], streaming: [] },
|
defaultInstances: { api: [], streaming: [] },
|
||||||
instancesLoaded: false,
|
instancesLoaded: false,
|
||||||
|
|
@ -58,30 +58,30 @@ export const apiSettings = {
|
||||||
console.error('Failed to load instances from all uptime APIs:', fetchError);
|
console.error('Failed to load instances from all uptime APIs:', fetchError);
|
||||||
this.defaultInstances = {
|
this.defaultInstances = {
|
||||||
api: [
|
api: [
|
||||||
{ url: "https://eu-central.monochrome.tf", version: "2.4" },
|
{ url: 'https://eu-central.monochrome.tf', version: '2.4' },
|
||||||
{ url: "https://us-west.monochrome.tf", version: "2.4" },
|
{ url: 'https://us-west.monochrome.tf', version: '2.4' },
|
||||||
{ url: "https://arran.monochrome.tf", version: "2.4" },
|
{ url: 'https://arran.monochrome.tf', version: '2.4' },
|
||||||
{ url: "https://triton.squid.wtf", version: "2.4" },
|
{ url: 'https://triton.squid.wtf', version: '2.4' },
|
||||||
{ url: "https://api.monochrome.tf", version: "2.3" },
|
{ url: 'https://api.monochrome.tf', version: '2.3' },
|
||||||
{ url: "https://monochrome-api.samidy.com", version: "2.3" },
|
{ url: 'https://monochrome-api.samidy.com', version: '2.3' },
|
||||||
{ url: "https://maus.qqdl.site", version: "2.2" },
|
{ url: 'https://maus.qqdl.site', version: '2.2' },
|
||||||
{ url: "https://vogel.qqdl.site", version: "2.2" },
|
{ url: 'https://vogel.qqdl.site', version: '2.2' },
|
||||||
{ url: "https://katze.qqdl.site", version: "2.2" },
|
{ url: 'https://katze.qqdl.site', version: '2.2' },
|
||||||
{ url: "https://hund.qqdl.site", version: "2.2" },
|
{ url: 'https://hund.qqdl.site', version: '2.2' },
|
||||||
{ url: "https://tidal.kinoplus.online", version: "2.2" },
|
{ url: 'https://tidal.kinoplus.online', version: '2.2' },
|
||||||
{ url: "https://wolf.qqdl.site", version: "2.2" }
|
{ url: 'https://wolf.qqdl.site', version: '2.2' },
|
||||||
],
|
],
|
||||||
streaming: [
|
streaming: [
|
||||||
{ url: "https://arran.monochrome.tf", version: "2.4" },
|
{ url: 'https://arran.monochrome.tf', version: '2.4' },
|
||||||
{ url: "https://triton.squid.wtf", version: "2.4" },
|
{ url: 'https://triton.squid.wtf', version: '2.4' },
|
||||||
{ url: "https://api.monochrome.tf", version: "2.3" },
|
{ url: 'https://api.monochrome.tf', version: '2.3' },
|
||||||
{ url: "https://monochrome-api.samidy.com", version: "2.3" },
|
{ url: 'https://monochrome-api.samidy.com', version: '2.3' },
|
||||||
{ url: "https://maus.qqdl.site", version: "2.2" },
|
{ url: 'https://maus.qqdl.site', version: '2.2' },
|
||||||
{ url: "https://vogel.qqdl.site", version: "2.2" },
|
{ url: 'https://vogel.qqdl.site', version: '2.2' },
|
||||||
{ url: "https://katze.qqdl.site", version: "2.2" },
|
{ url: 'https://katze.qqdl.site', version: '2.2' },
|
||||||
{ url: "https://hund.qqdl.site", version: "2.2" },
|
{ url: 'https://hund.qqdl.site', version: '2.2' },
|
||||||
{ url: "https://wolf.qqdl.site", version: "2.2" }
|
{ url: 'https://wolf.qqdl.site', version: '2.2' },
|
||||||
]
|
],
|
||||||
};
|
};
|
||||||
this.instancesLoaded = true;
|
this.instancesLoaded = true;
|
||||||
this._loadPromise = null;
|
this._loadPromise = null;
|
||||||
|
|
@ -91,11 +91,13 @@ export const apiSettings = {
|
||||||
let groupedInstances = { api: [], streaming: [] };
|
let groupedInstances = { api: [], streaming: [] };
|
||||||
|
|
||||||
if (data.api && Array.isArray(data.api)) {
|
if (data.api && Array.isArray(data.api)) {
|
||||||
groupedInstances.api = data.api.filter(instance => !instance.url.includes('spotisaver.net'));
|
groupedInstances.api = data.api.filter((instance) => !instance.url.includes('spotisaver.net'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.streaming && Array.isArray(data.streaming)) {
|
if (data.streaming && Array.isArray(data.streaming)) {
|
||||||
groupedInstances.streaming = data.streaming.filter(instance => !instance.url.includes('spotisaver.net'));
|
groupedInstances.streaming = data.streaming.filter(
|
||||||
|
(instance) => !instance.url.includes('spotisaver.net')
|
||||||
|
);
|
||||||
} else if (groupedInstances.api.length > 0) {
|
} else if (groupedInstances.api.length > 0) {
|
||||||
groupedInstances.streaming = [...groupedInstances.api];
|
groupedInstances.streaming = [...groupedInstances.api];
|
||||||
}
|
}
|
||||||
|
|
@ -104,10 +106,13 @@ export const apiSettings = {
|
||||||
this.instancesLoaded = true;
|
this.instancesLoaded = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
localStorage.setItem(this.STORAGE_KEY, JSON.stringify({
|
localStorage.setItem(
|
||||||
|
this.STORAGE_KEY,
|
||||||
|
JSON.stringify({
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
data: groupedInstances
|
data: groupedInstances,
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('Failed to cache instances:', e);
|
console.warn('Failed to cache instances:', e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue