xycyxc
All checks were successful
Deploy / deploy-staging (push) Successful in 7s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-05-05 23:20:29 +02:00
parent eb8b04a621
commit e335a8d5bf
5 changed files with 7 additions and 218 deletions

View File

@@ -8,10 +8,6 @@
const { useEffect, useMemo, useState } = React;
const apiBase = root.dataset.apiBase || '/api/mining-checker/v1';
const initialProjectKey = root.dataset.defaultProjectKey || 'doge-main';
const fxProvider = root.dataset.fxProvider || 'currencyapi';
const fxBaseUrl = root.dataset.fxUrl || 'https://currencyapi.net';
const fxCurrenciesUrl = root.dataset.fxCurrenciesUrl || fxBaseUrl;
const fxApiKeyMask = root.dataset.fxApiKeyMask || '';
const initialActiveTab = String(root.dataset.activeView || 'overview').trim() || 'overview';
const configuredSections = (() => {
try {
@@ -109,21 +105,6 @@
});
}
function buildExternalFxUrl(base) {
if (fxProvider === 'currencyapi') {
const params = new URLSearchParams({
base: String(base || 'USD').toUpperCase(),
output: 'json',
});
if (fxApiKeyMask) {
params.set('key', fxApiKeyMask);
}
return `${fxBaseUrl}/api/v2/rates?${params.toString()}`;
}
return `${fxBaseUrl}/latest?base=${encodeURIComponent(String(base || 'USD').toUpperCase())}`;
}
async function loadLatestDebugTrace() {
try {
const response = await fetch(`${apiBase}/debug/latest`, {
@@ -297,7 +278,6 @@
daily_cost_currency: 'EUR',
report_currency: 'EUR',
crypto_currency: 'DOGE',
fx_max_age_hours: 3,
preferred_currencies: ['DOGE', 'USD', 'EUR'],
cost_plans: [],
currencies: [],
@@ -646,7 +626,6 @@
baseline_coins_total: '',
report_currency: 'EUR',
crypto_currency: 'DOGE',
fx_max_age_hours: 3,
});
const [moduleAuthForm, setModuleAuthForm] = useState({
required: true,
@@ -1097,7 +1076,6 @@
baseline_coins_total: normalized.settings.baseline_coins_total || '',
report_currency: normalized.settings.report_currency || 'EUR',
crypto_currency: normalized.settings.crypto_currency || 'DOGE',
fx_max_age_hours: normalized.settings.fx_max_age_hours || 3,
});
setFxSelection(Array.isArray(normalized.settings.preferred_currencies) && normalized.settings.preferred_currencies.length
? normalized.settings.preferred_currencies
@@ -1372,7 +1350,6 @@
daily_cost_currency: currentSettings.daily_cost_currency,
report_currency: settingsForm.report_currency || 'EUR',
crypto_currency: settingsForm.crypto_currency || 'DOGE',
fx_max_age_hours: settingsForm.fx_max_age_hours || 3,
preferred_currencies: Array.isArray(currentSettings.preferred_currencies)
? currentSettings.preferred_currencies
: fxSelection,
@@ -1788,52 +1765,6 @@
}
}
async function refreshSelectedFxRates() {
setSaving(true);
setError('');
setMessage('');
try {
emitDebug({
type: 'external:request-plan',
label: 'Ich rufe jetzt extern FX-Rates auf',
provider: fxProvider,
url: buildExternalFxUrl('USD'),
method: 'GET',
headers: { Accept: 'application/json' },
});
const probe = await request(`${apiBase}/projects/${encodeURIComponent(projectKey)}/fx-probe`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ base: 'USD' }),
timeoutMs: 20000,
});
emitDebug({
type: 'external:response',
label: 'Hey, hier ist der Response vor dem DB-Schritt',
url: probe.url,
http_status: probe.http_status,
curl_error: probe.curl_error,
response_headers: probe.response_headers,
response_body: probe.response_body,
});
const result = await request(`${apiBase}/projects/${encodeURIComponent(projectKey)}/fx-refresh`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
base: 'USD',
}),
timeoutMs: 15000,
});
await loadFxHistory(projectKey);
await loadBootstrap(projectKey);
setMessage(`Wechselkurse aktualisiert. ${result.updated_count || 0} Datensaetze gespeichert.`);
} catch (err) {
setError(err.message);
} finally {
setSaving(false);
}
}
async function copyDebugConsole() {
const content = debugEntries
.slice()
@@ -2794,7 +2725,6 @@
inputField('Baseline Coins', 'number', settingsForm.baseline_coins_total, (value) => setSettingsForm({ ...settingsForm, baseline_coins_total: value }), '0.000001'),
selectField('Standard-FIAT-Währung', settingsForm.report_currency || 'EUR', selectableFiatCurrencies.map((currency) => currency.code), (value) => setSettingsForm({ ...settingsForm, report_currency: value })),
selectField('Standard-Krypto-Währung', settingsForm.crypto_currency || 'DOGE', selectableCryptoCurrencies.map((currency) => currency.code), (value) => setSettingsForm({ ...settingsForm, crypto_currency: value })),
inputField('FX maximal in Stunden wiederverwenden', 'number', String(settingsForm.fx_max_age_hours || 3), (value) => setSettingsForm({ ...settingsForm, fx_max_age_hours: value }), '0.25'),
h('button', {
type: 'submit',
className: 'mc-button mc-button--primary',