Release v116 with VPS router logs and reliable log delivery
Add per-router VPS log archives available offline, live delivery and last reported service state. Keep router logs in RAM with bounded rotation and deduplication. Align log pages and mobile statistics, and bump application and deployment tools to v116.
This commit is contained in:
1 parent
4ceb3d031a
commit
aa7970c98c
43 files changed
+1658
-121
No files matched your search
@@ -133,7 +133,7 @@ set_result() {
|
||||
RESULT_BODY="$2"
|
||||
RESULT_KIND="${3:-info}"
|
||||
if [ -r "$LOG_HELPER" ]; then
|
||||
printf '%s\n' "$RESULT_BODY" | sh "$LOG_HELPER" event "Панель: $RESULT_TITLE; результат=$RESULT_KIND" >/dev/null 2>&1 || true
|
||||
printf '%s\n' "$RESULT_BODY" | sh "$LOG_HELPER" event "Панель: $RESULT_TITLE; результат=$RESULT_KIND" "$RESULT_KIND" >/dev/null 2>&1 || true
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -145,6 +145,11 @@ logs_response() {
|
||||
printf 'Сборщик логов не установлен. Установи локальный фикс целиком.\n'
|
||||
return
|
||||
fi
|
||||
if ! sh "$LOG_HELPER" check >/dev/null 2>&1; then
|
||||
printf 'Status: 503 Service Unavailable\r\nContent-Type: text/plain; charset=utf-8\r\nCache-Control: no-store\r\n\r\n'
|
||||
printf 'Журнал недоступен: для логов требуется ОЗУ (tmpfs). Запись на Flash запрещена.\n'
|
||||
return
|
||||
fi
|
||||
if [ "$mode" = clear ]; then
|
||||
if [ "${REQUEST_METHOD:-GET}" != POST ]; then
|
||||
printf 'Status: 405 Method Not Allowed\r\nAllow: POST\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n'
|
||||
@@ -359,6 +364,10 @@ run_action() {
|
||||
if [ "$rc" != "0" ]; then
|
||||
set_result "$RESULT_TITLE" "$(cat "$output")" "bad"
|
||||
fi
|
||||
# Deliver the completed stop result without keeping a mobile HTTP request open.
|
||||
if [ "$action" = stop ]; then
|
||||
( "$AGENT" logs-sync ) </dev/null >/dev/null 2>&1 &
|
||||
fi
|
||||
rm -f "$output"
|
||||
}
|
||||
|
||||
@@ -474,7 +483,7 @@ render_page() {
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="owrt-remote-ui-version" content="$OWRT_REMOTE_UI_VERSION">
|
||||
<title>OpenWrt Remote Hub v115</title>
|
||||
<title>OpenWrt Remote Hub v116</title>
|
||||
<style>
|
||||
:root{color-scheme:dark;--bg:#07040f;--panel:rgba(19,14,32,.88);--text:#f7f2ff;--muted:#b9adc9;--line:rgba(169,126,255,.24);--blue:#7c3aed;--green:#22c55e;--red:#fb7185;--amber:#f59e0b;--teal:#a855f7;--grid:rgba(168,85,247,.16)}
|
||||
*{box-sizing:border-box}body{position:relative;min-height:100vh;margin:0;overflow-x:hidden;background-color:var(--bg);background-image:radial-gradient(circle at 12% 8%,rgba(168,85,247,.46),transparent 31%),radial-gradient(circle at 82% 12%,rgba(79,70,229,.38),transparent 30%),radial-gradient(circle at 50% 105%,rgba(236,72,153,.26),transparent 35%),linear-gradient(145deg,#07040f,#120a24 48%,#05030a),repeating-linear-gradient(0deg,transparent 0 30px,var(--grid) 31px),repeating-linear-gradient(90deg,transparent 0 30px,var(--grid) 31px);background-size:130% 130%,140% 140%,135% 135%,100% 100%,31px 31px,31px 31px;background-attachment:fixed;color:var(--text);font:14px/1.45 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;animation:bgFlow 22s ease-in-out infinite alternate}
|
||||
@@ -497,6 +506,7 @@ form{margin:0}.formgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr
|
||||
.wanPicker{border:1px solid var(--line);border-radius:8px;background:rgba(8,5,18,.72)}.wanPicker summary{display:flex;align-items:center;justify-content:center;gap:5px;min-height:40px;padding:10px 11px;cursor:pointer;list-style:none;font-weight:700}.wanPicker summary::-webkit-details-marker{display:none}.wanPicker summary::after{content:"▾";margin-left:auto;color:var(--muted)}.wanPicker[open] summary::after{content:"▴"}.wanPickerList{display:flex;flex-direction:column;gap:4px;max-height:240px;overflow:auto;padding:6px;border-top:1px solid var(--line)}.wanChoice{display:flex;align-items:center;gap:10px;min-height:40px;padding:8px;border-radius:6px;cursor:pointer;overflow-wrap:anywhere}.wanChoice:hover{background:rgba(255,255,255,.08)}.wanChoice input{width:18px;height:18px;min-width:18px;padding:0;margin:0;accent-color:var(--blue)}.wanPicked{margin-top:6px;font-size:12px;color:var(--muted);overflow-wrap:anywhere}
|
||||
.globalLogsPanel[hidden]{display:none}.globalLogsPanel{margin-top:16px}.globalLogsPanel .actions{justify-content:flex-start;margin:0 0 12px}.globalLogsText{margin:12px 0 0;max-height:55vh;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;font:12px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;background:rgba(8,5,18,.72);border:1px solid var(--line);border-radius:8px;padding:12px;min-height:150px}.globalLogsStatus{color:var(--muted);overflow-wrap:anywhere}.globalLogsToggle{cursor:pointer;font-family:inherit;border-color:rgba(34,197,94,.65);background:var(--green);color:#07120a;box-shadow:0 10px 22px rgba(34,197,94,.22)}
|
||||
.globalLogsNote{margin:0 0 12px;padding:10px 12px;border:1px solid rgba(245,158,11,.35);border-left:3px solid var(--amber);border-radius:8px;background:rgba(245,158,11,.10);color:#fde68a;font-size:12px;line-height:1.5;overflow-wrap:anywhere}
|
||||
.globalLogsLegend{display:flex;gap:8px 14px;flex-wrap:wrap;margin:0 0 12px;font-size:12px;font-weight:700}.globalLogLine{display:block}.globalLogOk{color:#86efac}.globalLogWarn{color:#fde68a}.globalLogError{color:#f87171}
|
||||
@media(max-width:820px){.grid,.formgrid,.metrics{grid-template-columns:1fr}.linkMetric{grid-column:span 1}.metricLine{align-items:center;justify-content:center}.miniGo{width:auto;justify-content:center;display:inline-flex}.hero{align-items:flex-start;flex-direction:column}.topActions{justify-content:flex-start;padding-top:0}.wrap{padding:14px}h1{font-size:24px}.appBanner{width:auto;max-width:100%;justify-content:center;min-height:36px;padding:8px 12px}.panelHead{align-items:stretch;flex-direction:column}.headActionForm .btn{width:100%}.actions .btn,.actions button{width:100%}}
|
||||
@media(max-width:820px){.brandPanel{grid-template-columns:repeat(2,minmax(0,1fr));width:100%}.brandPanel .appBanner{width:100%}}
|
||||
@media(max-width:820px){.hero{gap:10px}.hero .brand{width:100%;min-width:0}.hero .uiPill,.hero .appBanner{width:100%;min-width:0;min-height:44px}.hero .appBanner{line-height:1.2}.topActions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:8px}.vpnCard,.returnCard{width:100%;min-width:0}.returnCard{grid-column:1/-1}.backBtn{white-space:normal;text-align:center}}
|
||||
@@ -508,7 +518,7 @@ form{margin:0}.formgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr
|
||||
<div class="brand">
|
||||
<div class="brandPanel">
|
||||
<div class="titleRow">
|
||||
<h1 class="appBanner"><span>OpenWrt Remote Hub <span class="appBannerVersion">v115</span></span></h1>
|
||||
<h1 class="appBanner"><span>OpenWrt Remote Hub <span class="appBannerVersion">v116</span></span></h1>
|
||||
</div>
|
||||
<div class="links">
|
||||
<a class="uiPill" href="https://t.me/kzolotarev95" target="_blank" rel="noopener noreferrer">Telegram</a>
|
||||
@@ -532,7 +542,8 @@ form{margin:0}.formgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr
|
||||
|
||||
<section class="panel globalLogsPanel" id="globalLogsPanel" hidden>
|
||||
<div class="panelHead"><h2>Глобал логи</h2><button class="btn" id="globalLogsClose" type="button">Закрыть</button></div>
|
||||
<blockquote class="globalLogsNote">Действия панели, Heartbeat, WAN и ошибки Xray этого роутера. Журнал хранится в оперативной памяти, очищается после перезагрузки и каждые 24 часа. Максимум около 2 МБ. Ключи и пароли скрываются.</blockquote>
|
||||
<blockquote class="globalLogsNote">Действия панели, изменения связи с Hub и WAN, предупреждения и ошибки Xray. Одинаковые события не дублируются. Журнал хранится только в ОЗУ, очищается после перезагрузки и каждые 24 часа. Максимум около 2 МБ. Ключи и пароли скрываются.</blockquote>
|
||||
<div class="globalLogsLegend" aria-label="Цвета журнала"><span class="globalLogOk">● Успешно</span><span class="globalLogWarn">● Предупреждение</span><span class="globalLogError">● Ошибка</span></div>
|
||||
<div class="actions">
|
||||
<a class="btn" href="?key=$(h "$key")&action=logs_download">Скачать логи</a>
|
||||
<button class="btn" id="globalLogsLive" type="button">Запустить в реальном времени</button>
|
||||
@@ -656,6 +667,34 @@ EOF
|
||||
var output = document.getElementById('globalLogsText');
|
||||
var status = document.getElementById('globalLogsStatus');
|
||||
var timer = null, controller = null, generation = 0, running = false;
|
||||
var renderedText = null;
|
||||
function lineTone(line) {
|
||||
if (/^\[ERROR\]/.test(line)) return 'globalLogError';
|
||||
if (/^\[WARN\]/.test(line)) return 'globalLogWarn';
|
||||
if (/^\[OK\]/.test(line)) return 'globalLogOk';
|
||||
var message = line.replace(/^.*?owrt-remote(?:\[\d+\])?:\s*/, '');
|
||||
if (/core: Xray .* started/i.test(message)) return 'globalLogOk';
|
||||
if (/\[error\]|ошибка|не удалось|результат=bad|failed|cannot |could not |error:|syntax error|permission denied|network is unreachable|connection (refused|reset)|timed out|not permitted|no selected wan|wan has no|wan direct requires|already used by another rule|does not belong to remote|не применилось|dns failed|crash loop/i.test(message)) return 'globalLogError';
|
||||
if (/\[warn(?:ing)?\]|предупреждение|результат=warn|retry|not ready|missing|не найден|postponed|dns unavailable|fallback|reconnecting|restarting|failover/i.test(message)) return 'globalLogWarn';
|
||||
return 'globalLogOk';
|
||||
}
|
||||
function renderLogs(text, empty) {
|
||||
if (renderedText === text && output.querySelector('.globalLogLine')) return;
|
||||
var atBottom = output.scrollHeight - output.clientHeight - output.scrollTop < 24;
|
||||
var previousTop = output.scrollTop;
|
||||
var fragment = document.createDocumentFragment();
|
||||
var lines = text ? text.replace(/\r\n/g, '\n').replace(/\n$/, '').split('\n') : [empty];
|
||||
lines.forEach(function(line) {
|
||||
var row = document.createElement('span');
|
||||
row.className = 'globalLogLine ' + lineTone(line);
|
||||
row.textContent = line || ' ';
|
||||
fragment.appendChild(row);
|
||||
});
|
||||
output.textContent = '';
|
||||
output.appendChild(fragment);
|
||||
renderedText = text;
|
||||
output.scrollTop = atBottom ? output.scrollHeight : previousTop;
|
||||
}
|
||||
function endpoint(action) {
|
||||
var url = new URL(window.location.href);
|
||||
url.searchParams.set('action', action);
|
||||
@@ -684,12 +723,7 @@ EOF
|
||||
var text = await response.text();
|
||||
if (current !== generation || (!running && !once)) return;
|
||||
if ((response.headers.get('Content-Type') || '').indexOf('text/plain') !== 0) throw new Error('Доступ к журналу завершён. Открой панель заново.');
|
||||
var atBottom = output.scrollHeight - output.clientHeight - output.scrollTop < 24;
|
||||
var previousTop = output.scrollTop;
|
||||
if (output.textContent !== text) {
|
||||
output.textContent = text || (once ? 'Журнал пока пуст. Новые записи появятся после действий в панели или событий Remote. Нажми «Запустить в реальном времени», чтобы увидеть их.' : 'Журнал пуст. Новые события появятся автоматически.');
|
||||
output.scrollTop = atBottom ? output.scrollHeight : previousTop;
|
||||
}
|
||||
renderLogs(text, once ? 'Журнал пока пуст. Новые записи появятся после действий в панели или событий Remote. Нажми «Запустить в реальном времени», чтобы увидеть их.' : 'Журнал пуст. Новые события появятся автоматически.');
|
||||
status.textContent = (once ? 'Сохранённые записи' : 'Просмотр в реальном времени') + ' · обновлено ' + new Date().toLocaleTimeString() + ' · последние 64 КБ журнала' + (once ? '. Для автообновления нажми «Запустить в реальном времени».' : '');
|
||||
} catch (error) {
|
||||
if (current === generation && (running || once)) {
|
||||
|
||||
@@ -14,7 +14,7 @@ return view.extend({
|
||||
|
||||
if (!key) {
|
||||
return E('div', { 'class': 'cbi-map' }, [
|
||||
E('h2', {}, _('OpenWrt Remote Hub v115')),
|
||||
E('h2', {}, _('OpenWrt Remote Hub v116')),
|
||||
E('div', { 'class': 'alert-message warning' }, [
|
||||
_('Web key not found. Reinstall the module or create /etc/owrt-remote/web.key.')
|
||||
])
|
||||
@@ -34,7 +34,7 @@ return view.extend({
|
||||
}, 100);
|
||||
|
||||
return E('div', { 'class': 'cbi-map' }, [
|
||||
E('h2', {}, _('OpenWrt Remote Hub v115')),
|
||||
E('h2', {}, _('OpenWrt Remote Hub v116')),
|
||||
E('p', {}, _('Opening remote access panel...')),
|
||||
E('p', {}, [
|
||||
E('a', { 'class': 'btn cbi-button cbi-button-apply', 'href': url }, _('Open panel'))
|
||||
|
||||
Reference in new issue
Block a user