From 66f7f495ce8f667df73e3c86b36eb318b6ebe047 Mon Sep 17 00:00:00 2001 From: btjawa <2407356083@qq.com> Date: Wed, 4 Oct 2023 17:26:41 +0800 Subject: [PATCH] =?UTF-8?q?fix.=20=E4=BC=98=E5=8C=96Java/GateServer?= =?UTF-8?q?=E9=80=BB=E8=BE=91=20&=20refactor.=20=E9=87=8D=E6=9E=84css?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/css/style.css | 1010 +++++++++------------------------------ dist/js/ipc.renderer.js | 141 ++++-- main.js | 113 ++--- package-lock.json | 88 +--- 4 files changed, 345 insertions(+), 1007 deletions(-) diff --git a/dist/css/style.css b/dist/css/style.css index c42ce22..e196ec1 100644 --- a/dist/css/style.css +++ b/dist/css/style.css @@ -31,7 +31,7 @@ body { } input[type="text"] { - font-family: "SourceHanSans&SairaHybrid-Regular",Arial, sans-serif; + font-family: "SourceHanSans&SairaHybrid-Regular", Arial, sans-serif; height: 25px; border-radius: 5px; border: 2px solid #404040; @@ -39,132 +39,64 @@ input[type="text"] { color: #dbdbdb; } -input[name="game_path"]{ - position: relative; - font-size: 17px; - top: 5px; - width: 100%; -} - -input[name="gc_ip"]{ - font-family: "SourceHanSans&SairaHybrid-Regular"; +input[name="gc_ip"], +input[name="gc_game_port"], +input[name="gc_dispatch_port"], +input[name="proxy_ip"], +input[name="proxy_port"], +input[name="mongo_port"], +input[name="mongo_data_folder"], +input[name="game_path"], +input[name="java_path"], +input[name="3dmigoto_path"] { font-size: 17px; margin-top: 5px; - width: 120px; - color: #e5e5e5; - vertical-align: center; } -input[name="gc_game_port"]{ +input[name="gc_ip"], +input[name="gc_game_port"], +input[name="gc_dispatch_port"], +input[name="proxy_ip"], +input[name="proxy_port"] { font-family: "SourceHanSans&SairaHybrid-Regular"; - font-size: 17px; - margin-left: 5px; - margin-top: 5px; width: 120px; color: #e5e5e5; vertical-align: center; } -input[name="gc_dispatch_port"]{ - font-family: "SourceHanSans&SairaHybrid-Regular"; - font-size: 17px; - margin-left: 5px; - margin-top: 5px; - width: 120px; - color: #e5e5e5; - vertical-align: center; -} - -input[name="mongo_port"]{ - font-family: "SourceHanSans&SairaHybrid-Regular"; - font-size: 17px; - left: 0px; - margin-top: 5px; - width: 120px; - color: #a8a5a5; - vertical-align: center; -} - -input[name="mongo_data_folder"]{ - font-family: "SourceHanSans&SairaHybrid-Regular"; - font-size: 17px; - margin-left: 6px; - margin-top: 5px; +input[name="mongo_port"], +input[name="mongo_data_folder"] { width: 120px; color: #a8a5a5; vertical-align: center; } -input[name="proxy_ip"]{ - font-family: "SourceHanSans&SairaHybrid-Regular"; - position: relative; - font-size: 17px; - margin-top: 5px; - width: 120px; - color: #e5e5e5; - vertical-align: center; -} - -input[name="proxy_port"]{ - font-family: "SourceHanSans&SairaHybrid-Regular"; - position: relative; - font-size: 17px; - margin-left: 6px; - margin-top: 5px; - width: 120px; - color: #e5e5e5; - vertical-align: center; -} - -input[name="java_path"]{ - font-size: 17px; - margin-top: 5px; - width: 100%; -} - -input[name="3dmigoto_path"]{ - font-size: 17px; - margin-top: 5px; +input[name="game_path"], +input[name="java_path"], +input[name="3dmigoto_path"] { width: 100%; } -button[name="res_getway_0"] { +input[name="game_path"], +input[name="proxy_ip"], +input[name="proxy_port"] { position: relative; - top: 10px; - right: 117px; - vertical-align: middle; } -button[name="res_getway_1"] { - position: relative; - top: 10px; - right: 117px; - vertical-align: middle; -} - -button[name="clear_data"] { - position: fixed; - bottom: 10px; - color: #c4c4c4; - font-size: 13px; - right: 310px; - cursor: pointer; - vertical-align: middle; -} - -button[name="update"] { - position: relative; - top: 37px; - right: 200px; - vertical-align: middle; +input[name="mongo_data_folder"], +input[name="proxy_port"] { + margin-left: 6px; } -.res_getway_0.active { - animation: res_getway_anime 0.66s cubic-bezier(0,1,.6,1), fadeIn 0.5s cubic-bezier(0,1,.6,1); +input[name="gc_game_port"], +input[name="gc_dispatch_port"], +input[name="mongo_data_folder"] { + margin-left: 5px; } +.res_getway_0.active, .res_getway_1.active { - animation: res_getway_anime 0.66s cubic-bezier(0,1,.6,1), fadeIn 0.5s cubic-bezier(0,1,.6,1); + animation: page_0_text_1_active_res_getway_anime 0.66s cubic-bezier(0,1,.6,1), fadeIn 0.5s cubic-bezier(0,1,.6,1); } .update.active { animation: update_anime 0.66s cubic-bezier(0,1,.6,1), fadeIn 0.5s cubic-bezier(0,1,.6,1); @@ -182,18 +114,56 @@ button { cursor: pointer; } +button:hover { + transition: background-color 0.1s ease-in-out, border 0.1s ease-in-out; + background-color: #6e6e6e; +} + button[name="res_getway_1"], button[name="update"], button[name="open_log_dir"], -button[name="edit_config"] { +button[name="edit_config"], +button[name="res_getway_0"] { margin-left: 0px; } +button[name=choose_3dmigoto_path].disabled, +button[name="self-signed-keystore"].disabled, +button[name="official-keystore"].disabled, +button[name="compass_btn"] { + background-color: #80808860; + color: #e4e4e456; +} + button[name="compass_btn"] { height: 25.2px; align-self: center; } +button[name="res_getway_0"], +button[name="res_getway_1"], +button[name="update"] { + position: relative; + top: 10px; + right: 117px; + vertical-align: middle; +} + +button[name="update"] { + top: 37px; + right: 200px; +} + +button[name="clear_data"] { + position: fixed; + bottom: 10px; + color: #c4c4c4; + font-size: 13px; + right: 310px; + cursor: pointer; + vertical-align: middle; +} + .iconfont { font-family: "iconfont" !important; font-style: normal; @@ -218,73 +188,44 @@ button[name="compass_btn"] { z-index: 1000; } -#dragbar_close { +#dragbar_close, +#dragbar_window, +#dragbar_maximize, +#dragbar_min, +#dragbar_question { -webkit-app-region: no-drag; color: #c4c4c4; position: absolute; top: 15px; - right: 0px; transform: translateY(-50%); padding: 7.5px 15px; } +#dragbar_close { + right: 0px; +} + #dragbar_close:hover { background-color: #e81123; } #dragbar_window { - -webkit-app-region: no-drag; - color: #c4c4c4; - position: absolute; - top: 15px; right: 44.5px; - transform: translateY(calc(-50%)); display: none; - padding: 7.5px 15px; -} - -#dragbar_window:hover { - background-color: #4a4a4d; } #dragbar_maximize { - -webkit-app-region: no-drag; - color: #c4c4c4; - position: absolute; - top: 15px; right: 44.5px; - transform: translateY(-50%); display: block; - padding: 7.5px 15px; -} - -#dragbar_maximize:hover { - background-color: #4a4a4d; } #dragbar_min { - -webkit-app-region: no-drag; - color: #c4c4c4; - position: absolute; - top: 15px; right: 88px; - transform: translateY(-50%); - padding: 7.5px 15px; } -#dragbar_min:hover { - background-color: #4a4a4d; -} - #dragbar_question { - -webkit-app-region: no-drag; - color: #c4c4c4; - position: absolute; - top: 15px; right: 136px; - transform: translateY(-50%); font-size: 14px; - padding: 7.5px 15px; font-style: normal; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -292,266 +233,101 @@ button[name="compass_btn"] { border: 1px solid transparent; } +#dragbar_window:hover, +#dragbar_maximize:hover, +#dragbar_min:hover, #dragbar_question:hover { background-color: #4a4a4d; -} +} -.title_img { +.title_img, .title_text, .title_text_version { position: absolute; - border-radius: 5px; top: 50%; transform: translateY(-50%); + user-select: none; +} + +.title_img { + border-radius: 5px; left: 8px; width: 25px; - user-select: none; -webkit-user-drag: none; } .title_text { - transform: rotate(0deg); color: #c4c4c4; - position: absolute; - top: 50%; left: 41px; - transform: translateY(-50%); font-size: 14px; - user-select: none; } -.title_text_version{ +.title_text_version { color: #716f6f; - top: 50%; - transform: translateY(-50%); font-size: 12px; - position: absolute; left: 140px; - user-select: none; } .menu_background { width: 88px; height: calc(100vh - 50px); position: fixed; - left: 0px; + left: 0; top: 50px; background-color: #2c2e34; transform-origin: center; } -.menu_selector_0 { - position: fixed; - top: 85px; - left: 10px; - display: block; -} - -.menu_selector_0_background { +.menu_selector_0_background, +.menu_selector_1_background, +.menu_selector_2_background, +.menu_selector_log_background, +.menu_selector_settings_background { width: 72.5px; height: 72.5px; border-radius: 5px; - position: fixed; - left: 7px; - top: 62px; transform-origin: center; transition: background-color 0.1s ease-in-out, border 0.1s ease-in-out; } -.menu_selector_0_background.active { - background-color: #525252; -} - -.menu_selector_0:hover .menu_selector_0_background{ - background-color: #424242; -} - -.menu_selector_0:hover { - cursor: pointer; -} - -.menu_underline_0 { - width: 4px; - height: 25px; - border-radius: 5px; - position: absolute; - left: 0px; - top: 0px; - background-color: #41a5d9; - transform-origin: center; - display: none; -} - -.menu_underline_0.active { - animation: menu_underline_anime_0 0.3s cubic-bezier(.17,.67,.6,1); - display: block; -} - -@keyframes menu_underline_anime_0 { - 0% { - transform: scaleY(0.4); - } - 100% { - transform: scaleY(1); - } -} - -#menu_selector_0_icon { - - position: absolute; - color: #c4c4c4; - font-size: 22px; - left: 20px; - top: -5px; -} - -.menu_selector_0_text { - position: relative; - color: #c4c4c4; - font-size: 12px; - left: 19px; - top: 23px; - vertical-align: center; - letter-spacing: 1px; - user-select: none; - -webkit-user-drag: none; -} - -.menu_selector_1 { - -webkit-user-drag: none; - position: fixed; - top: 162px; - left: 10px; - display: block; - -} - -.menu_selector_1_background { - width: 72.5px; - height: 72.5px; - border-radius: 5px; +.menu_selector_0_background, +.menu_selector_1_background, +.menu_selector_2_background { position: fixed; left: 7px; - top: 139px; - transform-origin: center; - transition: background-color 0.1s ease-in-out, border 0.1s ease-in-out; -} - -.menu_selector_1_background.active { - background-color: #525252; -} - -.menu_selector_1:hover .menu_selector_1_background{ - background-color: #424242; -} - -.menu_selector_1:hover{ - cursor: pointer; -} - -.menu_underline_1 { - width: 4px; - height: 25px; - border-radius: 5px; - position: absolute; - left: 0px; - top: 0px; - background-color: #41a5d9; - transform-origin: center; - display: none; -} - -.menu_underline_1.active { - animation: menu_underline_anime_1 0.3s cubic-bezier(.17,.67,.6,1); - display: block; -} - -@keyframes menu_underline_anime_1 { - 0% { - transform: scaleY(0.4); - } - 100% { - transform: scaleY(1); - } } -#menu_selector_1_icon { +.menu_selector_log_background, +.menu_selector_settings_background { position: absolute; - color: #c4c4c4; - font-size: 22px; - left: 20px; - top: -5px; + left: -3px; + top: -22.5px; } -.menu_selector_1_text { - position: relative; - color: #c4c4c4; - font-size: 12px; - left: 4px; - top: 23px; - vertical-align: center; - letter-spacing: 1px; - user-select: none; - -webkit-user-drag: none; -} +.menu_selector_0_background { top: 62px; } +.menu_selector_1_background { top: 139px; } +.menu_selector_2_background { top: 216px; } -.menu_selector_2 { +.menu_selector_0, +.menu_selector_1, +.menu_selector_2, +.menu_selector_settings, +.menu_selector_log { -webkit-user-drag: none; position: fixed; - top: 239px; left: 10px; display: block; - -} - -.menu_selector_2_background { - width: 72.5px; - height: 72.5px; - border-radius: 5px; - position: fixed; - left: 7px; - top: 216px; - transform-origin: center; - transition: background-color 0.1s ease-in-out, border 0.1s ease-in-out; -} - -.menu_selector_2_background.active { - background-color: #525252; -} - -.menu_selector_2:hover .menu_selector_2_background{ - background-color: #424242; -} - -.menu_selector_2:hover{ - cursor: pointer; -} - -.menu_underline_2 { - width: 4px; - height: 25px; - border-radius: 5px; - position: absolute; - left: 0px; - top: 0px; - background-color: #41a5d9; - transform-origin: center; - display: none; -} - -.menu_underline_2.active { - animation: menu_underline_anime_1 0.3s cubic-bezier(.17,.67,.6,1); - display: block; } -@keyframes menu_underline_anime_2 { - 0% { - transform: scaleY(0.4); - } - 100% { - transform: scaleY(1); - } -} +.menu_selector_0 { top: 85px; } +.menu_selector_1 { top: 162px; } +.menu_selector_2 { top: 239px; } +.menu_selector_settings { bottom: 40px; } +.menu_selector_log { bottom: 117px; } -#menu_selector_2_icon { +#menu_selector_0_icon, +#menu_selector_1_icon, +#menu_selector_2_icon, +#menu_selector_log_icon, +#menu_selector_settings_icon { position: absolute; color: #c4c4c4; font-size: 22px; @@ -559,7 +335,11 @@ button[name="compass_btn"] { top: -5px; } -.menu_selector_2_text { +.menu_selector_0_text, +.menu_selector_1_text, +.menu_selector_2_text, +.menu_selector_log_text, +.menu_selector_settings_text { position: relative; color: #c4c4c4; font-size: 12px; @@ -571,37 +351,38 @@ button[name="compass_btn"] { -webkit-user-drag: none; } - -.menu_selector_settings { - position: fixed; - bottom: 40px; - left: 10px; - display: block; -} - -.menu_selector_settings_background { - width: 72.5px; - height: 72.5px; - border-radius: 5px; - position: absolute; - left: -3px; - top: -22.5px; - transform-origin: center; - transition: background-color 0.1s ease-in-out, border 0.1s ease-in-out; +.menu_selector_1_text { + left: 4px; } +.menu_selector_0_background.active, +.menu_selector_1_background.active, +.menu_selector_2_background.active, +.menu_selector_log_background.active, .menu_selector_settings_background.active { background-color: #525252; } -.menu_selector_settings:hover .menu_selector_settings_background{ +.menu_selector_0:hover .menu_selector_0_background, +.menu_selector_1:hover .menu_selector_1_background, +.menu_selector_2:hover .menu_selector_2_background, +.menu_selector_log:hover .menu_selector_log_background, +.menu_selector_settings:hover .menu_selector_settings_background { background-color: #424242; } +.menu_selector_0:hover, +.menu_selector_1:hover, +.menu_selector_2:hover, +.menu_selector_log:hover, .menu_selector_settings:hover { cursor: pointer; } +.menu_underline_0, +.menu_underline_1, +.menu_underline_2, +.menu_underline_log, .menu_underline_settings { width: 4px; height: 25px; @@ -614,12 +395,16 @@ button[name="compass_btn"] { display: none; } +.menu_underline_0.active, +.menu_underline_1.active, +.menu_underline_2.active, +.menu_underline_log.active, .menu_underline_settings.active { - animation: menu_underline_anime_0 0.3s cubic-bezier(.17,.67,.6,1); + animation: menu_underline_anime 0.3s cubic-bezier(.17,.67,.6,1); display: block; } -@keyframes menu_underline_anime_0 { +@keyframes menu_underline_anime { 0% { transform: scaleY(0.4); } @@ -628,105 +413,10 @@ button[name="compass_btn"] { } } -#menu_selector_settings_icon { - - position: absolute; - color: #c4c4c4; - font-size: 22px; - left: 20px; - top: -5px; -} - -.menu_selector_settings_text { - position: relative; - color: #c4c4c4; - font-size: 12px; - left: 19px; - top: 23px; - vertical-align: center; - letter-spacing: 1px; - user-select: none; - -webkit-user-drag: none; -} - -.menu_selector_log { - position: fixed; - bottom: 117px; - left: 10px; - display: block; -} - -.menu_selector_log_background { - width: 72.5px; - height: 72.5px; - border-radius: 5px; - position: absolute; - left: -3px; - top: -22.5px; - transform-origin: center; - transition: background-color 0.1s ease-in-out, border 0.1s ease-in-out; -} - -.menu_selector_log_background.active { - background-color: #525252; -} - -.menu_selector_log:hover .menu_selector_log_background{ - background-color: #424242; -} - -.menu_selector_log:hover { - cursor: pointer; -} - -.menu_underline_log { - width: 4px; - height: 25px; - border-radius: 5px; - position: absolute; - left: 0px; - top: 0px; - background-color: #41a5d9; - transform-origin: center; - display: none; -} - -.menu_underline_log.active { - animation: menu_underline_anime_0 0.3s cubic-bezier(.17,.67,.6,1); - display: block; -} - -@keyframes menu_underline_anime_0 { - 0% { - transform: scaleY(0.4); - } - 100% { - transform: scaleY(1); - } -} - -#menu_selector_log_icon { - - position: absolute; +.page_0, .page_1, +.page_2, .page_log, +.page_settings { color: #c4c4c4; - font-size: 22px; - left: 20px; - top: -5px; -} - -.menu_selector_log_text { - position: relative; - color: #c4c4c4; - font-size: 12px; - left: 19px; - top: 23px; - vertical-align: center; - letter-spacing: 1px; - user-select: none; - -webkit-user-drag: none; -} - -.page_0 { position: relative; width: max-content; top: 60px; @@ -744,11 +434,6 @@ button[name="compass_btn"] { transform-origin: center; } -.page_0.active { - display: block; - animation: page_active_anime 0.66s cubic-bezier(0,1,.6,1), fadeIn 0.5s cubic-bezier(0,1,.6,1); -} - @keyframes page_active_anime { 0% { top: 43px; @@ -758,16 +443,7 @@ button[name="compass_btn"] { } } -@keyframes page_0_text_1_active_anime { - 0% { - top: -7px; - } - 100% { - top: 10px; - } -} - -@keyframes res_getway_anime { +@keyframes page_0_text_1_active_res_getway_anime { 0% { top: -7px; } @@ -786,7 +462,6 @@ button[name="compass_btn"] { } .page_title { - color: #e5e5e5; font-size: 22px; } @@ -803,7 +478,6 @@ button[name="compass_btn"] { } .page_0_right_banner_text { - color: #c4c4c4; position: fixed; top: 80px; right: 12px; @@ -811,7 +485,6 @@ button[name="compass_btn"] { } .update_progress { - color: #c4c4c4; position: relative; top: 110px; left: 20px; @@ -826,7 +499,6 @@ button[name="compass_btn"] { position: fixed; left: 510px; top: 150px; - color: #c4c4c4; } .patch_state.active { @@ -842,28 +514,22 @@ button[name="compass_btn"] { } } -.page_0_text_0 { - color: #c4c4c4; -} - .page_0_text_1 { position: relative; right: 120px; top: 10px; - color: #c4c4c4; - animation: page_0_text_1_active_anime 0.66s cubic-bezier(0,1,.6,1) + animation: page_0_text_1_active_res_getway_anime 0.66s cubic-bezier(0,1,.6,1) } .page_0_text_2 { justify-content: flex-start; margin-top: 10px; - color: #c4c4c4; } - -.page_0_text_2_sub_0, -.page_0_text_2_sub_1, -.page_0_text_2_sub_2 { - color: #c4c4c4; + +.page_0_text_2_sub_0, .page_0_text_2_sub_1, +.page_0_text_2_sub_2, .page_0_text_4_sub_0, +.page_0_text_4_sub_1, .page_0_text_5_sub_0, +.page_0_text_5_sub_1, .page_0_text_3_sub_0 { margin-top: 5px; } @@ -871,90 +537,57 @@ button[name="compass_btn"] { margin-right: 75px; } -.page_0_text_2_sub_1 { +.page_0_text_2_sub_1, +.page_0_text_4 { margin-right: 25px; } -.page_0_text_3 { - margin-top: 25px; - right: 20px; - color: #c4c4c4; +.page_0_text_3, +.page_0_text_4, +.page_0_text_5 { + margin-top: 20px; } .page_0_text_3_sub_0 { - margin-top: 5px; font-size: 12px; color: #999696; } -.page_0_text_4 { - margin-top: 20px; - left: 0px; - right: 20px; - color: #c4c4c4; -} - -.page_0_text_0, -.page_0_text_2_flex, -.page_0_text_3, -.page_0_text_4_flex, -.page_0_text_5_flex { +.page_0_text_0, .page_0_text_2_flex, +.page_0_text_3, .page_0_text_4_flex, +.page_0_text_5_flex, .operation_box_title, +.operation_box_btn_0, .operation_box_flex, +.page_settings_text_1_flex, .page_settings_text_2_flex, +.page_settings_text_3_flex, .page_tools_text_compass_flex { display: flex; } -.page_0_text_4_sub_0, -.page_0_text_4_sub_1 { - color: #c4c4c4; - margin-top: 5px; -} - .page_0_text_4_sub_0 { margin-right: 60px; } -.page_0_text_5 { - margin-top: 20px; - color: #c4c4c4; -} - -.page_0_text_5_sub_0, -.page_0_text_5_sub_1 { - color: #c4c4c4; - margin-top: 5px; -} - .page_0_text_5_sub_0 { margin-right: 80px; } -.page_0_version_title { - position: fixed; - bottom: 45px; - color: #c4c4c4; - font-size: 13px; - left: 100px; -} - -.gc_version { +.page_0_version_title, +.gc_version, +.res_version { position: fixed; - bottom: 25px; - color: #c4c4c4; font-size: 13px; left: 100px; - cursor: pointer; - text-decoration: underline + text-decoration: underline; } +.gc_version, .res_version { - position: fixed; - bottom: 5px; - color: #c4c4c4; - font-size: 13px; - left: 100px; cursor: pointer; - text-decoration: underline; } +.page_0_version_title { bottom: 45px; } +.gc_version { bottom: 25px; } +.res_version { bottom: 5px; } + .operation_box { width: 300px; height: 144px; @@ -967,16 +600,6 @@ button[name="compass_btn"] { border: 2px solid #353740d3; } -.operation_box.active { - display: block; -} - -.operation_box_title, -.operation_box_btn_0, -.operation_box_flex { - display: flex; -} - .operation_box_title { color: #ebebeb; font-size: 16px; @@ -984,32 +607,21 @@ button[name="compass_btn"] { justify-content: center; } -.operation_box_btn_0 { - -webkit-app-region: no-drag; - color: #ebebeb; - background-color: #828282; - justify-content: center; - align-items: center; - margin-left: 10px; - margin-top: 10px; - font-size: 13.5px; - padding: 7.5px 95px; - transition: background-color 0.1s ease-in-out, border 0.1s ease-in-out; - border: 2px solid #565656; - border-radius: 10px; - width: 83px; -} - -.operation_box_btn_0:hover { - cursor: pointer; +.operation_box_btn_0:hover, +.operation_box_btn_1:hover, +.operation_box_btn_2:hover, +.operation_box_btn_3:hover { background-color: #6e6e6e; + cursor: pointer; } -.operation_box_btn_0.disabled { - background-color: #555555; - color: #a0a0a0; +.operation_box_btn_0.disabled, +.operation_box_btn_3.disabled { + background-color: #80808860; + color: #e4e4e456; } +.operation_box_btn_0, .operation_box_btn_1, .operation_box_btn_2 { justify-content: center; @@ -1025,19 +637,17 @@ button[name="compass_btn"] { margin-top: 6px; } -.operation_box_btn_1 { +.operation_box_btn_0 { margin-left: 10px; - margin-right: 6px; -} - -.operation_box_btn_1:hover { - cursor: pointer; - background-color: #6e6e6e; + margin-top: 10px; + font-size: 13.5px; + padding: 7.5px 95px; + width: 83px; } -.operation_box_btn_2:hover { - cursor: pointer; - background-color: #6e6e6e; +.operation_box_btn_1 { + margin-left: 10px; + margin-right: 6px; } .operation_box_btn_3 { @@ -1054,31 +664,9 @@ button[name="compass_btn"] { border-radius: 10px; } -.operation_box_btn_3:hover { - cursor: pointer; - background-color: #6e6e6e; -} - -.page_1 { - position: relative; - width: max-content; - top: 60px; - left: 100px; - user-select: none; -} -.page_1.active { - display: block; - animation: page_active_anime 0.66s cubic-bezier(0,1,.6,1), fadeIn 0.5s cubic-bezier(0,1,.6,1); -} - -.page_2 { - position: relative; - width: max-content; - top: 60px; - left: 100px; - user-select: none; -} -.page_2.active { +.operation_box.active, .page_0.active, +.page_1.active, .page_2.active, +.page_settings.active, .page_log.active { display: block; animation: page_active_anime 0.66s cubic-bezier(0,1,.6,1), fadeIn 0.5s cubic-bezier(0,1,.6,1); } @@ -1114,7 +702,6 @@ button[name="compass_btn"] { #refresh_iframe:hover, #home_page_iframe:hover, #backward_page_iframe:hover { background-color: #3d3f47; - cursor: pointer; } #home_page_iframe { @@ -1122,33 +709,6 @@ button[name="compass_btn"] { padding-left: 13px; } -.page_settings { - position: relative; - width: max-content; - top: 60px; - left: 100px; - user-select: none; -} - -.page_settings.active { - display: block; - animation: page_active_anime 0.66s cubic-bezier(0,1,.6,1), fadeIn 0.5s cubic-bezier(0,1,.6,1); -} - -.page_log { - position: relative; - width: max-content; - top: 60px; - left: 100px; - user-select: none; - display: none; -} - -.page_log.active { - display: block; - animation: page_active_anime 0.66s cubic-bezier(0,1,.6,1), fadeIn 0.5s cubic-bezier(0,1,.6,1); -} - .page_log_console { position: relative; top: 1vh; @@ -1159,7 +719,6 @@ button[name="compass_btn"] { .page_log_text_0 { display:block; - color: #c4c4c4; position: relative; top: 6px; left: 6px; @@ -1169,7 +728,6 @@ button[name="compass_btn"] { .page_settings_text_1, .page_settings_text_2, .page_settings_text_3 { - color: #c4c4c4; margin-top: 10px; } @@ -1184,25 +742,17 @@ button[name="compass_btn"] { font-size: 14px; } -.page_settings_text_1_flex, -.page_settings_text_2_flex, -.page_settings_text_3_flex, -.page_tools_text_compass_flex { - display: flex; -} - .page_tools_text_0, .page_tools_text_1, .page_tools_text_2, +.page_tools_text_2_sub, .page_tools_text_compass { - color: #c4c4c4; margin-top: 10px; } .page_tools_text_2_sub { color: #999696; font-size: 14px; - margin-top: 10px; } .page_tools_mods_actions { @@ -1211,23 +761,7 @@ button[name="compass_btn"] { gap: 20px; } -.page_tools_mods_drag_area { - display: inline-block; - font-size: 14px; - padding: 7.5px 15px; - border: 2px dashed #828282; - border-radius: 8px; - margin-top: 10px; - margin-left: -5px; - color: #aeaeae; - cursor: pointer; - transition: background-color 0.1s; -} - -.page_tools_plugs_drag_area:hover { - background-color: #4b4f5e; -} - +.page_tools_mods_drag_area, .page_tools_plugs_drag_area { display: inline-block; font-size: 14px; @@ -1237,53 +771,25 @@ button[name="compass_btn"] { margin-top: 18px; margin-left: 5px; color: #aeaeae; - cursor: pointer; transition: background-color 0.1s; } -.page_tools_mods_drag_area:hover { - background-color: #4b4f5e; -} - -.page_tools_mods_list_item { - position: relative; - top: 7px; - color: #c4c4c4; - border-radius: 10px; - width: 100%; - padding: 12.5px; - background-color: #353740; - margin-right: 5px; - margin: 7px 0px; - font-size: 15px; -} - -.page_tools_mods_list_open_select { - position: absolute; - right: 47px; - top: 50%; - transform: translateY(-50%); - color: #c4c4c4; - border-radius: 8px; - width: 12px; - padding: 10px; - background-color: #686b80; - font-size: 12px; - z-index: 1000; - transition: background-color 0.1s ease-in-out, border 0.1s ease-in-out; -} - -.page_tools_mods_list_open_select:hover { - cursor: pointer; +.page_tools_plugs_drag_area:hover, +.page_tools_mods_drag_area:hover, +.page_tools_mods_list_open_select:hover, +.page_tools_mods_list_delete:hover, +.page_tools_plugs_list_open_select:hover, +.page_tools_plugs_list_delete:hover { background-color: #4b4f5e; } -.page_tools_mods_list_delete { +.page_tools_mods_list_open_select, +.page_tools_mods_list_delete, +.page_tools_plugs_list_open_select, +.page_tools_plugs_list_delete { position: absolute; - right: 10px; top: 50%; transform: translateY(-50%); - color: #c4c4c4; border-radius: 8px; width: 12px; padding: 10px; @@ -1293,26 +799,9 @@ button[name="compass_btn"] { transition: background-color 0.1s ease-in-out, border 0.1s ease-in-out; } -.page_tools_mods_list_delete:hover { - cursor: pointer; - background-color: #4b4f5e; -} - -.page_tools_mods_name { - font-size: 14px; -} - -.page_tools_mods_list_item { - color: #c4c4c4; - border-radius: 10px; - width: 100%; - padding: 12.5px; - background-color: #353740; - margin-right: 5px; - margin: 7px 0px; - font-size: 15px; - position: relative; -} +.page_tools_mods_list_open_select, .page_tools_plugs_list_open_select { right: 47px; } +.page_tools_mods_list_delete, .page_tools_plugs_list_delete { right: 10px; } +.page_tools_mods_name, .page_tools_plugs_name { font-size: 14px; } .page_tools_text_3, .page_tools_plugs_drag_area { @@ -1321,70 +810,14 @@ button[name="compass_btn"] { } .page_tools_text_3 { - color: #c4c4c4; margin-top: 20px; margin-right: 10px; } +.page_tools_mods_list_item, .page_tools_plugs_list_item { position: relative; top: 7px; - color: #c4c4c4; - border-radius: 10px; - width: 100%; - padding: 12.5px; - background-color: #353740; - margin-right: 5px; - margin: 7px 0px; - font-size: 15px; -} - -.page_tools_plugs_list_open_select { - position: absolute; - right: 47px; - top: 50%; - transform: translateY(-50%); - color: #c4c4c4; - border-radius: 8px; - width: 12px; - padding: 10px; - background-color: #686b80; - font-size: 12px; - z-index: 1000; - transition: background-color 0.1s ease-in-out, border 0.1s ease-in-out; -} - -.page_tools_plugs_list_open_select:hover { - cursor: pointer; - background-color: #4b4f5e; -} - -.page_tools_plugs_list_delete { - position: absolute; - right: 10px; - top: 50%; - transform: translateY(-50%); - color: #c4c4c4; - border-radius: 8px; - width: 12px; - padding: 10px; - background-color: #686b80; - font-size: 12px; - z-index: 1000; - transition: background-color 0.1s ease-in-out, border 0.1s ease-in-out; -} - -.page_tools_plugs_list_delete:hover { - cursor: pointer; - background-color: #4b4f5e; -} - -.page_tools_plugs_name { - font-size: 14px; -} - -.page_tools_mods_list_item { - color: #c4c4c4; border-radius: 10px; width: 100%; padding: 12.5px; @@ -1392,5 +825,4 @@ button[name="compass_btn"] { margin-right: 5px; margin: 7px 0px; font-size: 15px; - position: relative; } \ No newline at end of file diff --git a/dist/js/ipc.renderer.js b/dist/js/ipc.renderer.js index 9d51571..7a71f7f 100644 --- a/dist/js/ipc.renderer.js +++ b/dist/js/ipc.renderer.js @@ -167,9 +167,11 @@ elems.chooseJavaPathButton.on('click', () => { ipcRenderer.send('chooseJavaPathButton_open-file-dialog'); }); -elems.choose3DMigotoPathButton.on('click', () => { +function choose3DMigotoPathButton_ClickHandler() { ipcRenderer.send('choose3DMigotoPathButton_open-file-dialog'); -}); +} + +elems.choose3DMigotoPathButton.on('click', choose3DMigotoPathButton_ClickHandler); elems.openLogDirBtn.on('click', () => { ipcRenderer.send('openLogDirBtn_open-log-dir'); @@ -225,7 +227,7 @@ elems.resGetWayButton_1.on('click', () => { }); }); -elems.officialKeystoreButton.on('click', () => { +function officialKeystoreButton_ClickHandler() { ipcRenderer.send('officialKeystoreButton-set'); iziToast.info({ icon: 'fa-solid fa-circle-info', @@ -236,9 +238,11 @@ elems.officialKeystoreButton.on('click', () => { izi_notify() } }); -}); +} + +elems.officialKeystoreButton.on('click', officialKeystoreButton_ClickHandler); -elems.selfSignedKeystoreButton.on('click', () => { +function selfSignedKeystoreButton_ClickHandler() { ipcRenderer.send('selfSignedKeystoreButton-set'); iziToast.info({ icon: 'fa-solid fa-circle-info', @@ -249,28 +253,28 @@ elems.selfSignedKeystoreButton.on('click', () => { izi_notify() } }); -}); +} + +elems.selfSignedKeystoreButton.on('click', selfSignedKeystoreButton_ClickHandler); function operationBoxBtn_0_ClickHandler() { - elems.operationBoxBtn_0.on('click', () => { - save_settings(); - proxyInputRender = [elems.proxyIP.val(), elems.proxyPort.val()]; - ipcRenderer.send('operationBoxBtn_0-run-main-service', gcInputRender, proxyInputRender); - iziToast.info({ - icon: 'fa-solid fa-circle-info', - layout: '2', - title: '启动服务', - message: '正在启动服务...', - onOpening: function() { - izi_notify() - } - }); - elems.pageLogText0.append(`请不要关闭稍后弹出来的任何一个窗口!
正在启动服务...
`); - toggleMenuState('menu_selector_log'); + save_settings(); + proxyInputRender = [elems.proxyIP.val(), elems.proxyPort.val()]; + ipcRenderer.send('operationBoxBtn_0-run-main-service', gcInputRender, proxyInputRender); + iziToast.info({ + icon: 'fa-solid fa-circle-info', + layout: '2', + title: '启动服务', + message: '正在启动服务...', + onOpening: function() { + izi_notify() + } }); + elems.pageLogText0.append(`请不要关闭稍后弹出来的任何一个窗口!
正在启动服务...
`); + toggleMenuState('menu_selector_log'); } -operationBoxBtn_0_ClickHandler(); +elems.operationBoxBtn_0.on('click', operationBoxBtn_0_ClickHandler); elems.operationBoxBtn_1.on('click', () => { ipcRenderer.send('operationBoxBtn_1-stop-service'); @@ -280,9 +284,11 @@ elems.operationBoxBtn_2.on('click', () => { ipcRenderer.send('operationBoxBtn_2-run-game'); }); -elems.operationBoxBtn_3.on('click', () => { +function operationBoxBtn_3_ClickHandler() { ipcRenderer.send('operationBoxBtn_3-run-3dmigoto'); -}); +} + +elems.operationBoxBtn_3.on('click', operationBoxBtn_3_ClickHandler); elems.updateBtn.on('click', () => { iziToast.info({ @@ -592,11 +598,30 @@ ipcRenderer.on('openHandbookTXTBtn_not-found', (event) => { }) .on('download-jdk', (event, message) => { - elems.updateProgress.html = "下载进度将会显示在这里"; + elems.updateProgress.html("下载进度将会显示在这里"); if (message == "jdk-false") { - pageLogText0.append(`未检测到JDK!正在下载JDK...
`); + elems.pageLogText0.append(`未检测到JDK/JDK已损坏!正在下载JDK...
`); + iziToast.info({ + icon: 'fa-solid fa-circle-info', + layout: '2', + title: 'JDK', + message: '未检测到JDK!正在下载JDK...', + onOpening: function() { + izi_notify() + } + }); } else if (message == "jdk-true") { - pageLogText0.append(`JDK下载完毕!准备启动服务...
`); + elems.pageLogText0.append(`JDK下载完毕!准备启动服务...
`); + elems.updateProgress.html("下载进度将会显示在这里"); + iziToast.info({ + icon: 'fa-solid fa-circle-info', + layout: '2', + title: 'JDK', + message: 'JDK下载完毕!准备启动服务...', + onOpening: function() { + izi_notify() + } + }); } }) @@ -608,6 +633,19 @@ ipcRenderer.on('openHandbookTXTBtn_not-found', (event) => { elems.pageLogText0.append(`已检测到JRE,但未检测到JDK
`); }) +.on('operationBoxBtn_0-success', (event) => { + iziToast.info({ + icon: 'fa-solid fa-circle-info', + layout: '2', + title: '启动服务', + message: '成功启动服务!', + onOpening: function() { + izi_notify() + } + }); + elems.pageLogText0.append(`成功启动服务!
`); +}) + .on('operationBoxBtn_1-success', (event) => { iziToast.info({ icon: 'fa-solid fa-circle-info', @@ -647,25 +685,23 @@ ipcRenderer.on('openHandbookTXTBtn_not-found', (event) => { .on('update_progress', (event, progressText, action) => { const allMatches = progressText.match(/([0-9.]+[kMG]|[0-9:]+:[0-9:]+|--:--:--)/g); - const defaultText = "下载进度
正在向服务器请求..."; - - if (progressText.trim() === "0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0" || - progressText.includes("% Total % Received % Xferd Average Speed Time Time Time Current")) { - elems.updateProgress.html(defaultText); - } else if (allMatches && allMatches.length >= 4) { + if (progressText.trim() === "0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0" || progressText.includes("% Total % Received % Xferd Average Speed Time Time Time Current")) { + elems.updateProgress.html(`下载进度
正在向服务器请求...`); + }; + + if (allMatches && allMatches.length >= 4) { const received = allMatches[1]; const speed = allMatches[allMatches.length - 1]; const timeLeft = allMatches[allMatches.length - 2] === '--:--:--' ? '未知' : allMatches[allMatches.length - 2]; - elems.updateProgress.html(` - 下载进度
- 当前下载:${action}
- 已下载: ${received}
- 速度: ${speed}/s
- 剩余时间: ${timeLeft} - `); + elems.updateProgress.html(`下载进度
+ 当前下载:${action}
+ 已下载: ${received}
+ 速度: ${speed}/s
+ 剩余时间: ${timeLeft}`); + } -}) +}) .on('using_proxy', (event, proxyServer) => { iziToast.info({ @@ -681,7 +717,7 @@ ipcRenderer.on('openHandbookTXTBtn_not-found', (event) => { .on('update_complete', (event) => { - elems.updateProgress.html = "下载进度将会显示在这里"; + elems.updateProgress.html("下载进度将会显示在这里"); iziToast.info({ icon: 'fa-solid fa-circle-info', layout: '2', @@ -705,27 +741,30 @@ ipcRenderer.on('openHandbookTXTBtn_not-found', (event) => { }); }) -.on('gateserver_install', (event) => { +.on('gateserver_not-exists', (event) => { iziToast.info({ icon: 'fa-solid fa-circle-info', layout: '2', title: 'GateServer', - message: '开始下载GateServer...在此期间请勿运行服务', + message: 'GateServer不存在!请勿运行服务!
应用已进入沙盒模式...', onOpening: function() { izi_notify() } }); elems.operationBoxBtn_0.addClass("disabled"); + elems.operationBoxBtn_3.addClass("disabled"); + elems.choose3DMigotoPathButton.addClass("disabled"); + elems.selfSignedKeystoreButton.addClass("disabled"); + elems.officialKeystoreButton.addClass("disabled"); elems.operationBoxBtn_0.off('click', operationBoxBtn_0_ClickHandler); -}) - -.on('gateserver_cancel-install', (event) => { - elems.operationBoxBtn_0.addClass("disabled"); - elems.operationBoxBtn_0.off('click', operationBoxBtn_0_ClickHandler); + elems.operationBoxBtn_3.off('click', operationBoxBtn_3_ClickHandler); + elems.choose3DMigotoPathButton.off('click', choose3DMigotoPathButton_ClickHandler); + elems.selfSignedKeystoreButton.off('click', selfSignedKeystoreButton_ClickHandler); + elems.officialKeystoreButton.off('click', officialKeystoreButton_ClickHandler); }) .on('app_update_download_complete', (event) => { - elems.updateProgress.html = "下载进度将会显示在这里"; + elems.updateProgress.html("下载进度将会显示在这里"); iziToast.info({ icon: 'fa-solid fa-circle-info', layout: '2', @@ -738,7 +777,7 @@ ipcRenderer.on('openHandbookTXTBtn_not-found', (event) => { }) .on('gateserver_install_download_complete', (event) => { - elems.updateProgress.html = "下载进度将会显示在这里"; + elems.updateProgress.html("下载进度将会显示在这里"); iziToast.info({ icon: 'fa-solid fa-circle-info', layout: '2', diff --git a/main.js b/main.js index 7530669..690626c 100644 --- a/main.js +++ b/main.js @@ -45,7 +45,6 @@ let _3DMigotoModsPath; let patchExists = false; let action; let javaPath; -let finalJavaPath; let resURL = new Array(3); let gcInput = new Array(3); let proxyInput = new Array(2); @@ -166,11 +165,12 @@ ipcMain.on('render-ready', async (event) => { if (!app.isPackaged) { win.webContents.openDevTools(); } - await rwAppConfig(); - await rwMods(); - await rwPlugs(); - await updateAPP(); - await checkGateServer(); + if (await checkGateServer()) { + await rwAppConfig(); + await rwMods(); + await rwPlugs(); + await updateAPP(); + } }); ipcMain.on('devtools-opened', () => { @@ -561,7 +561,7 @@ ipcMain.on('chooseJavaPathButton_open-file-dialog', async (event) => { return; } if (stdout && stdout.includes('Java(TM) SE Runtime Environment')) { - javaPath = result.filePaths[0]; + javaPath = path.join(result.filePaths[0], "bin", "java.exe"); console.log(javaPath); win.webContents.send('chooseJavaPathButton_was-jdk', javaPath, "init"); try { @@ -683,7 +683,8 @@ ipcMain.on('operationBoxBtn_1-stop-service', async (event) => { 'reg add "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f', 'reg add "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyServer /d "" /f' ]; - killProcesses(processes, addition); + await killProcesses(processes, addition); + win.webContents.send('operationBoxBtn_1-success'); }); ipcMain.on('operationBoxBtn_2-run-game', (event) => { @@ -1095,77 +1096,25 @@ del ${global.packagedPaths.entryPath}\\update_app.bat\r`; async function checkGateServer() { try { await fs.promises.access(global.packagedPaths.gateServerPath); + return true; } catch(err) { if (err.code === "ENOENT") { console.log("GateServer not found"); - if (!app.isPackaged) { - const resp0 = await dialog.showMessageBox(win, { + if (app.isPackaged) { + await dialog.showMessageBox(win, { type: 'info', title: 'GateServer', - message: 'GateServer不存在!是否自动下载?', - buttons: ['确定', '取消'], - defaultId: 1, - cancelId: 1 + message: 'GateServer不存在!请从Github下载最新GateServer\n并解压至 resources\\GateServer !\n应用已进入沙盒模式...', }); - if (resp0.response === 0) { - const { latestTagVersion, latestTagType } = await fetchRelease(resURL); - win.webContents.send('gateserver_install'); - const downloadGateServerURL = `${resURL[0]}/btjawa/BTJGenshinPS/releases/download/v${latestTagVersion}-${latestTagType}/BTJGenshinPS-${latestTagVersion}-win32-ia32-${latestTagType}.zip`; - console.log("FULL URL:", downloadGateServerURL); - await downloadFile(downloadGateServerURL, path.join(global.packagedPaths.entryPath, `BTJGenshinPS-win32-ia32.zip`), "GateServer"); - win.webContents.send('gateserver_install_download_complete'); - console.log("Download GateServer Completed"); - - const appExtractPath = path.join(global.packagedPaths.entryPath, "temp_gateserver"); - const appZipPath = path.join(global.packagedPaths.entryPath, "BTJGenshinPS-win32-ia32.zip"); - - await unzipFile(appZipPath, appExtractPath); - - await fs.promises.unlink(appZipPath, (err) => { - if (err) { - console.error('Error deleting APP ZIP file:', err); - reject(err); - return; - } - console.log('APP ZIP file deleted successfully.'); - console.log(appZipPath); - }); - - try { - execSync(`xcopy "${path.join(appExtractPath, "resources", "GateServer")}\\" "${path.join(global.packagedPaths.entryPath, "GateServer")}\\" /E /Y`,{ encoding: 'binary' },(error,stdout,stderr) => { - if (error) { console.error(iconv.decode(Buffer.from(error.message, 'binary'), 'GBK')); } - if (stdout) { console.log(iconv.decode(Buffer.from(out, 'binary'), 'GBK')) }; - if (stderr) { console.error(iconv.decode(Buffer.from(stderr, 'binary'), 'GBK')) }; - }); - execSync(`rmdir /s /q ${path.join(global.packagedPaths.entryPath, "temp_gateserver")}`,{ encoding: 'binary' },(error,stdout,stderr) => { - if (error) { console.error(iconv.decode(Buffer.from(error.message, 'binary'), 'GBK')); } - console.log('Temp GateServer deleted successfully.'); - if (stdout) { console.log(iconv.decode(Buffer.from(out, 'binary'), 'GBK')) }; - if (stderr) { console.error(iconv.decode(Buffer.from(stderr, 'binary'), 'GBK')) }; - }); - } catch (err) { - console.error('Error deleting Temp GateServer:', err); - } - - const resp1 = await dialog.showMessageBox(win, { - type: 'info', - title: 'GateServer', - message: '将重启应用以应用更改', - buttons: ['确定'] - }); - app.relaunch(); - app.exit(0); - } else { - win.webContents.send("gateserver_cancel-install"); - } } else { - console.log("GateServer not found"); - const resp1 = await dialog.showMessageBox(win, { + await dialog.showMessageBox(win, { type: 'warning', title: 'GateServer', - message: 'GateServer不存在!', + message: 'GateServer不存在!请补全以便能正常package!', }); } + win.webContents.send('gateserver_not-exists'); + return false; } else { console.error(err); } @@ -1550,10 +1499,11 @@ async function checkJava() { const appConfigData = await fs.promises.readFile(path.join(global.packagedPaths.entryPath, "app.config.json"), 'utf8'); const appConfig = JSON.parse(appConfigData); if (appConfig.java && appConfig.java.exec !== "") { + console.log(appConfig.java.exec) javaPath = appConfig.java.exec; try { const { stdout } = await exec(`"${javaPath}" --version`, { encoding: 'binary' }); - if (stdout.includes('Java(TM) SE Runtime Environment')) { + if (stdout.includes('Runtime Environment')) { win.webContents.send('jdk-already-installed'); console.log('JDK from config is valid.'); return; @@ -1563,7 +1513,7 @@ async function checkJava() { } } const { stdout, stderr } = await exec('java --version', { encoding: 'binary' }); - if (stdout.includes('Java(TM) SE Runtime Environment')) { + if (stdout.includes('Runtime Environment')) { win.webContents.send('jdk-already-installed'); console.log('Global JDK is valid.'); javaPath = 'java'; @@ -1575,7 +1525,7 @@ async function checkJava() { } catch (error) { try { const { stdout } = await exec('java -version', { encoding: 'binary' }); - if (stdout.includes('Java(TM) SE Runtime Environment')) { + if (stdout.includes('Runtime Environment')) { win.webContents.send('jre-already-installed'); await downloadJDK(); return; @@ -1592,11 +1542,6 @@ async function downloadJDK() { const jdkZipPath = path.join(global.packagedPaths.entryPath, 'jdk-17.0.2.zip'); try { - try { - await fs.promises.access(path.join(global.packagedPaths.entryPath, 'jdk-17.0.2')); - await fs.promises.rmdir(path.join(global.packagedPaths.entryPath, 'jdk-17.0.2'), { recursive: true }); - } catch(err) {} - await downloadFile(jdkURL, jdkZipPath, 'Java Development Kit'); win.webContents.send('download-jdk', 'jdk-true'); console.log('JDK downloaded successfully.'); @@ -1606,7 +1551,7 @@ async function downloadJDK() { await unzipFile(jdkZipPath, jdkExtractPath); - javaPath = jdkPath; + javaPath = path.join(jdkPath, "bin", "java.exe"); const appConfigData = await fs.promises.readFile(path.join(global.packagedPaths.entryPath, 'app.config.json'), 'utf8'); const appConfig = JSON.parse(appConfigData); @@ -1718,8 +1663,8 @@ async function update(gc_org_url) { if (stderr) { console.log(iconv.decode(Buffer.from(stdout, 'binary'), 'GBK')) }; if (stdout) { console.error(iconv.decode(Buffer.from(stderr, 'binary'), 'GBK')) }; }) - win.webContents.send('update_complete'); console.log("Update Completed"); + win.webContents.send('update_complete'); } catch (error) { console.log(error); } @@ -1753,7 +1698,13 @@ async function downloadFile(url, outputPath, action) { async function run_main_service (gcInputRender, proxyInputRender) { await rwAppConfig("main-service-save", gcInputRender, proxyInputRender) const processes = ['java.exe', 'mongod.exe', 'mitmdump.exe']; - killProcesses(processes); + await killProcesses(processes); + if (!await checkGateServer()) { + console.log("Prevent runnning service\ngateserver_not-exists"); + win.webContents.send('gateserver_not-exists'); + return; + } + win.webContents.send('operationBoxBtn_0-success'); const add_root_crt_terminal = spawn('cmd.exe', ['/c', `start ${global.packagedPaths.dataPath}\\add_root_crt.bat`], { stdio: 'ignore' }); @@ -1763,9 +1714,7 @@ async function run_main_service (gcInputRender, proxyInputRender) { const proxy_terminal = spawn('cmd.exe', ['/c', `start ${global.packagedPaths.dataPath}\\run_mitm_proxy.bat`], { stdio: 'ignore' }); - javaPath == "java" ? finalJavaPath = "java" : finalJavaPath = `${path.join(javaPath, "bin", "java")}`; - console.log(finalJavaPath) - const gc_terminal = spawn('cmd.exe', ['/c', `start ${global.packagedPaths.dataPath}\\run_gc.bat ${finalJavaPath}`], { + const gc_terminal = spawn('cmd.exe', ['/c', `start ${global.packagedPaths.dataPath}\\run_gc.bat ${javaPath}`], { stdio: 'ignore' }); } diff --git a/package-lock.json b/package-lock.json index 7418a0a..3a25266 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,6 @@ "express": "^4.18.2", "iconv-lite": "^0.6.3", "ini": "^4.1.1", - "izitoast": "^1.4.0", "moment-timezone": "^0.5.43", "rage-edit": "^1.2.0", "winreg": "^1.2.4", @@ -244,18 +243,6 @@ "node": ">= 10" } }, - "node_modules/@sindresorhus/is": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", - "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/is?sponsor=1" - } - }, "node_modules/@szmarczak/http-timer": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", @@ -523,15 +510,6 @@ "node": ">= 0.8" } }, - "node_modules/cacheable-lookup": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", - "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", - "dev": true, - "engines": { - "node": ">=10.6.0" - } - }, "node_modules/cacheable-request": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.4.tgz", @@ -688,33 +666,6 @@ } } }, - "node_modules/decompress-response": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", - "dev": true, - "dependencies": { - "mimic-response": "^3.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/decompress-response/node_modules/mimic-response": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/defer-to-connect": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", @@ -1373,31 +1324,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/got": { - "version": "11.8.6", - "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", - "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", - "dev": true, - "dependencies": { - "@sindresorhus/is": "^4.0.0", - "@szmarczak/http-timer": "^4.0.5", - "@types/cacheable-request": "^6.0.1", - "@types/responselike": "^1.0.0", - "cacheable-lookup": "^5.0.3", - "cacheable-request": "^7.0.2", - "decompress-response": "^6.0.0", - "http2-wrapper": "^1.0.0-beta.5.2", - "lowercase-keys": "^2.0.0", - "p-cancelable": "^2.0.0", - "responselike": "^2.0.0" - }, - "engines": { - "node": ">=10.19.0" - }, - "funding": { - "url": "https://github.com/sindresorhus/got?sponsor=1" - } - }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -1479,7 +1405,7 @@ }, "node_modules/http2-wrapper": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", + "resolved": "https://registry.npmmirror.com/http2-wrapper/-/http2-wrapper-1.0.3.tgz", "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", "dev": true, "dependencies": { @@ -1594,11 +1520,6 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, - "node_modules/izitoast": { - "version": "1.4.0", - "resolved": "https://registry.npmmirror.com/izitoast/-/izitoast-1.4.0.tgz", - "integrity": "sha512-Oc1X2wiQtPp39i5VpIjf3GJf5sfCtHKXZ5szx7RareyEeFLUlcEW0FSfBni28+Ul6KNKZRKzhVuWzSP4Xngh0w==" - }, "node_modules/json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", @@ -2088,14 +2009,11 @@ }, "node_modules/quick-lru": { "version": "5.1.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "resolved": "https://registry.npmmirror.com/quick-lru/-/quick-lru-5.1.1.tgz", "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", "dev": true, "engines": { "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/rage-edit": { @@ -2194,7 +2112,7 @@ }, "node_modules/resolve-alpn": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "resolved": "https://registry.npmmirror.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz", "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", "dev": true },