diff --git a/app/js/platform/end.js b/app/js/platform/end.js index 765abec7..2aace0b9 100644 --- a/app/js/platform/end.js +++ b/app/js/platform/end.js @@ -184,6 +184,10 @@ onmessage = function (e) { asRead() } else if (e.data[0] == "asReadEnd") { asReadEnd() + } else if (e.data[0] == "logData") { + $("#logs").val(e.data[1]) + var obj = document.getElementById("logs"); + obj.scrollTop = obj.scrollHeight; } else if (e.data[0] == "alert") { Swal.fire({ type: 'info', diff --git a/app/js/platform/preload.js b/app/js/platform/preload.js index 367bf6eb..555b51c0 100644 --- a/app/js/platform/preload.js +++ b/app/js/platform/preload.js @@ -169,6 +169,10 @@ ipc.on("memory", function(event, arg) { var total = arg[2]; postMessage(["renderMem", [use, cpu, total]], "*"); }); +//log +ipc.on("logData", function(event, args) { + postMessage(["logData", args], "*"); +}); //update.html ipc.on("prog", function(event, arg) { postMessage(["updateProg", arg], "*"); diff --git a/app/js/ui/menu.js b/app/js/ui/menu.js index 258ea616..e907d5b0 100644 --- a/app/js/ui/menu.js +++ b/app/js/ui/menu.js @@ -69,5 +69,9 @@ $(function () { }); }); function help() { - postMessage(["openUrl", "https://docs.thedesk.top"], "*") + $("#left-menu div").removeClass("active"); + $("#helpMenu").addClass("active"); + $(".menu-content").addClass("hide"); + $("#help-box").removeClass("hide"); + postMessage(["sendSinmpleIpc", "getLogs"], "*") } \ No newline at end of file diff --git a/app/main/system.js b/app/main/system.js index 7136f938..afe3c777 100644 --- a/app/main/system.js +++ b/app/main/system.js @@ -12,6 +12,17 @@ function system(mainWindow, dir, lang, dirname) { var ua_path = join(app.getPath("userData"), "useragent"); var lang_path = join(app.getPath("userData"), "language"); var log_dir_path = join(app.getPath("userData"), "logs"); + //ログ + var today = new Date(); + //今日のやつ + var todayStr = today.getFullYear() + "" + (today.getMonth() + 1) + "" + today.getDate() + ".log"; + //昨日のやつ + today.setDate(today.getDate() - 1); + var yestStr = today.getFullYear() + "" + (today.getMonth() + 1) + "" + today.getDate() + ".log"; + //一昨日のやつ + today.setDate(today.getDate() - 1); + var yest2Str = today.getFullYear() + "" + (today.getMonth() + 1) + "" + today.getDate() + ".log"; + const BrowserWindow = electron.BrowserWindow; const dialog = electron.dialog; const os = require("os"); @@ -243,17 +254,20 @@ function system(mainWindow, dir, lang, dirname) { } }); }); + ipc.on("getLogs", (e, arg) => { + var logs="" + fs.readdir(log_dir_path, function(err, files) { + if (err) throw err; + files.filter(function(file) { + if (file == todayStr || file == yestStr || file == yest2Str) { + logs=logs+fs.readFileSync(join(log_dir_path, file), "utf8") + } + }); + e.sender.webContents.send("logData", logs); + }); + }); //起動時ログディレクトリ存在確認と作成、古ログ削除 fs.access(log_dir_path, fs.constants.R_OK | fs.constants.W_OK, error => { - var today = new Date(); - //今日のやつ - var todayStr = today.getFullYear() + "" + (today.getMonth() + 1) + "" + today.getDate() + ".log"; - //昨日のやつ - today.setDate(today.getDate() - 1); - var yestStr = today.getFullYear() + "" + (today.getMonth() + 1) + "" + today.getDate() + ".log"; - //一昨日のやつ - today.setDate(today.getDate() - 1); - var yest2Str = today.getFullYear() + "" + (today.getMonth() + 1) + "" + today.getDate() + ".log"; if (error) { if (error.code === "ENOENT") { fs.mkdirSync(log_dir_path); @@ -265,7 +279,6 @@ function system(mainWindow, dir, lang, dirname) { if (err) throw err; files.filter(function(file) { if (file != todayStr && file != yestStr && file != yest2Str) { - console.log(file, todayStr, yest2Str, yest2Str); fs.unlinkSync(join(log_dir_path, file)); } }); diff --git a/app/view/make/index.sample.html b/app/view/make/index.sample.html index eb451e46..4e9e401b 100644 --- a/app/view/make/index.sample.html +++ b/app/view/make/index.sample.html @@ -842,8 +842,8 @@ class="material-icons">recent_actors@@directory@@
filter_list@@filter@@
-
help_outline@@help@@
+
help_outline@@helpAndLogs@@
refresh@@f5@@
@@ -1042,6 +1042,12 @@ id="add-filter-btn">@@add@@
@@warnOnIntegratedTL@@ + + diff --git a/app/view/make/language/en/index.json b/app/view/make/language/en/index.json index 207f4d06..c87dd495 100644 --- a/app/view/make/language/en/index.json +++ b/app/view/make/language/en/index.json @@ -162,7 +162,9 @@ "clockTips":"Clock", "ramTips":"RAM status", "changeTips":"Change Tips", + "helpAndLogs":"Help & Log", "help":"Help", + "contactwithlog":"If you tell me bugs(not working or something) with this log, I can detect what is wrong more easily.", "about":"About TheDesk", "hereAddColumns":"<- Add TL", "show": "Show", diff --git a/app/view/make/language/ja/index.json b/app/view/make/language/ja/index.json index b1ac9533..c7c1d8c1 100644 --- a/app/view/make/language/ja/index.json +++ b/app/view/make/language/ja/index.json @@ -162,7 +162,9 @@ "clockTips":"時計", "ramTips":"システムメモリ容量", "changeTips":"Tips変更", + "helpAndLogs":"ヘルプとログ", "help":"ヘルプ", + "contactwithlog":"不具合等のお問合わせは以下のログから発生時刻付近のものを集めてご連絡いただけるとスムーズになるかもしれません。また、このメニューウィンドウ全体を横に引き伸ばすとログが見やすくなります。", "about":"このソフトについて", "hereAddColumns":"←ここからTL追加", "show": "表示",