(item)
| 12304 | } |
| 12305 | |
| 12306 | attackLogsInFlight = (async () => { |
| 12307 | try { |
| 12308 | const response = await networkAwareFetch('/api/attack?limit=200&days=7', { headers }); |
| 12309 | |
| 12310 | if (response.status === 304) { |
| 12311 | console.debug('Attack logs unchanged; skipping DOM update'); |
| 12312 | return attackLogsCache; |
| 12313 | } |
| 12314 | |
| 12315 | if (!response.ok) { |
| 12316 | throw new Error(`HTTP error! status: ${response.status}`); |
| 12317 | } |
| 12318 | |
| 12319 | const data = await response.json(); |
| 12320 | attackLogsCache = data; |
| 12321 | attackLogsETag = response.headers.get('ETag') || attackLogsETag; |
| 12322 | displayAttackLogs(data); |
| 12323 | return data; |
| 12324 | } catch (error) { |
| 12325 | console.error('Error loading attack logs:', error); |
| 12326 | |
| 12327 | if (!attackLogsCache) { |
| 12328 | document.getElementById('attack-logs-container').innerHTML = ` |
| 12329 | <div class="text-center text-red-400 py-8"> |
| 12330 | <svg class="w-12 h-12 mx-auto mb-3 opacity-50" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
| 12331 | <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path> |
| 12332 | </svg> |
no test coverage detected