Files
crm.clientright.ru/debug_upload_monitor.html

165 lines
7.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<title>Upload Debug Monitor</title>
<meta charset="utf-8">
<style>
body { font-family: monospace; margin: 20px; background: #1e1e1e; color: #fff; }
.container { max-width: 1200px; margin: 0 auto; }
.log-section { margin: 20px 0; padding: 15px; border: 1px solid #444; border-radius: 5px; background: #2d2d2d; }
.log-content { max-height: 400px; overflow-y: auto; background: #000; padding: 10px; border-radius: 3px; font-size: 12px; line-height: 1.4; }
.controls { margin: 20px 0; }
button { padding: 10px 15px; margin: 5px; background: #007acc; color: white; border: none; border-radius: 3px; cursor: pointer; }
button:hover { background: #005a9e; }
.status { padding: 10px; margin: 10px 0; border-radius: 3px; }
.status.success { background: #2d5a2d; border: 1px solid #4a8a4a; }
.status.error { background: #5a2d2d; border: 1px solid #8a4a4a; }
.status.info { background: #2d4a5a; border: 1px solid #4a6a8a; }
.timestamp { color: #888; }
.highlight { background: #444; padding: 2px 4px; border-radius: 2px; }
pre { white-space: pre-wrap; word-wrap: break-word; }
</style>
</head>
<body>
<div class="container">
<h1>🔧 Upload Debug Monitor</h1>
<div class="controls">
<button onclick="loadServerLog()">📄 Обновить серверный лог</button>
<button onclick="loadDebugLog()">🐛 Обновить debug.log</button>
<button onclick="loadS3Log()">☁️ Обновить S3 лог</button>
<button onclick="clearLogs()">🗑️ Очистить экран</button>
<button onclick="startAutoRefresh()">🔄 Авто-обновление</button>
<button onclick="stopAutoRefresh()">⏹️ Стоп</button>
<button onclick="injectDebugScript()">💉 Внедрить JS отладку</button>
</div>
<div id="status" class="status info">
Готов к мониторингу. Нажмите кнопки выше для загрузки логов.
</div>
<div class="log-section">
<h3>📄 Серверный лог (debug_upload_server.log)</h3>
<div id="serverLog" class="log-content">Лог не загружен</div>
</div>
<div class="log-section">
<h3>🐛 Debug лог (debug.log)</h3>
<div id="debugLog" class="log-content">Лог не загружен</div>
</div>
<div class="log-section">
<h3>☁️ S3 лог (s3_storage.log)</h3>
<div id="s3Log" class="log-content">Лог не загружен</div>
</div>
<div class="log-section">
<h3>🌐 Консоль браузера</h3>
<div id="browserLog" class="log-content">
Откройте консоль разработчика (F12) для просмотра клиентских логов.
<br><br>
<strong>Доступные команды:</strong><br>
<span class="highlight">debugUpload.logCurrentForms()</span> - показать все формы<br>
<span class="highlight">debugUpload.logFileInputs()</span> - показать файловые поля<br>
<span class="highlight">debugUpload.testUpload()</span> - тестовая загрузка<br>
</div>
</div>
</div>
<script>
let autoRefreshInterval = null;
function updateStatus(message, type = 'info') {
const status = document.getElementById('status');
status.textContent = new Date().toLocaleTimeString() + ': ' + message;
status.className = 'status ' + type;
}
function loadLog(endpoint, elementId, logName) {
updateStatus('Загружаем ' + logName + '...', 'info');
fetch(endpoint)
.then(response => response.text())
.then(data => {
document.getElementById(elementId).innerHTML = '<pre>' + escapeHtml(data) + '</pre>';
updateStatus(logName + ' загружен (' + data.length + ' символов)', 'success');
})
.catch(error => {
document.getElementById(elementId).innerHTML = '<pre style="color: #ff6b6b;">Ошибка загрузки: ' + error + '</pre>';
updateStatus('Ошибка загрузки ' + logName, 'error');
});
}
function loadServerLog() {
loadLog('debug_upload_log_viewer.php?log=server', 'serverLog', 'серверного лога');
}
function loadDebugLog() {
loadLog('debug_upload_log_viewer.php?log=debug', 'debugLog', 'debug лога');
}
function loadS3Log() {
loadLog('debug_upload_log_viewer.php?log=s3', 's3Log', 'S3 лога');
}
function clearLogs() {
document.getElementById('serverLog').innerHTML = 'Очищено';
document.getElementById('debugLog').innerHTML = 'Очищено';
document.getElementById('s3Log').innerHTML = 'Очищено';
updateStatus('Логи очищены', 'info');
}
function startAutoRefresh() {
if (autoRefreshInterval) {
clearInterval(autoRefreshInterval);
}
autoRefreshInterval = setInterval(() => {
loadServerLog();
loadDebugLog();
loadS3Log();
}, 3000);
updateStatus('Авто-обновление запущено (каждые 3 сек)', 'success');
}
function stopAutoRefresh() {
if (autoRefreshInterval) {
clearInterval(autoRefreshInterval);
autoRefreshInterval = null;
updateStatus('Авто-обновление остановлено', 'info');
}
}
function injectDebugScript() {
// Создаем новое окно с CRM
const crmWindow = window.open('/index.php', 'crm_debug', 'width=1200,height=800');
// Ждем загрузки и внедряем скрипт
setTimeout(() => {
try {
const script = crmWindow.document.createElement('script');
script.src = '/debug_upload_console.js';
crmWindow.document.head.appendChild(script);
updateStatus('JS отладка внедрена в окно CRM', 'success');
} catch (e) {
updateStatus('Ошибка внедрения JS: ' + e.message, 'error');
}
}, 2000);
}
function escapeHtml(text) {
const div = document.createElement('div');
div.textContent = text;
return div.innerHTML;
}
// Автоматически загружаем логи при открытии страницы
window.onload = function() {
updateStatus('Монитор загружен. Готов к работе!', 'success');
};
</script>
</body>
</html>