mirror of
https://github.com/QYG2297248353/IYUUPlus-Windows.git
synced 2025-12-29 08:01:35 +08:00
feat: 日志的查询与下载
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const { app, Menu, BrowserWindow } = require("electron")
|
||||
const path = require('node:path')
|
||||
const fs = require('fs')
|
||||
const server = require('../server/server');
|
||||
const mainWin = require('../windows/app');
|
||||
|
||||
@@ -72,6 +73,42 @@ let template = [
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "查看日志",
|
||||
click: () => {
|
||||
let win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
icon: iconPath,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, '..', 'preload.js'),
|
||||
contextIsolation: true,
|
||||
enableRemoteModule: false,
|
||||
nodeIntegration: false
|
||||
}
|
||||
});
|
||||
win.loadFile(path.join(__dirname, '..', 'logs.html'));
|
||||
win.on("closed", () => {
|
||||
win = null;
|
||||
});
|
||||
|
||||
const logsFile = path.join(app.getPath('appData'), 'iyuu-plus/logs/iyuu.log');
|
||||
fs.readFile(logsFile, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
console.error('Error reading log file:', err);
|
||||
return;
|
||||
}
|
||||
win.webContents.send('display-log', data);
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "下载日志",
|
||||
click: () => {
|
||||
const logsFile = path.join(app.getPath('appData'), 'iyuu-plus/logs/iyuu.log');
|
||||
mainWin.downloadLocalFile(logsFile);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "新疆萌森软件开发工作室提供技术支持",
|
||||
click: () => {
|
||||
|
||||
Reference in New Issue
Block a user