dcae228a24
- 모든 관리자 페이지에서 DB 데이터를 서버에서 직접 HTML에 주입 - __INIT__ 글로벌 변수로 초기 데이터 전달 (fetch 불필요) - 대시보드/사이트관리/AdSense/도메인/로그/사이트상세 전부 적용 - trust proxy 설정 (Traefik 뒤 동작) - 저장/삭제/크롤링 등 액션은 여전히 API fetch 사용 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
31 lines
1.3 KiB
Plaintext
31 lines
1.3 KiB
Plaintext
<%- include('layout', { page: 'logs', pageTitle: '크롤링 로그', body: `
|
|
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h2>최근 로그</h2>
|
|
<button class="btn btn-outline btn-sm" onclick="reloadLogs()">새로고침</button>
|
|
</div>
|
|
<table>
|
|
<thead><tr><th style="width:160px">시간</th><th style="width:120px">사이트</th><th style="width:120px">액션</th><th>메시지</th></tr></thead>
|
|
<tbody id="logs-tbody"></tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<script>
|
|
var logs = Array.isArray(__INIT__) ? __INIT__ : [];
|
|
|
|
function renderLogs(){
|
|
document.getElementById('logs-tbody').innerHTML = logs.map(function(l){
|
|
var ac = l.action.includes('error')?'danger':l.action.includes('success')?'success':'info';
|
|
return '<tr><td class="text-muted">'+new Date(l.created_at).toLocaleString('ko-KR')+'</td>'+
|
|
'<td>'+(l.site_name||'-')+'</td>'+
|
|
'<td><span class="badge badge-'+ac+'">'+l.action+'</span></td>'+
|
|
'<td style="word-break:break-all">'+(l.message||'')+'</td></tr>';
|
|
}).join('') || '<tr><td colspan="4" class="text-muted" style="text-align:center;padding:2rem">로그가 없습니다</td></tr>';
|
|
}
|
|
renderLogs();
|
|
|
|
async function reloadLogs(){var r=await api('GET','/api/logs?limit=100');if(r&&r.length!==undefined)logs=r;renderLogs();}
|
|
</script>
|
|
` }) %>
|