fix: silence RODA dashboard proxy logs
This commit is contained in:
@@ -74,6 +74,7 @@
|
||||
</script>
|
||||
<script>
|
||||
window.APP_CONFIG = window.APP_CONFIG || {
|
||||
debugLogs: false,
|
||||
dashboardTargetUrl: 'https://dashboard.informatika.untan.ac.id/index.php?penelitian',
|
||||
dashboardProxyTemplates: [
|
||||
'https://api.allorigins.win/get?url={{url}}&ts={{ts}}',
|
||||
@@ -1471,6 +1472,7 @@
|
||||
}
|
||||
|
||||
function logAppError(scope, error, extra = {}) {
|
||||
if (window.APP_CONFIG?.debugLogs !== true) return;
|
||||
console.error(`[${scope}]`, error, extra);
|
||||
}
|
||||
|
||||
@@ -1481,6 +1483,7 @@
|
||||
if (error.message === 'INVALID_RESPONSE') return 'Respons dari proxy tidak valid dan tidak bisa diproses.';
|
||||
if (error.message === 'EMPTY_RESPONSE') return 'Dashboard mengembalikan data kosong atau struktur halaman berubah.';
|
||||
if (error.message === 'NO_ROWS_FOUND') return 'Data penelitian tidak ditemukan pada halaman dashboard.';
|
||||
if (error.message === 'DASHBOARD_PROXY_NOT_CONFIGURED') return 'Proxy dashboard belum dikonfigurasi.';
|
||||
if (error.message?.startsWith('HTTP_ERROR_')) return `Proxy merespons gagal (${error.message.replace('HTTP_ERROR_', 'HTTP ')}).`;
|
||||
return 'Gagal mengambil data. Server dashboard mungkin sedang sibuk atau memblokir akses.';
|
||||
}
|
||||
@@ -1576,7 +1579,8 @@
|
||||
}
|
||||
|
||||
if (!proxyServers.length) {
|
||||
throw new Error('DASHBOARD_PROXY_NOT_CONFIGURED');
|
||||
renderRisetFeedback('Pemuatan Data Gagal', getDashboardErrorMessage(new Error('DASHBOARD_PROXY_NOT_CONFIGURED')), 'Coba Lagi', 'fetchDashboardData()');
|
||||
return;
|
||||
}
|
||||
|
||||
let lastError = null;
|
||||
@@ -1587,7 +1591,6 @@
|
||||
|
||||
try {
|
||||
const proxyUrl = getProxyUrl(targetUrl);
|
||||
console.log(`Trying proxy: ${proxyUrl}`);
|
||||
|
||||
const response = await fetch(proxyUrl, { signal: controller.signal });
|
||||
clearTimeout(timeoutId);
|
||||
@@ -1651,14 +1654,12 @@
|
||||
throw new Error('NO_ROWS_FOUND');
|
||||
} catch (error) {
|
||||
clearTimeout(timeoutId);
|
||||
logAppError('dashboard-proxy', error, { targetUrl });
|
||||
lastError = error;
|
||||
// Lanjut ke proxy berikutnya...
|
||||
}
|
||||
}
|
||||
|
||||
// Jika semua proxy gagal
|
||||
logAppError('fetchDashboardData', lastError);
|
||||
renderRisetFeedback('Pemuatan Data Gagal', getDashboardErrorMessage(lastError), 'Coba Lagi', 'fetchDashboardData()');
|
||||
}
|
||||
|
||||
@@ -2018,7 +2019,6 @@
|
||||
filterRiset(currentFilter);
|
||||
searchRiset('');
|
||||
fetchDashboardData().catch((error) => {
|
||||
logAppError('DOMContentLoaded.fetchDashboardData', error);
|
||||
renderRisetFeedback('Pemuatan Data Gagal', getDashboardErrorMessage(error), 'Coba Lagi', 'fetchDashboardData()');
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user