diff --git a/CMakeLists.txt b/CMakeLists.txt
index 765a83dcf..e0f49292c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -155,6 +155,9 @@ set(PROJECT_SOURCES
ui/edit/edit_trojan_vless.h
ui/edit/edit_trojan_vless.cpp
ui/edit/edit_trojan_vless.ui
+ ui/edit/gen_hysteria.h
+ ui/edit/gen_hysteria.cpp
+ ui/edit/gen_hysteria.ui
ui/edit/edit_naive.h
ui/edit/edit_naive.cpp
diff --git a/README.md b/README.md
index 446f1e2bd..85928161d 100644
--- a/README.md
+++ b/README.md
@@ -29,19 +29,6 @@ https://matsuridayo.github.io
- `-many` 无视同目录正在运行的实例,强行开启新的实例 (0.11+)
- `-appdata` 开启后配置文件会放在共享目录,无法多开和自动升级 (0.11+)
-### 代理
-
-| 协议 | 状态 | 配置编辑 | 分享链接生成 | 分享链接解析 | Clash 配置解析 |
-|--------------|--------|------|--------|-----------|------------|
-| Socks | ✅ | ✅ | ✅ | ✅ | ✅ |
-| HTTP | ✅ | ✅ | ✅ | ✅ | ✅ |
-| Shadowsocks | ✅ (经典) | ✅ | ✅ | 常见格式 | ✅ |
-| VMess | ✅ | ✅ | ✅ | v2rayN 格式 | ✅ |
-| Trojan | ✅ | ✅ | ✅ | 标准&常见格式 | ✅ |
-| VLESS | ✅ | ✅ | ✅ | ✅ | 不适用 |
-| NaïveProxy | ✅ | ✅ | ✅ | ✅ | 不适用 |
-| Hysteria | ✅ | ❌ | ❌ | ❌ | 不适用 |
-
## Linux 运行 & 简易编译教程
**使用 Linux 系统相信您已具备基本的排错能力,
@@ -85,7 +72,7 @@ git submodule update
2. Qt 版本必须大于等于 5.15
3. 系统为 `x86-64-linux-gnu`
-```
+```shell
mkdir build
cd build
cmake -GNinja ..
@@ -104,6 +91,16 @@ C++ 部分
依赖搜寻 prefix 为 `libs/deps/bulit`
+示例
+
+```shell
+./libs/build_deps_all.sh
+mkdir build
+cd build
+cmake -GNinja ..
+ninja
+```
+
编译完成后得到 `nekoray`
Go 部分
diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts
index d0bc9cda1..132651e4c 100644
--- a/translations/zh_CN.ts
+++ b/translations/zh_CN.ts
@@ -492,6 +492,10 @@
命令
+
+
+ 生成器
+
EditNaive
@@ -596,6 +600,37 @@
+
+ GenHysteria
+
+
+ 生成配置
+
+
+
+ 不检查服务器证书(不安全)
+
+
+
+ 证书路径
+
+
+
+ 混淆密码
+
+
+
+ 字符串验证密钥
+
+
+
+ 协议
+
+
+
+ <html><head/><body><p><a href="https://github.com/HyNetwork/hysteria/wiki"><span style=" text-decoration: underline; color:#2980b9;">文档</span></a></p></body></html>
+
+
GroupItem
@@ -999,8 +1034,8 @@ End: %2
复制了 %1 个项目
-
- 从剪切板添加
+
+ 从剪切板添加 [ Ctrl+V ]
diff --git a/ui/edit/dialog_edit_profile.cpp b/ui/edit/dialog_edit_profile.cpp
index cbaa44bb9..7c0bb451c 100644
--- a/ui/edit/dialog_edit_profile.cpp
+++ b/ui/edit/dialog_edit_profile.cpp
@@ -127,8 +127,7 @@ void DialogEditProfile::typeSelected(const QString &newType) {
auto _innerWidget = new EditCustom(this);
innerWidget = _innerWidget;
innerEditor = _innerWidget;
- // I don't want to write a settings
- if (type == "hysteria") {
+ if (type == "hysteria" || ent->CustomBean()->core == "hysteria") {
_innerWidget->preset_core = type;
_innerWidget->preset_command = "-c %config%";
_innerWidget->preset_config = "{\n"
@@ -141,8 +140,8 @@ void DialogEditProfile::typeSelected(const QString &newType) {
" \"listen\": \"127.0.0.1:%socks_port%\"\n"
" }\n"
"}";
- type = "custom";
}
+ type = "custom";
} else {
validType = false;
}
diff --git a/ui/edit/edit_custom.cpp b/ui/edit/edit_custom.cpp
index c87876fc3..dbbd266b7 100644
--- a/ui/edit/edit_custom.cpp
+++ b/ui/edit/edit_custom.cpp
@@ -3,6 +3,7 @@
#include "qv2ray/v2/ui/widgets/editors/w_JsonEditor.hpp"
#include "fmt/CustomBean.hpp"
+#include "ui/edit/gen_hysteria.h"
EditCustom::EditCustom(QWidget *parent) :
QWidget(parent), ui(new Ui::EditCustom) {
@@ -34,17 +35,27 @@ void EditCustom::onStart(QSharedPointer _ent) {
ui->core->addItem(key);
}
- if (!preset_core.isEmpty()) {
+ if (!bean->core.isEmpty()) {
+ ui->core->setDisabled(true);
+ } else if (!preset_core.isEmpty()) {
bean->core = preset_core;
- ui->core->setCurrentText(preset_core);
ui->core->setDisabled(true);
+ ui->core->setCurrentText(preset_core);
ui->command->setText(preset_command);
ui->config_simple->setText(preset_config);
}
- if (!bean->core.isEmpty()) {
- ui->core->setDisabled(true);
- }
+ // Generators
+ if (bean->core == "hysteria") {
+ ui->generator->setVisible(true);
+ auto genHy = new GenHysteria(ent, preset_config);
+ ui->generator->layout()->addWidget(genHy);
+ connect(genHy, &GenHysteria::config_generated, this, [=](const QString &result) {
+ ui->config_simple->setText(result);
+ });
+ } else {
+ ui->generator->setVisible(false);
+ }
}
bool EditCustom::onEnd() {
diff --git a/ui/edit/edit_custom.ui b/ui/edit/edit_custom.ui
index 3abd7eb05..39aab2d5a 100644
--- a/ui/edit/edit_custom.ui
+++ b/ui/edit/edit_custom.ui
@@ -7,70 +7,93 @@
0
0
400
- 394
+ 400
EditCustom
-
+
-
-
+
-
-
-
-
- 0
- 0
-
-
-
- Core
-
-
-
- -
-
-
- true
-
-
-
- -
-
-
- Json
-
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Core
+
+
+
+ -
+
+
+ true
+
+
+
+ -
+
+
+ Json
+
+
+
+
-
-
- -
-
-
-
-
- Command
-
-
+
+
-
+
+
+ Command
+
+
+
+ -
+
+
+ %config%
+
+
+
+
-
-
-
- %config%
+
+
+
+ 0
+ 300
+
-
-
-
-
- 0
- 300
-
+
+
+ Generator
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+
@@ -79,7 +102,6 @@
core
as_json
command
- config_simple
diff --git a/ui/edit/gen_hysteria.cpp b/ui/edit/gen_hysteria.cpp
new file mode 100644
index 000000000..a540b0b1c
--- /dev/null
+++ b/ui/edit/gen_hysteria.cpp
@@ -0,0 +1,38 @@
+#include "gen_hysteria.h"
+#include "ui_gen_hysteria.h"
+
+#include "fmt/CustomBean.hpp"
+
+GenHysteria::GenHysteria(const QSharedPointer &ent, const QString &preset_config,
+ QWidget *parent) :
+ QWidget(parent), ui(new Ui::GenHysteria) {
+ ui->setupUi(this);
+ this->ent = ent;
+ this->preset_config = preset_config;
+}
+
+GenHysteria::~GenHysteria() {
+ delete ui;
+}
+
+void GenHysteria::on_gen_clicked() {
+ auto result = QString2QJsonObject(preset_config);
+ result["obfs"] = ui->obfs_password->text();
+ result["insecure"] = ui->allow_insecure->isChecked();
+ result["protocol"] = ui->protocol->currentText();
+ result["up_mbps"] = ui->up_mbps->text().toInt();
+ result["down_mbps"] = ui->down_mbps->text().toInt();
+ if (!ui->auth_string->text().isEmpty()) {
+ result["auth_str"] = ui->auth_string->text();
+ }
+ if (!ui->alpn->text().isEmpty()) {
+ result["alpn"] = ui->alpn->text();
+ }
+ if (!ui->sni->text().isEmpty()) {
+ result["server_name"] = ui->sni->text();
+ }
+ if (!ui->cert_path->text().isEmpty()) {
+ result["ca"] = ui->cert_path->text();
+ }
+ emit config_generated(QJsonObject2QString(result, false));
+}
diff --git a/ui/edit/gen_hysteria.h b/ui/edit/gen_hysteria.h
new file mode 100644
index 000000000..be9281922
--- /dev/null
+++ b/ui/edit/gen_hysteria.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#include
+#include "db/ProxyEntity.hpp"
+
+QT_BEGIN_NAMESPACE
+namespace Ui { class GenHysteria; }
+QT_END_NAMESPACE
+
+class GenHysteria : public QWidget {
+Q_OBJECT
+
+public:
+ explicit GenHysteria(const QSharedPointer &ent, const QString &preset_config,
+ QWidget *parent = nullptr);
+
+ ~GenHysteria() override;
+
+private:
+ Ui::GenHysteria *ui;
+ QSharedPointer ent;
+ QString preset_config;
+
+signals:
+
+ void config_generated(const QString &result);
+
+private slots:
+
+ void on_gen_clicked();
+};
diff --git a/ui/edit/gen_hysteria.ui b/ui/edit/gen_hysteria.ui
new file mode 100644
index 000000000..0bdc63ac0
--- /dev/null
+++ b/ui/edit/gen_hysteria.ui
@@ -0,0 +1,159 @@
+
+
+ GenHysteria
+
+
+
+ 0
+ 0
+ 400
+ 400
+
+
+
+ -
+
+
+ Certificate Path
+
+
+
+ -
+
+
+ Obfs Password
+
+
+
+ -
+
+
+ 50
+
+
+
+ -
+
+
+ down_mpbs
+
+
+
+ -
+
+
+ Generate
+
+
+
+ -
+
+
+ -
+
+
+ Protocol
+
+
+
+ -
+
+
+ up_mbps
+
+
+
+ -
+
+
-
+
+ udp
+
+
+ -
+
+ wechat-video
+
+
+
+
+ -
+
+
+ -
+
+
+ 10
+
+
+
+ -
+
+
+ SNI
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ ALPN
+
+
+
+ -
+
+
+ -
+
+
+ Auth String
+
+
+
+ -
+
+
+ Allow Insecure
+
+
+
+ -
+
+
+ <html><head/><body><p><a href="https://github.com/HyNetwork/hysteria/wiki"><span style=" text-decoration: underline; color:#2980b9;">Document</span></a></p></body></html>
+
+
+ true
+
+
+
+
+
+
+
+ MyLineEdit
+ QLineEdit
+
+
+
+
+ obfs_password
+ auth_string
+ protocol
+ up_mbps
+ down_mbps
+ sni
+ alpn
+ cert_path
+ gen
+
+
+
+
diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui
index 8dec535e3..26c23bdc0 100644
--- a/ui/mainwindow.ui
+++ b/ui/mainwindow.ui
@@ -587,7 +587,7 @@
- New profile from clipboard
+ Add profile from clipboard [ Ctrl+V ]
diff --git a/ui/mainwindow_grpc.cpp b/ui/mainwindow_grpc.cpp
index 19573ce43..83f9e369f 100644
--- a/ui/mainwindow_grpc.cpp
+++ b/ui/mainwindow_grpc.cpp
@@ -113,6 +113,7 @@ void MainWindow::speedtest_current_group(int mode) {
QList ext;
if (mode == libcore::TestMode::UrlTest || mode == libcore::FullTest) {
+ // TODO refactor: use only 1 instance
auto c = NekoRay::BuildConfig(profile, true);
// external test ???
if (!c->ext.isEmpty()) {