From a17d6f280297cce6b906bb791a2122de46a12afc Mon Sep 17 00:00:00 2001 From: Qv2ray-dev <59914293+Qv2ray-dev@users.noreply.github.com> Date: Thu, 26 Mar 2020 16:04:59 +0800 Subject: [PATCH] fix: this may fixed #457 --- makespec/BUILDVERSION | 2 +- src/base/models/CoreObjectModels.hpp | 2 +- src/ui/editors/w_OutboundEditor.cpp | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/makespec/BUILDVERSION b/makespec/BUILDVERSION index 69907aad..a706263d 100644 --- a/makespec/BUILDVERSION +++ b/makespec/BUILDVERSION @@ -1 +1 @@ -4957 \ No newline at end of file +4960 \ No newline at end of file diff --git a/src/base/models/CoreObjectModels.hpp b/src/base/models/CoreObjectModels.hpp index 7500273e..14d86f04 100644 --- a/src/base/models/CoreObjectModels.hpp +++ b/src/base/models/CoreObjectModels.hpp @@ -350,7 +350,7 @@ namespace Qv2ray::base::objects QString user; QString pass; int level; - UserObject() : user("username"), pass("password"), level(0) + UserObject() : user(), pass(), level(0) { } XTOSTRUCT(O(user, pass, level)) diff --git a/src/ui/editors/w_OutboundEditor.cpp b/src/ui/editors/w_OutboundEditor.cpp index 792e6a06..1ebac650 100644 --- a/src/ui/editors/w_OutboundEditor.cpp +++ b/src/ui/editors/w_OutboundEditor.cpp @@ -124,6 +124,11 @@ OUTBOUND OutboundEditor::GenerateConnectionJson() } else if (OutboundType == "socks") { + if (socks.users.first().user.isEmpty() && socks.users.first().pass.isEmpty()) + { + LOG(MODULE_UI, "Removed empty user form SOCKS settings") + socks.users.clear(); + } streaming = QJsonObject(); LOG(MODULE_CONNECTION, "Socks outbound does not need StreamSettings.") QJsonArray servers; @@ -276,10 +281,14 @@ void OutboundEditor::on_ss_otaCheckBox_stateChanged(int arg1) void OutboundEditor::on_socks_UserNameTxt_textEdited(const QString &arg1) { + if (socks.users.isEmpty()) + socks.users.push_back(SocksServerObject::UserObject()); socks.users.front().user = arg1; } void OutboundEditor::on_socks_PasswordTxt_textEdited(const QString &arg1) { + if (socks.users.isEmpty()) + socks.users.push_back(SocksServerObject::UserObject()); socks.users.front().pass = arg1; }