Export shadowsocks over cloak config support
This commit is contained in:
parent
74a517d985
commit
e7a22ad159
7 changed files with 170 additions and 43 deletions
|
|
@ -1216,7 +1216,7 @@ void MainWindow::setupAppSettingsConnections()
|
|||
|
||||
connect(ui->pushButton_app_settings_open_logs, &QPushButton::clicked, this, [this](){
|
||||
Debug::openLogsFolder();
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(Utils::systemLogPath()));
|
||||
//QDesktopServices::openUrl(QUrl::fromLocalFile(Utils::systemLogPath()));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -1566,6 +1566,17 @@ void MainWindow::setupSharePageConnections()
|
|||
});
|
||||
});
|
||||
|
||||
connect(ui->pushButton_share_full_save, &QPushButton::clicked, this, [this](){
|
||||
if (ui->textEdit_share_full_code->toPlainText().isEmpty()) return;
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save AmneziaVPN config"),
|
||||
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.amnezia");
|
||||
QSaveFile save(fileName);
|
||||
save.open(QIODevice::WriteOnly);
|
||||
save.write(ui->textEdit_share_full_code->toPlainText().toUtf8());
|
||||
save.commit();
|
||||
});
|
||||
|
||||
connect(ui->pushButton_share_amnezia_copy, &QPushButton::clicked, this, [this](){
|
||||
if (ui->textEdit_share_amnezia_code->toPlainText().isEmpty()) return;
|
||||
|
||||
|
|
@ -1606,14 +1617,14 @@ void MainWindow::setupSharePageConnections()
|
|||
});
|
||||
});
|
||||
|
||||
// connect(ui->pushButton_share_cloak_copy, &QPushButton::clicked, this, [this](){
|
||||
// QGuiApplication::clipboard()->setText(ui->textEdit_share_openvpn_code->toPlainText());
|
||||
// ui->pushButton_share_cloak_copy->setText(tr("Copied"));
|
||||
connect(ui->pushButton_share_cloak_copy, &QPushButton::clicked, this, [this](){
|
||||
QGuiApplication::clipboard()->setText(ui->plainTextEdit_share_cloak->toPlainText());
|
||||
ui->pushButton_share_cloak_copy->setText(tr("Copied"));
|
||||
|
||||
// QTimer::singleShot(3000, this, [this]() {
|
||||
// ui->pushButton_share_cloak_copy->setText(tr("Copy"));
|
||||
// });
|
||||
// });
|
||||
QTimer::singleShot(3000, this, [this]() {
|
||||
ui->pushButton_share_cloak_copy->setText(tr("Copy"));
|
||||
});
|
||||
});
|
||||
|
||||
connect(ui->pushButton_share_amnezia_generate, &QPushButton::clicked, this, [this](){
|
||||
ui->pushButton_share_amnezia_generate->setEnabled(false);
|
||||
|
|
@ -2129,22 +2140,11 @@ void MainWindow::updateSharingPage(int serverIndex, const ServerCredentials &cre
|
|||
ui->pushButton_share_openvpn_copy->setEnabled(false);
|
||||
ui->pushButton_share_openvpn_save->setEnabled(false);
|
||||
|
||||
// QJsonObject protoConfig = m_settings.protocolConfig(serverIndex, container, Protocol::OpenVpn);
|
||||
// QString cfg = protoConfig.value(config_key::last_config).toString();
|
||||
// if (!cfg.isEmpty()) {
|
||||
// // TODO add redirect-gateway def1 bypass-dhcp here and on click Generate config
|
||||
// ui->textEdit_share_openvpn_code->setPlainText(cfg);
|
||||
// }
|
||||
// else {
|
||||
// cfg = tr("Press Generate config");
|
||||
// ui->textEdit_share_openvpn_code->setPlainText(cfg);
|
||||
// ui->pushButton_share_openvpn_copy->setEnabled(false);
|
||||
// ui->pushButton_share_openvpn_save->setEnabled(false);
|
||||
// }
|
||||
ui->toolBox_share_connection->setCurrentWidget(ui->page_share_openvpn);
|
||||
}
|
||||
|
||||
if (container == DockerContainer::OpenVpnOverShadowSocks) {
|
||||
if (container == DockerContainer::OpenVpnOverShadowSocks ||
|
||||
container == DockerContainer::OpenVpnOverCloak) {
|
||||
ui->toolBox_share_connection->addItem(ui->page_share_amnezia, tr(" Share for Amnezia client"));
|
||||
ui->toolBox_share_connection->addItem(ui->page_share_shadowsocks, tr(" Share for ShadowSocks client"));
|
||||
|
||||
|
|
@ -2185,7 +2185,27 @@ void MainWindow::updateSharingPage(int serverIndex, const ServerCredentials &cre
|
|||
}
|
||||
|
||||
if (container == DockerContainer::OpenVpnOverCloak) {
|
||||
ui->toolBox_share_connection->addItem(ui->page_share_amnezia, tr(" Share for Amnezia client"));
|
||||
//ui->toolBox_share_connection->addItem(ui->page_share_amnezia, tr(" Share for Amnezia client"));
|
||||
ui->toolBox_share_connection->addItem(ui->page_share_cloak, tr(" Share for Cloak client"));
|
||||
ui->plainTextEdit_share_cloak->setPlainText(QString(""));
|
||||
|
||||
QJsonObject protoConfig = m_settings.protocolConfig(serverIndex, container, Protocol::Cloak);
|
||||
QString cfg = protoConfig.value(config_key::last_config).toString();
|
||||
|
||||
if (cfg.isEmpty()) {
|
||||
const QJsonObject &containerConfig = m_settings.containerConfig(serverIndex, container);
|
||||
|
||||
ErrorCode e = ErrorCode::NoError;
|
||||
cfg = CloakConfigurator::genCloakConfig(credentials, container, containerConfig, &e);
|
||||
|
||||
ui->pushButton_share_cloak_copy->setEnabled(true);
|
||||
}
|
||||
|
||||
QJsonObject cloakConfig = QJsonDocument::fromJson(cfg.toUtf8()).object();
|
||||
cloakConfig.remove(config_key::transport_proto);
|
||||
cloakConfig.insert("ProxyMethod", "shadowsocks");
|
||||
|
||||
ui->plainTextEdit_share_cloak->setPlainText(QJsonDocument(cloakConfig).toJson());
|
||||
}
|
||||
|
||||
// Full access
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ QPushButton:hover {
|
|||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>8</number>
|
||||
<number>17</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_start">
|
||||
<widget class="QLabel" name="label_25">
|
||||
|
|
@ -5815,7 +5815,7 @@ QToolBox::tab:hover {
|
|||
<number>0</number>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="tabSpacing">
|
||||
<number>6</number>
|
||||
|
|
@ -5825,8 +5825,8 @@ QToolBox::tab:hover {
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
<width>360</width>
|
||||
<height>360</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
|
|
@ -5884,7 +5884,7 @@ p, li { white-space: pre-wrap; }
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>180</y>
|
||||
<y>260</y>
|
||||
<width>341</width>
|
||||
<height>111</height>
|
||||
</rect>
|
||||
|
|
@ -5947,14 +5947,50 @@ background: #282932;
|
|||
<string>Copy</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_share_full_save">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>180</y>
|
||||
<width>341</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
font-size: 13pt;
|
||||
font: "Open Sans Semibold";
|
||||
color:rgb(212, 212, 212);
|
||||
|
||||
background: #181922;
|
||||
border-radius: 4px;
|
||||
|
||||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
line-height: 21px;
|
||||
|
||||
}
|
||||
QPushButton:hover {
|
||||
background: #282932;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_share_amnezia">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
<width>360</width>
|
||||
<height>360</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
|
|
@ -6149,8 +6185,8 @@ background: #282932;
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
<width>360</width>
|
||||
<height>360</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
|
|
@ -6315,8 +6351,8 @@ background: #282932;
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
<width>360</width>
|
||||
<height>360</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
|
|
@ -6493,10 +6529,10 @@ background: #282932;
|
|||
<widget class="QLabel" name="label_share_ss_qr_code">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>65</x>
|
||||
<y>250</y>
|
||||
<width>240</width>
|
||||
<height>240</height>
|
||||
<x>85</x>
|
||||
<y>235</y>
|
||||
<width>200</width>
|
||||
<height>200</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
|
|
@ -6539,13 +6575,59 @@ color: #15CDCB;
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
<width>360</width>
|
||||
<height>360</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string> Share for Cloak client</string>
|
||||
</attribute>
|
||||
<widget class="QPushButton" name="pushButton_share_cloak_copy">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>290</y>
|
||||
<width>331</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
font-size: 13pt;
|
||||
font: "Open Sans Semibold";
|
||||
color:rgb(212, 212, 212);
|
||||
|
||||
background: #181922;
|
||||
border-radius: 4px;
|
||||
|
||||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
line-height: 21px;
|
||||
|
||||
}
|
||||
QPushButton:hover {
|
||||
background: #282932;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copy</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit_share_cloak">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>331</width>
|
||||
<height>221</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue