🐤 Sync 2026-09-29 08:28:44

This commit is contained in:
github-actions[bot] committed 2026-09-29 08:28:44 +08:00
1 parent 5fe727a4a8
commit a96317f317
99 files changed
+3036 -17584

No files matched your search

@@ -4,52 +4,6 @@
'require ui';
'require view';
function translateLogText(message) {
return (typeof _ === 'function') ? _(message) : message;
}
function formatLogLine(log) {
const logParts = String(log || '').split(' ').filter(Boolean);
const statusMappings = {
'daemon.err': { status: 'StdErr', startIndex: 6 },
'daemon.notice': { status: 'Info', startIndex: 6 },
'user.err': { status: 'StdErr', startIndex: 6 },
'user.notice': { status: 'Info', startIndex: 6 }
};
if (logParts.length < 6)
return log;
const formattedTime = logParts.slice(0, 4).join(' ');
const status = logParts[5];
const mapping = statusMappings[status] || { status: status, startIndex: 6 };
const message = logParts.slice(mapping.startIndex).join(' ');
return `${formattedTime} [ ${mapping.status} ] - ${message}`;
}
function formatLogLines(logdata) {
const text = String(logdata || '').trim();
if (!text)
return { value: translateLogText('Log is empty.'), rows: 2 };
const loglines = text.split(/\n/).map(formatLogLine).filter(Boolean);
return { value: loglines.join('\n'), rows: loglines.length + 1 };
}
function formatLogError(err) {
const message = String(
(err && (err.stderr || err.message || err.stdout)) || err || translateLogText('Unknown error')
).trim().replace(/\n+/g, ' ');
return {
value: translateLogText('Unable to load log data:') + ' ' + message,
rows: 2
};
}
return view.extend({
async retrieveLog() {
const stat = await Promise.all([
@@ -58,14 +12,26 @@ return view.extend({
]);
const logger = stat[0] ? stat[0].path : stat[1] ? stat[1].path : null;
if (!logger)
return formatLogError(translateLogText('logread command not found'));
try {
return formatLogLines(await fs.exec_direct(logger, ['-e', 'tailscale']));
} catch (err) {
return formatLogError(err);
}
const logdata = await fs.exec_direct(logger, ['-e', 'tailscale']);
const statusMappings = {
'daemon.err': { status: 'StdErr', startIndex: 9 },
'daemon.notice': { status: 'Info', startIndex: 10 }
};
const loglines = logdata.trim().split(/\n/).map(function(log) {
const logParts = log.split(' ').filter(Boolean);
if (logParts.length >= 6) {
const formattedTime = `${logParts[1]} ${logParts[2]} - ${logParts[3]}`;
const status = logParts[5];
const mapping = statusMappings[status] || { status: status, startIndex: 9 };
const newStatus = mapping.status;
const startIndex = mapping.startIndex;
const message = logParts.slice(startIndex).join(' ');
return `${formattedTime} [ ${newStatus} ] - ${message}`;
} else {
return 'Log is empty.';
}
}).filter(Boolean);
return { value: loglines.join('\n'), rows: loglines.length + 1 };
},
async pollLog() {