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> #include <QDir>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h> #include <windows.h>
#include <shellapi.h> #include <shellapi.h>
#include <sddl.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) set(PLATFORM_LIBRARIES wininet wsock32 ws2_32 user32 rasapi32 iphlpapi)
include(cmake/windows/generate_product_version.cmake) include(cmake/windows/generate_product_version.cmake)
@@ -21,5 +21,4 @@ else ()
add_compile_options("/utf-8") add_compile_options("/utf-8")
add_compile_options("/std:c++17") add_compile_options("/std:c++17")
add_definitions(-D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS) 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 () endif ()

View File

@@ -6,6 +6,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"
"strings"
"github.com/codeclysm/extract" "github.com/codeclysm/extract"
) )
@@ -18,12 +19,23 @@ func Updater() {
os.RemoveAll("./nekoray_update") os.RemoveAll("./nekoray_update")
} }
// update extract // find update package
if Exist("./nekoray.zip") { var updatePackagePath string
pre_cleanup() if len(os.Args) == 2 && Exist(os.Args[1]) {
log.Println("updating from zip") 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 { if err != nil {
log.Fatalln(err.Error()) log.Fatalln(err.Error())
} }
@@ -32,11 +44,9 @@ func Updater() {
log.Fatalln(err.Error()) log.Fatalln(err.Error())
} }
f.Close() f.Close()
} else if Exist("./nekoray.tar.gz") { } else if strings.HasSuffix(updatePackagePath, ".tar.gz") {
pre_cleanup() pre_cleanup()
log.Println("updating from tar.gz") f, err := os.Open(updatePackagePath)
f, err := os.Open("./nekoray.tar.gz")
if err != nil { if err != nil {
log.Fatalln(err.Error()) log.Fatalln(err.Error())
} }
@@ -45,8 +55,6 @@ func Updater() {
log.Fatalln(err.Error()) log.Fatalln(err.Error())
} }
f.Close() f.Close()
} else {
log.Fatalln("no update")
} }
// remove old file // remove old file

View File

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

View File

@@ -1,8 +1,11 @@
#include "MiniDump.h" #include "MiniDump.h"
#include <Windows.h> #ifndef WIN32_LEAN_AND_MEAN
#include <TChar.h> #define WIN32_LEAN_AND_MEAN
#include <DbgHelp.h> #endif
#include <windows.h>
#include <tchar.h>
#include <dbghelp.h>
#include <QApplication> #include <QApplication>
#include <QDir> #include <QDir>
@@ -34,7 +37,7 @@ LONG CreateCrashHandler(EXCEPTION_POINTERS *pException) {
QString dumpText = "Dump_" + current_date + ".dmp"; QString dumpText = "Dump_" + current_date + ".dmp";
EXCEPTION_RECORD *record = pException->ExceptionRecord; EXCEPTION_RECORD *record = pException->ExceptionRecord;
QString errCode(QString::number(record->ExceptionCode, 16)); 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 errFlag(QString::number(record->ExceptionFlags, 16));
QString errPara(QString::number(record->NumberParameters, 16)); QString errPara(QString::number(record->NumberParameters, 16));
HANDLE DumpHandle = CreateFile((LPCWSTR) dumpText.utf16(), HANDLE DumpHandle = CreateFile((LPCWSTR) dumpText.utf16(),

View File

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

View File

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

View File

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

View File

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

View File

@@ -298,16 +298,6 @@
<item row="1" column="1"> <item row="1" column="1">
<layout class="QGridLayout" name="directIPLayout"/> <layout class="QGridLayout" name="directIPLayout"/>
</item> </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> </layout>
</item> </item>
<item> <item>
@@ -369,6 +359,29 @@
</property> </property>
</spacer> </spacer>
</item> </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> <item>
<widget class="QWidget" name="horizontalWidget" native="true"> <widget class="QWidget" name="horizontalWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">

View File

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

View File

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

View File

@@ -3,8 +3,11 @@
#include "fmt/VMessBean.hpp" #include "fmt/VMessBean.hpp"
#include <QUuid>
EditVMess::EditVMess(QWidget *parent) : QWidget(parent), ui(new Ui::EditVMess) { EditVMess::EditVMess(QWidget *parent) : QWidget(parent), ui(new Ui::EditVMess) {
ui->setupUi(this); ui->setupUi(this);
connect(ui->uuidgen, &QPushButton::clicked, this, [=] { ui->uuid->setText(QUuid::createUuid().toString().remove("{").remove("}")); });
} }
EditVMess::~EditVMess() { EditVMess::~EditVMess() {

View File

@@ -14,34 +14,7 @@
<string notr="true">EditVMess</string> <string notr="true">EditVMess</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="0"> <item row="4" column="1">
<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">
<widget class="QComboBox" name="security"> <widget class="QComboBox" name="security">
<property name="editable"> <property name="editable">
<bool>true</bool> <bool>true</bool>
@@ -73,6 +46,64 @@
</item> </item>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
@@ -82,6 +113,12 @@
<header>ui/widget/MyLineEdit.h</header> <header>ui/widget/MyLineEdit.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops>
<tabstop>uuid</tabstop>
<tabstop>aid</tabstop>
<tabstop>uuidgen</tabstop>
<tabstop>security</tabstop>
</tabstops>
<resources/> <resources/>
<connections/> <connections/>
</ui> </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_Select, &QMenu::aboutToShow, this, move_tests_to_menu(true));
connect(ui->menuCurrent_Group, &QMenu::aboutToShow, this, move_tests_to_menu(false)); connect(ui->menuCurrent_Group, &QMenu::aboutToShow, this, move_tests_to_menu(false));
connect(ui->menu_server, &QMenu::aboutToHide, this, [=] { connect(ui->menu_server, &QMenu::aboutToHide, this, [=] {
auto timer = new QTimer(this); setTimeout([=] { set_selected_or_group(2); }, this, 200);
timer->setInterval(100);
connect(timer, &QTimer::timeout, this, [=] {
set_selected_or_group(2);
timer->deleteLater();
});
timer->start();
}); });
set_selected_or_group(2); set_selected_or_group(2);
// //