set cache to 7 days

This commit is contained in:
2026-03-05 20:20:31 +01:00
parent f21b06e6ad
commit b226b81775
4 changed files with 48 additions and 13 deletions

View File

@@ -302,7 +302,14 @@
<!-- Loading -->
<div id="loading-section" class="hidden flex flex-col items-center gap-4 py-16">
<div class="loader" style="width:40px;height:40px;border-width:5px;"></div>
<p class="text-gray-400 text-sm" id="loading-msg">Fetching AS data</p>
<p class="text-gray-400 text-sm" id="loading-msg">Querying RIPE Stat &amp; PeeringDB</p>
<!-- Shown after 3s for slow lookups -->
<div id="loading-hint" class="hidden mt-2 max-w-sm text-center">
<p class="text-xs text-amber-400/80 bg-amber-400/10 border border-amber-400/20 rounded-lg px-4 py-2">
⏳ Large ASes (like Cloudflare, Google, Tier-1 carriers) can take up to 15 seconds on the first
lookup — subsequent lookups are cached for 24h.
</p>
</div>
</div>
<!-- Results -->

View File

@@ -21,14 +21,22 @@ function showError(msg) {
errorBox.classList.remove('hidden');
loadingSection.classList.add('hidden');
resultsSection.classList.add('hidden');
if (window._loadingHintTimer) clearTimeout(window._loadingHintTimer);
}
function hideError() { errorBox.classList.add('hidden'); }
function setLoading(msg = 'Fetching AS data…') {
function setLoading(msg = 'Querying RIPE Stat & PeeringDB…') {
hideError();
loadingMsg.textContent = msg;
loadingSection.classList.remove('hidden');
resultsSection.classList.add('hidden');
// After 3s show a hint that large ASes can be slow
if (window._loadingHintTimer) clearTimeout(window._loadingHintTimer);
window._loadingHintTimer = setTimeout(() => {
const hint = document.getElementById('loading-hint');
if (hint) hint.classList.remove('hidden');
}, 3000);
}
function updateUrlParam(asn) {
@@ -69,6 +77,10 @@ async function doLookup(rawAsn) {
function renderResults(data) {
loadingSection.classList.add('hidden');
resultsSection.classList.remove('hidden');
// Reset loading hint for next lookup
if (window._loadingHintTimer) clearTimeout(window._loadingHintTimer);
const hint = document.getElementById('loading-hint');
if (hint) hint.classList.add('hidden');
// Header
document.getElementById('res-asn').textContent = `AS${data.asn}`;
@@ -290,13 +302,15 @@ function renderGraph(graph) {
.attr('fill', '#e5e7eb')
.text(d => `AS${d.asn}`);
node.filter(d => d.role !== 'tier1').append('text')
// Name label for ALL roles (tier1 gets shorter truncation)
node.append('text')
.attr('dy', d => nodeRadius[d.role] + 23)
.attr('font-size', 8)
.attr('fill', '#9ca3af')
.attr('font-size', d => d.role === 'tier1' ? 7 : 8)
.attr('fill', d => d.role === 'tier1' ? '#6b7280' : '#9ca3af')
.text(d => {
const max = d.role === 'center' ? 22 : 16;
return d.name && d.name.length > max ? d.name.slice(0, max) + '…' : (d.name || '');
if (!d.name) return '';
const max = d.role === 'center' ? 22 : d.role === 'tier1' ? 12 : 16;
return d.name.length > max ? d.name.slice(0, max) + '…' : d.name;
});
// ── Tick ──────────────────────────────────────────────────────────────