From 195826f887ec0dbc713346a5c68c4c36cca8ae4b Mon Sep 17 00:00:00 2001 From: parhelia512 <0011d3@gmail.com> Date: Fri, 5 Dec 2025 02:15:25 +0800 Subject: [PATCH] fix: fix grpc transport --- include/ui/profile/dialog_edit_profile.ui | 10 ++++++++++ src/configs/common/transport.cpp | 5 +---- src/ui/profile/dialog_edit_profile.cpp | 13 +++++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/include/ui/profile/dialog_edit_profile.ui b/include/ui/profile/dialog_edit_profile.ui index 59f7b23..fcce90c 100644 --- a/include/ui/profile/dialog_edit_profile.ui +++ b/include/ui/profile/dialog_edit_profile.ui @@ -476,6 +476,16 @@ + + + + Service Name + + + + + + diff --git a/src/configs/common/transport.cpp b/src/configs/common/transport.cpp index ee3ce33..79ae963 100644 --- a/src/configs/common/transport.cpp +++ b/src/configs/common/transport.cpp @@ -126,10 +126,7 @@ namespace Configs { QJsonObject object; if (type.isEmpty() || type == "tcp") return object; if (!type.isEmpty()) object["type"] = type; - if (!path.isEmpty()) { - if (type == "grpc") object["service_name"] = path; - else object["path"] = path; - } + if (!path.isEmpty()) object["path"] = path; if (!method.isEmpty()) object["method"] = method; if (!headers.isEmpty()) { object["headers"] = qStringListToJsonObject(headers); diff --git a/src/ui/profile/dialog_edit_profile.cpp b/src/ui/profile/dialog_edit_profile.cpp index d29dd39..677bac4 100644 --- a/src/ui/profile/dialog_edit_profile.cpp +++ b/src/ui/profile/dialog_edit_profile.cpp @@ -44,8 +44,8 @@ DialogEditProfile::DialogEditProfile(const QString &_type, int profileOrGroupId, ui->headers_l->setVisible(false); ui->method->setVisible(false); ui->method_l->setVisible(false); - ui->path->setVisible(true); - ui->path_l->setVisible(true); + ui->path->setVisible(false); + ui->path_l->setVisible(false); ui->host->setVisible(false); ui->host_l->setVisible(false); } else if (txt == "ws" || txt == "httpupgrade") { @@ -76,6 +76,13 @@ DialogEditProfile::DialogEditProfile(const QString &_type, int profileOrGroupId, ui->host->setVisible(false); ui->host_l->setVisible(false); } + if (txt == "grpc") { + ui->service_name->setVisible(true); + ui->service_name_l->setVisible(true); + } else { + ui->service_name->setVisible(false); + ui->service_name_l->setVisible(false); + } if (txt == "ws") { ui->ws_early_data_length->setVisible(true); ui->ws_early_data_length_l->setVisible(true); @@ -307,6 +314,7 @@ void DialogEditProfile::typeSelected(const QString &newType) { ui->tls_rec_frag->setChecked(tls->record_fragment); ui->insecure->setChecked(tls->insecure); ui->headers->setText(transport->getHeadersString()); + ui->service_name->setText(transport->service_name); ui->ws_early_data_name->setText(transport->early_data_header_name); ui->ws_early_data_length->setText(Int2String(transport->max_early_data)); ui->reality_pbk->setText(tls->reality->public_key); @@ -424,6 +432,7 @@ bool DialogEditProfile::onEnd() { tls->insecure = ui->insecure->isChecked(); transport->headers = transport->getHeaderPairs(ui->headers->text()); transport->method = ui->method->text(); + transport->service_name = ui->service_name->text(); transport->early_data_header_name = ui->ws_early_data_name->text(); transport->max_early_data = ui->ws_early_data_length->text().toInt(); tls->reality->public_key = ui->reality_pbk->text();