This commit is contained in:
arm64v8a
2023-01-31 17:24:05 +09:00
parent 9f7a830d2a
commit afa2fc1663
15 changed files with 146 additions and 89 deletions

View File

@@ -26,6 +26,9 @@
#include <QDir>
#ifdef Q_OS_WIN
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <shellapi.h>
#include <sddl.h>

View File

@@ -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 ()

View File

@@ -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

View File

@@ -2,6 +2,9 @@
#ifdef Q_OS_WIN
//
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
//
#include <wininet.h>

View File

@@ -1,8 +1,11 @@
#include "MiniDump.h"
#include <Windows.h>
#include <TChar.h>
#include <DbgHelp.h>
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <tchar.h>
#include <dbghelp.h>
#include <QApplication>
#include <QDir>
@@ -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)

View File

@@ -1,11 +1,3 @@
#pragma once
#ifdef __MINGW32__
void Windows_SetCrashHandler() {}
#else
void Windows_SetCrashHandler();
#endif

View File

@@ -112,10 +112,6 @@
<source>Insecure hint</source>
<translation>اشاره ناامن</translation>
</message>
<message>
<source>Skip TLS certificate authentication by default</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Traffic statistics refresh rate</source>
<translation>نرخ تازه سازی آمار ترافیک</translation>
@@ -233,6 +229,10 @@
<source>Maybe useful for HiDPI screens.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Skip TLS certificate authentication by default (allowInsecure)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DialogEditGroup</name>
@@ -748,6 +748,10 @@
<source>UUID</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Generate UUID</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>GroupItem</name>

View File

@@ -111,10 +111,6 @@
<source>Insecure hint</source>
<translation></translation>
</message>
<message>
<source>Skip TLS certificate authentication by default</source>
<translation> TLS </translation>
</message>
<message>
<source>Traffic statistics refresh rate</source>
<translation></translation>
@@ -153,7 +149,7 @@
</message>
<message>
<source>Include Pre-release when checking update</source>
<translation> Pre-release</translation>
<translation> Pre-release </translation>
</message>
<message>
<source>Set custom icon</source>
@@ -231,6 +227,10 @@
<source>Maybe useful for HiDPI screens.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Skip TLS certificate authentication by default (allowInsecure)</source>
<translation> TLS (allowInsecure)</translation>
</message>
</context>
<context>
<name>DialogEditGroup</name>
@@ -754,6 +754,10 @@
<source>UUID</source>
<translation></translation>
</message>
<message>
<source>Generate UUID</source>
<translation> UUID</translation>
</message>
</context>
<context>
<name>GroupItem</name>

View File

@@ -659,7 +659,7 @@
<item>
<widget class="QCheckBox" name="skip_cert">
<property name="text">
<string>Skip TLS certificate authentication by default</string>
<string>Skip TLS certificate authentication by default (allowInsecure)</string>
</property>
</widget>
</item>

View File

@@ -298,16 +298,6 @@
<item row="1" column="1">
<layout class="QGridLayout" name="directIPLayout"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="active_routing">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
@@ -369,6 +359,29 @@
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="active_routing">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="horizontalWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">

View File

@@ -14,9 +14,6 @@
<string notr="true">Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>0</number>
</property>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">

View File

@@ -14,9 +14,6 @@
<string notr="true">Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="version_l">
<property name="text">

View File

@@ -3,8 +3,11 @@
#include "fmt/VMessBean.hpp"
#include <QUuid>
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() {

View File

@@ -14,34 +14,7 @@
<string notr="true">EditVMess</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Alter Id</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="MyLineEdit" name="uuid"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Security</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="aid"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>UUID</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="4" column="1">
<widget class="QComboBox" name="security">
<property name="editable">
<bool>true</bool>
@@ -73,6 +46,64 @@
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Security</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Alter Id</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>UUID</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="MyLineEdit" name="uuid"/>
</item>
<item row="3" column="1">
<widget class="QWidget" name="horizontalWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="aid"/>
</item>
<item>
<widget class="QPushButton" name="uuidgen">
<property name="text">
<string>Generate UUID</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
@@ -82,6 +113,12 @@
<header>ui/widget/MyLineEdit.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>uuid</tabstop>
<tabstop>aid</tabstop>
<tabstop>uuidgen</tabstop>
<tabstop>security</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -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);
//