revert
This commit is contained in:
parent
499100810a
commit
85b0d31b29
1 changed files with 28 additions and 27 deletions
53
dist/js/app.js
vendored
53
dist/js/app.js
vendored
|
|
@ -462,17 +462,12 @@ const Utils = (() => {
|
||||||
const errors = [];
|
const errors = [];
|
||||||
|
|
||||||
for (const url of urls) {
|
for (const url of urls) {
|
||||||
for (let attempt = 0; attempt <= CONFIG.API.RETRY_ATTEMPTS; attempt++) {
|
try {
|
||||||
try {
|
const response = await fetchWithTimeout(url, options);
|
||||||
const response = await fetchWithTimeout(url, options);
|
return await response.json();
|
||||||
return await response.json();
|
} catch (error) {
|
||||||
} catch (error) {
|
errors.push({ url, error: error.message });
|
||||||
errors.push({ url, attempt, error: error.message });
|
continue;
|
||||||
if (attempt < CONFIG.API.RETRY_ATTEMPTS) {
|
|
||||||
// Exponential back-off: 200ms, 400ms, …
|
|
||||||
await new Promise(r => setTimeout(r, 200 * 2 ** attempt));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1018,21 +1013,9 @@ class StateManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
update(updates) {
|
update(updates) {
|
||||||
const changed = [];
|
|
||||||
|
|
||||||
Object.entries(updates).forEach(([key, value]) => {
|
Object.entries(updates).forEach(([key, value]) => {
|
||||||
const oldValue = this.#state[key];
|
this.set(key, value);
|
||||||
this.#state[key] = value;
|
|
||||||
if (this.#listeners.has(key)) {
|
|
||||||
changed.push({ key, value, oldValue });
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Notify after all values are in place
|
|
||||||
changed.forEach(({ key, value, oldValue }) => {
|
|
||||||
this.#listeners.get(key)?.forEach(cb => cb(value, oldValue));
|
|
||||||
});
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1870,6 +1853,24 @@ class ComparisonManager {
|
||||||
this.#lifecycle.destroy();
|
this.#lifecycle.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#handleCompare() {
|
||||||
|
const service1 = this.#elements.select1.value;
|
||||||
|
const service2 = this.#elements.select2.value;
|
||||||
|
|
||||||
|
console.log('Comparing services:', { service1, service2 });
|
||||||
|
|
||||||
|
if (!service1 || !service2) {
|
||||||
|
this.#showEmptyState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (service1 === service2) {
|
||||||
|
this.#showSameProviderWarning();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#renderComparison(service1, service2);
|
||||||
|
}
|
||||||
|
|
||||||
#renderComparison(service1, service2) {
|
#renderComparison(service1, service2) {
|
||||||
const hosts = Object.keys(this.#data);
|
const hosts = Object.keys(this.#data);
|
||||||
|
|
@ -2293,8 +2294,8 @@ class App {
|
||||||
|
|
||||||
// Fetch data
|
// Fetch data
|
||||||
const dataPromises = [
|
const dataPromises = [
|
||||||
DataService.fetchHosts('file-hosts'),
|
Utils.fetchWithFallback(CONFIG.API.FILE_HOSTS),
|
||||||
DataService.fetchHosts('adult-hosts')
|
Utils.fetchWithFallback(CONFIG.API.ADULT_HOSTS)
|
||||||
];
|
];
|
||||||
|
|
||||||
const results = await Promise.allSettled(dataPromises);
|
const results = await Promise.allSettled(dataPromises);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue