mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-18 04:54:38 +03:00
change hysteria gui
This commit is contained in:
@@ -166,9 +166,6 @@ 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
|
||||
|
||||
@@ -607,6 +607,10 @@
|
||||
<source>Outbound JSON, please read the documentation.</source>
|
||||
<translation>填写出站 JSON 对象,详细请看文档。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Please read the documentation. If you don't understand, use a share link instead.</source>
|
||||
<translation>格式请看文档。如果不懂,直接导入 hysteria:// 链接。</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditNaive</name>
|
||||
@@ -711,37 +715,6 @@
|
||||
<translation></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GenHysteria</name>
|
||||
<message>
|
||||
<source>Generate</source>
|
||||
<translation>生成配置</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Allow Insecure</source>
|
||||
<translation>不检查服务器证书(不安全)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Certificate Path</source>
|
||||
<translation>证书路径</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Obfs Password</source>
|
||||
<translation>混淆密码</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Auth String</source>
|
||||
<translation>字符串验证密钥</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Protocol</source>
|
||||
<translation>协议</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><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></source>
|
||||
<translation><html><head/><body><p><a href="https://github.com/HyNetwork/hysteria/wiki"><span style=" text-decoration: underline; color:#2980b9;">文档</span></a></p></body></html></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GroupItem</name>
|
||||
<message>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "qv2ray/v2/ui/widgets/editors/w_JsonEditor.hpp"
|
||||
#include "fmt/CustomBean.hpp"
|
||||
#include "fmt/Preset.hpp"
|
||||
#include "ui/edit/gen_hysteria.h"
|
||||
|
||||
EditCustom::EditCustom(QWidget *parent) :
|
||||
QWidget(parent), ui(new Ui::EditCustom) {
|
||||
@@ -36,6 +35,9 @@ void EditCustom::onStart(QSharedPointer<NekoRay::ProxyEntity> _ent) {
|
||||
preset_command = Preset::Hysteria::command;
|
||||
preset_config = Preset::Hysteria::config;
|
||||
ui->config_simple->setPlaceholderText("");
|
||||
ui->core->hide();
|
||||
ui->core_l->setText(
|
||||
tr("Please read the documentation. If you don't understand, use a share link instead."));
|
||||
} else if (preset_core == "internal") {
|
||||
preset_command = preset_config = "";
|
||||
ui->config_simple->setPlaceholderText("{\n"
|
||||
@@ -69,16 +71,7 @@ void EditCustom::onStart(QSharedPointer<NekoRay::ProxyEntity> _ent) {
|
||||
}
|
||||
|
||||
// Generators
|
||||
if (bean->core == "hysteria") {
|
||||
ui->generator->setVisible(true);
|
||||
auto genHy = new GenHysteria(ent);
|
||||
ui->generator->layout()->addWidget(genHy);
|
||||
connect(genHy, &GenHysteria::config_generated, this, [=](const QString &result) {
|
||||
ui->config_simple->setText(result);
|
||||
});
|
||||
} else {
|
||||
ui->generator->setVisible(false);
|
||||
}
|
||||
ui->generator->setVisible(false);
|
||||
}
|
||||
|
||||
bool EditCustom::onEnd() {
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
#include "gen_hysteria.h"
|
||||
#include "ui_gen_hysteria.h"
|
||||
|
||||
#include "fmt/CustomBean.hpp"
|
||||
#include "fmt/Preset.hpp"
|
||||
|
||||
GenHysteria::GenHysteria(const QSharedPointer<NekoRay::ProxyEntity> &ent, QWidget *parent) :
|
||||
QWidget(parent), ui(new Ui::GenHysteria) {
|
||||
ui->setupUi(this);
|
||||
this->ent = ent;
|
||||
}
|
||||
|
||||
GenHysteria::~GenHysteria() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void GenHysteria::on_gen_clicked() {
|
||||
auto result = QString2QJsonObject(Preset::Hysteria::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));
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#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<NekoRay::ProxyEntity> &ent, QWidget *parent = nullptr);
|
||||
|
||||
~GenHysteria() override;
|
||||
|
||||
private:
|
||||
Ui::GenHysteria *ui;
|
||||
QSharedPointer<NekoRay::ProxyEntity> ent;
|
||||
|
||||
signals:
|
||||
|
||||
void config_generated(const QString &result);
|
||||
|
||||
private slots:
|
||||
|
||||
void on_gen_clicked();
|
||||
};
|
||||
@@ -1,159 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GenHysteria</class>
|
||||
<widget class="QWidget" name="GenHysteria">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Certificate Path</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Obfs Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="down_mbps">
|
||||
<property name="text">
|
||||
<string notr="true">50</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string notr="true">down_mpbs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QPushButton" name="gen">
|
||||
<property name="text">
|
||||
<string>Generate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="MyLineEdit" name="auth_string"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Protocol</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string notr="true">up_mbps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="protocol">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">udp</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">wechat-video</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="MyLineEdit" name="obfs_password"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="up_mbps">
|
||||
<property name="text">
|
||||
<string notr="true">10</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string notr="true">SNI</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="MyLineEdit" name="cert_path"/>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="alpn"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string notr="true">ALPN</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="MyLineEdit" name="sni"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Auth String</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="allow_insecure">
|
||||
<property name="text">
|
||||
<string>Allow Insecure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string><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></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>MyLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>ui/widget/MyLineEdit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>obfs_password</tabstop>
|
||||
<tabstop>auth_string</tabstop>
|
||||
<tabstop>protocol</tabstop>
|
||||
<tabstop>up_mbps</tabstop>
|
||||
<tabstop>down_mbps</tabstop>
|
||||
<tabstop>sni</tabstop>
|
||||
<tabstop>alpn</tabstop>
|
||||
<tabstop>cert_path</tabstop>
|
||||
<tabstop>gen</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user