diff --git a/3rdparty/WinCommander.cpp b/3rdparty/WinCommander.cpp index 54758cf..09cac07 100644 --- a/3rdparty/WinCommander.cpp +++ b/3rdparty/WinCommander.cpp @@ -26,6 +26,9 @@ #include #ifdef Q_OS_WIN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif #include #include #include diff --git a/cmake/windows/windows.cmake b/cmake/windows/windows.cmake index 1a7d802..75bd037 100644 --- a/cmake/windows/windows.cmake +++ b/cmake/windows/windows.cmake @@ -1,4 +1,4 @@ -set(PLATFORM_SOURCES 3rdparty/WinCommander.cpp sys/windows/guihelper.cpp) +set(PLATFORM_SOURCES 3rdparty/WinCommander.cpp sys/windows/guihelper.cpp sys/windows/MiniDump.cpp) set(PLATFORM_LIBRARIES wininet wsock32 ws2_32 user32 rasapi32 iphlpapi) include(cmake/windows/generate_product_version.cmake) @@ -21,5 +21,4 @@ else () add_compile_options("/utf-8") add_compile_options("/std:c++17") add_definitions(-D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS) - list(APPEND PLATFORM_SOURCES sys/windows/MiniDump.cpp) endif () diff --git a/go/cmd/updater/updater.go b/go/cmd/updater/updater.go index eefbe62..170c58a 100644 --- a/go/cmd/updater/updater.go +++ b/go/cmd/updater/updater.go @@ -6,6 +6,7 @@ import ( "os" "path/filepath" "runtime" + "strings" "github.com/codeclysm/extract" ) @@ -18,12 +19,23 @@ func Updater() { os.RemoveAll("./nekoray_update") } - // update extract - if Exist("./nekoray.zip") { - pre_cleanup() - log.Println("updating from zip") + // find update package + var updatePackagePath string + if len(os.Args) == 2 && Exist(os.Args[1]) { + updatePackagePath = os.Args[1] + } else if Exist("./nekoray.zip") { + updatePackagePath = "./nekoray.zip" + } else if Exist("./nekoray.tar.gz") { + updatePackagePath = "./nekoray.tar.gz" + } else { + log.Fatalln("no update") + } + log.Println("updating from", updatePackagePath) - f, err := os.Open("./nekoray.zip") + // extract update package + if strings.HasSuffix(updatePackagePath, ".zip") { + pre_cleanup() + f, err := os.Open(updatePackagePath) if err != nil { log.Fatalln(err.Error()) } @@ -32,11 +44,9 @@ func Updater() { log.Fatalln(err.Error()) } f.Close() - } else if Exist("./nekoray.tar.gz") { + } else if strings.HasSuffix(updatePackagePath, ".tar.gz") { pre_cleanup() - log.Println("updating from tar.gz") - - f, err := os.Open("./nekoray.tar.gz") + f, err := os.Open(updatePackagePath) if err != nil { log.Fatalln(err.Error()) } @@ -45,8 +55,6 @@ func Updater() { log.Fatalln(err.Error()) } f.Close() - } else { - log.Fatalln("no update") } // remove old file diff --git a/qv2ray/v2/components/proxy/QvProxyConfigurator.cpp b/qv2ray/v2/components/proxy/QvProxyConfigurator.cpp index ada7c91..bcd1996 100644 --- a/qv2ray/v2/components/proxy/QvProxyConfigurator.cpp +++ b/qv2ray/v2/components/proxy/QvProxyConfigurator.cpp @@ -2,6 +2,9 @@ #ifdef Q_OS_WIN // +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif #include // #include diff --git a/sys/windows/MiniDump.cpp b/sys/windows/MiniDump.cpp index 9042d0f..c9365f2 100644 --- a/sys/windows/MiniDump.cpp +++ b/sys/windows/MiniDump.cpp @@ -1,8 +1,11 @@ #include "MiniDump.h" -#include -#include -#include +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include +#include #include #include @@ -27,14 +30,14 @@ LONG CreateCrashHandler(EXCEPTION_POINTERS *pException) { if (DllHandle) { MINIDUMPWRITEDUMP Dump = (MINIDUMPWRITEDUMP) GetProcAddress(DllHandle, "MiniDumpWriteDump"); if (Dump) { - //创建 Dump 文件 + // 创建 Dump 文件 QDateTime CurDTime = QDateTime::currentDateTime(); QString current_date = CurDTime.toString("yyyy_MM_dd_hh_mm_ss"); // dmp文件的命名 QString dumpText = "Dump_" + current_date + ".dmp"; EXCEPTION_RECORD *record = pException->ExceptionRecord; QString errCode(QString::number(record->ExceptionCode, 16)); - QString errAddr(QString::number((uint) record->ExceptionAddress, 16)); + QString errAddr(QString::number((uintptr_t) record->ExceptionAddress, 16)); QString errFlag(QString::number(record->ExceptionFlags, 16)); QString errPara(QString::number(record->NumberParameters, 16)); HANDLE DumpHandle = CreateFile((LPCWSTR) dumpText.utf16(), @@ -44,14 +47,14 @@ LONG CreateCrashHandler(EXCEPTION_POINTERS *pException) { dumpInfo.ExceptionPointers = pException; dumpInfo.ThreadId = GetCurrentThreadId(); dumpInfo.ClientPointers = TRUE; - //将dump信息写入dmp文件 + // 将dump信息写入dmp文件 Dump(GetCurrentProcess(), GetCurrentProcessId(), DumpHandle, MiniDumpNormal, &dumpInfo, NULL, NULL); CloseHandle(DumpHandle); } else { dumpText = ""; } - //创建消息提示 + // 创建消息提示 QMessageBox::warning(NULL, "Application crashed", QString("ErrorCode: %1 ErrorAddr:%2 ErrorFlag: %3 ErrorPara: %4\nVersion: %5\nDump file at %6") .arg(errCode) diff --git a/sys/windows/MiniDump.h b/sys/windows/MiniDump.h index eedcbc0..a8fb3ff 100644 --- a/sys/windows/MiniDump.h +++ b/sys/windows/MiniDump.h @@ -1,11 +1,3 @@ #pragma once -#ifdef __MINGW32__ - -void Windows_SetCrashHandler() {} - -#else - void Windows_SetCrashHandler(); - -#endif diff --git a/translations/fa_IR.ts b/translations/fa_IR.ts index ce5a2a4..b4bd4d7 100644 --- a/translations/fa_IR.ts +++ b/translations/fa_IR.ts @@ -112,10 +112,6 @@ Insecure hint اشاره ناامن - - Skip TLS certificate authentication by default - - Traffic statistics refresh rate نرخ تازه سازی آمار ترافیک @@ -233,6 +229,10 @@ Maybe useful for HiDPI screens. + + Skip TLS certificate authentication by default (allowInsecure) + + DialogEditGroup @@ -748,6 +748,10 @@ UUID + + Generate UUID + + GroupItem diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index 13659b8..1447f52 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -111,10 +111,6 @@ Insecure hint 提示不安全的配置 - - Skip TLS certificate authentication by default - 默认跳过 TLS 证书验证 - Traffic statistics refresh rate 流量统计刷新率 @@ -153,7 +149,7 @@ Include Pre-release when checking update - 检查更新时包括 Pre-release + 检查更新时包括 Pre-release 版本 Set custom icon @@ -231,6 +227,10 @@ Maybe useful for HiDPI screens. + + Skip TLS certificate authentication by default (allowInsecure) + 默认跳过 TLS 证书验证 (allowInsecure) + DialogEditGroup @@ -754,6 +754,10 @@ UUID + + Generate UUID + 生成 UUID + GroupItem diff --git a/ui/dialog_basic_settings.ui b/ui/dialog_basic_settings.ui index 6c3a677..f6e516d 100644 --- a/ui/dialog_basic_settings.ui +++ b/ui/dialog_basic_settings.ui @@ -659,7 +659,7 @@ - Skip TLS certificate authentication by default + Skip TLS certificate authentication by default (allowInsecure) diff --git a/ui/dialog_manage_routes.ui b/ui/dialog_manage_routes.ui index 60e08b7..a91219d 100644 --- a/ui/dialog_manage_routes.ui +++ b/ui/dialog_manage_routes.ui @@ -298,16 +298,6 @@ - - - - QFrame::Box - - - - - - @@ -369,6 +359,29 @@ + + + + QFrame::Box + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + diff --git a/ui/edit/edit_shadowsocks.ui b/ui/edit/edit_shadowsocks.ui index 92e63e8..f8c0f6b 100644 --- a/ui/edit/edit_shadowsocks.ui +++ b/ui/edit/edit_shadowsocks.ui @@ -14,9 +14,6 @@ Form - - 0 - diff --git a/ui/edit/edit_socks_http.ui b/ui/edit/edit_socks_http.ui index 251727e..c179709 100644 --- a/ui/edit/edit_socks_http.ui +++ b/ui/edit/edit_socks_http.ui @@ -14,9 +14,6 @@ Form - - 0 - diff --git a/ui/edit/edit_vmess.cpp b/ui/edit/edit_vmess.cpp index 52f92ac..1d1f7ab 100644 --- a/ui/edit/edit_vmess.cpp +++ b/ui/edit/edit_vmess.cpp @@ -3,8 +3,11 @@ #include "fmt/VMessBean.hpp" +#include + EditVMess::EditVMess(QWidget *parent) : QWidget(parent), ui(new Ui::EditVMess) { ui->setupUi(this); + connect(ui->uuidgen, &QPushButton::clicked, this, [=] { ui->uuid->setText(QUuid::createUuid().toString().remove("{").remove("}")); }); } EditVMess::~EditVMess() { diff --git a/ui/edit/edit_vmess.ui b/ui/edit/edit_vmess.ui index 8996712..b29dbee 100644 --- a/ui/edit/edit_vmess.ui +++ b/ui/edit/edit_vmess.ui @@ -14,34 +14,7 @@ EditVMess - - - - Alter Id - - - - - - - - - - Security - - - - - - - - - - UUID - - - - + true @@ -73,6 +46,64 @@ + + + + Security + + + + + + + Alter Id + + + + + + + UUID + + + + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + Generate UUID + + + + + + @@ -82,6 +113,12 @@
ui/widget/MyLineEdit.h
+ + uuid + aid + uuidgen + security + diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp index 785db2f..bed363b 100644 --- a/ui/mainwindow.cpp +++ b/ui/mainwindow.cpp @@ -367,13 +367,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi connect(ui->menuCurrent_Select, &QMenu::aboutToShow, this, move_tests_to_menu(true)); connect(ui->menuCurrent_Group, &QMenu::aboutToShow, this, move_tests_to_menu(false)); connect(ui->menu_server, &QMenu::aboutToHide, this, [=] { - auto timer = new QTimer(this); - timer->setInterval(100); - connect(timer, &QTimer::timeout, this, [=] { - set_selected_or_group(2); - timer->deleteLater(); - }); - timer->start(); + setTimeout([=] { set_selected_or_group(2); }, this, 200); }); set_selected_or_group(2); //