gui: reality settings

This commit is contained in:
arm64v8a
2023-04-07 17:07:32 +09:00
parent 089acaebb5
commit 1d8fdc7a7d
9 changed files with 144 additions and 43 deletions

View File

@@ -94,8 +94,16 @@ DialogEditProfile::DialogEditProfile(const QString &_type, int profileOrGroupId,
connect(ui->security, &QComboBox::currentTextChanged, this, [=](const QString &txt) {
if (txt == "tls") {
ui->security_box->setVisible(true);
ui->reality_box->setVisible(true);
if (!IS_NEKO_BOX) {
ui->reality_pbk->hide();
ui->reality_sid->hide();
ui->reality_pbk_l->hide();
ui->reality_sid_l->hide();
}
} else {
ui->security_box->setVisible(false);
ui->reality_box->setVisible(false);
}
ADJUST_SIZE
});
@@ -196,7 +204,7 @@ void DialogEditProfile::typeSelected(const QString &newType) {
ui->port->setVisible(showAddressPort);
ui->port_l->setVisible(showAddressPort);
// 右边 Outbound: settings
// 右边 stream
auto stream = GetStreamSettings(ent->bean.data());
if (stream != nullptr) {
ui->right_all_w->setVisible(true);
@@ -212,6 +220,8 @@ void DialogEditProfile::typeSelected(const QString &newType) {
ui->header_type->setCurrentText(stream->header_type);
ui->ws_early_data_name->setText(stream->ws_early_data_name);
ui->ws_early_data_length->setText(Int2String(stream->ws_early_data_length));
ui->reality_pbk->setText(stream->reality_pbk);
ui->reality_sid->setText(stream->reality_sid);
CACHE.certificate = stream->certificate;
} else {
ui->right_all_w->setVisible(false);
@@ -310,7 +320,7 @@ void DialogEditProfile::accept() {
return;
}
// 右边
// 右边 stream
auto stream = GetStreamSettings(ent->bean.data());
if (stream != nullptr) {
stream->network = ui->network->currentText();
@@ -326,7 +336,11 @@ void DialogEditProfile::accept() {
stream->ws_early_data_name = ui->ws_early_data_name->text();
stream->ws_early_data_length = ui->ws_early_data_length->text().toInt();
stream->certificate = CACHE.certificate;
stream->reality_pbk = ui->reality_pbk->text();
stream->reality_sid = ui->reality_sid->text();
}
// cached custom
auto custom_item = ent->bean->_get("custom");
if (custom_item != nullptr) {
*((QString *) custom_item->ptr) = CACHE.custom;