website in tor network container improved

Sponsored by "Теплица социальных технологий", 2021
В рамках работы над задачами по хакатону 2021
This commit is contained in:
pokamest 2021-09-24 13:14:35 +03:00
parent 3bcc12869b
commit b244158b95
25 changed files with 676 additions and 295 deletions

View file

@ -74,8 +74,8 @@ void ServerContainersLogic::onPushButtonContinueClicked(DockerContainer c, int p
emit uiLogic()->goToPage(Page::ServerConfiguringProgress);
qApp->processEvents();
ErrorCode e = uiLogic()->serverConfiguringProgressLogic()->doInstallAction([this, c](){
return ServerController::setupContainer(m_settings.serverCredentials(uiLogic()->selectedServerIndex), c);
ErrorCode e = uiLogic()->serverConfiguringProgressLogic()->doInstallAction([this, c, &config](){
return ServerController::setupContainer(m_settings.serverCredentials(uiLogic()->selectedServerIndex), c, config);
});
if (!e) {

View file

@ -51,7 +51,8 @@ QMap<DockerContainer, QJsonObject> WizardLogic::getInstallConfigsFromWizardPage(
void WizardLogic::onPushButtonVpnModeFinishClicked()
{
uiLogic()->installServer(getInstallConfigsFromWizardPage());
auto containers = getInstallConfigsFromWizardPage();
uiLogic()->installServer(containers);
if (checkBoxVpnModeChecked()) {
m_settings.setRouteMode(Settings::VpnOnlyForwardSites);
} else {
@ -61,5 +62,6 @@ void WizardLogic::onPushButtonVpnModeFinishClicked()
void WizardLogic::onPushButtonLowFinishClicked()
{
uiLogic()->installServer(getInstallConfigsFromWizardPage());
auto containers = getInstallConfigsFromWizardPage();
uiLogic()->installServer(containers);
}

View file

@ -88,7 +88,7 @@ void CloakLogic::onPushButtonProtoCloakSaveClicked()
return progressBarProtoCloakResetMaximium();
};
ErrorCode e = uiLogic()->doInstallAction([this, containerConfig, newContainerConfig](){
ErrorCode e = uiLogic()->doInstallAction([this, containerConfig, &newContainerConfig](){
return ServerController::updateContainer(m_settings.serverCredentials(uiLogic()->selectedServerIndex), uiLogic()->selectedDockerContainer, containerConfig, newContainerConfig);
},
page_proto_cloak, progressBar_proto_cloak_reset,

View file

@ -125,7 +125,7 @@ void OpenVpnLogic::onPushButtonProtoOpenVpnSaveClicked()
return progressBarProtoOpenVpnResetMaximium();
};
ErrorCode e = uiLogic()->doInstallAction([this, containerConfig, newContainerConfig](){
ErrorCode e = uiLogic()->doInstallAction([this, containerConfig, &newContainerConfig](){
return ServerController::updateContainer(m_settings.serverCredentials(uiLogic()->selectedServerIndex), uiLogic()->selectedDockerContainer, containerConfig, newContainerConfig);
},
page_proto_openvpn, progressBar_proto_openvpn_reset,

View file

@ -1,7 +1,15 @@
#include <QDesktopServices>
#include <QTimer>
#include <QProcess>
#include <QStorageInfo>
#include "OtherProtocolsLogic.h"
#include "core/servercontroller.h"
#include <functional>
#include "../../uilogic.h"
#include "utils.h"
#include <Windows.h>
using namespace amnezia;
using namespace PageEnumNS;
@ -12,11 +20,23 @@ OtherProtocolsLogic::OtherProtocolsLogic(UiLogic *logic, QObject *parent):
}
OtherProtocolsLogic::~OtherProtocolsLogic()
{
for (QProcess *p: m_sftpMpuntProcesses) {
if (p) Utils::signalCtrl(p->processId(), CTRL_C_EVENT);
if (p) p->kill();
if (p) p->waitForFinished();
if (p) delete p;
}
}
void OtherProtocolsLogic::updateProtocolPage(const QJsonObject &config, DockerContainer container, bool haveAuthData)
{
set_labelTftpUserNameText(config.value(config_key::userName).toString());
set_labelTftpPasswordText(config.value(config_key::password).toString(protocols::sftp::defaultUserName));
set_labelTftpPortText(config.value(config_key::port).toString(protocols::sftp::defaultUserName));
set_labelTftpPortText(config.value(config_key::port).toString());
set_labelTorWebSiteAddressText(config.value(config_key::site).toString());
}
//QJsonObject OtherProtocolsLogic::getProtocolConfigFromPage(QJsonObject oldConfig)
@ -24,7 +44,84 @@ void OtherProtocolsLogic::updateProtocolPage(const QJsonObject &config, DockerCo
//}
void OtherProtocolsLogic::onPushButtonProtoShadowSocksSaveClicked()
void OtherProtocolsLogic::onPushButtonSftpMountDriveClicked()
{
#ifdef Q_OS_WINDOWS
QProcess drivesProc;
drivesProc.start("wmic logicaldisk get caption");
drivesProc.waitForFinished();
QString drives = drivesProc.readAll();
qDebug() << drives;
QString letters = "CFGHIJKLMNOPQRSTUVWXYZ";
QString letter;
for (int i = letters.size() - 1; i > 0; i--) {
letter = letters.at(i);
if (!drives.contains(letter + ":")) break;
}
if (letter == "C:") {
// set err info
qDebug() << "Can't find free drive letter";
return;
}
set_pushButtonSftpMountEnabled(false);
QProcess *p = new QProcess;
m_sftpMpuntProcesses.append(p);
p->setProcessChannelMode(QProcess::MergedChannels);
connect(p, &QProcess::readyRead, this, [this, p, letter](){
QString s = p->readAll();
if (s.contains("The service sshfs has been started")) {
QDesktopServices::openUrl(QUrl("file:///" + letter + ":"));
set_pushButtonSftpMountEnabled(true);
}
});
// QString cmd = QString("net use \\\\sshfs\\%1@51.77.32.168!%2 /USER:%1 %3")
// .arg(labelTftpUserNameText())
// .arg(labelTftpPortText())
// .arg(labelTftpPasswordText());
p->setProgram("C:\\Program Files1\\SSHFS-Win\\bin\\sshfs.exe");
QString host = m_settings.serverCredentials(uiLogic()->selectedServerIndex).hostName;
QString args = QString(
"%1@%2:/ %3: "
"-o port=%4 "
"-f "
"-o reconnect"
"-orellinks "
"-ofstypename=SSHFS "
"-o ssh_command=/usr/bin/ssh.exe "
"-oUserKnownHostsFile=/dev/null "
"-oStrictHostKeyChecking=no "
"-o password_stdin")
.arg(labelTftpUserNameText())
.arg(host)
.arg(letter)
.arg(labelTftpPortText());
p->setNativeArguments(args);
p->start();
p->waitForStarted(50);
if (p->state() != QProcess::Running) {
qDebug() << "onPushButtonSftpMountDriveClicked process not started";
}
else {
p->write((labelTftpPasswordText() + "\n").toUtf8());
}
//qDebug().noquote() << "onPushButtonSftpMountDriveClicked" << args;
#endif
}
void OtherProtocolsLogic::checkBoxSftpRestoreClicked()
{
}

View file

@ -3,6 +3,8 @@
#include "PageProtocolLogicBase.h"
#include <QProcess>
class UiLogic;
class OtherProtocolsLogic : public PageProtocolLogicBase
@ -12,13 +14,18 @@ class OtherProtocolsLogic : public PageProtocolLogicBase
AUTO_PROPERTY(QString, labelTftpUserNameText)
AUTO_PROPERTY(QString, labelTftpPasswordText)
AUTO_PROPERTY(QString, labelTftpPortText)
AUTO_PROPERTY(bool, pushButtonSftpMountEnabled)
AUTO_PROPERTY(bool, checkBoxSftpRestoreChecked)
AUTO_PROPERTY(QString, labelTorWebSiteAddressText)
public:
Q_INVOKABLE void onPushButtonProtoShadowSocksSaveClicked();
Q_INVOKABLE void onPushButtonSftpMountDriveClicked();
Q_INVOKABLE void checkBoxSftpRestoreClicked();
public:
explicit OtherProtocolsLogic(UiLogic *uiLogic, QObject *parent = nullptr);
~OtherProtocolsLogic() = default;
~OtherProtocolsLogic();
void updateProtocolPage(const QJsonObject &config, DockerContainer container, bool haveAuthData) override;
//QJsonObject getProtocolConfigFromPage(QJsonObject oldConfig) override;
@ -27,5 +34,7 @@ private:
Settings m_settings;
UiLogic *m_uiLogic;
QList <QProcess *> m_sftpMpuntProcesses;
};
#endif // OTHER_PROTOCOLS_LOGIC_H

View file

@ -82,7 +82,7 @@ void ShadowSocksLogic::onPushButtonProtoShadowSocksSaveClicked()
return progressBarProtoShadowSocksResetMaximium();
};
ErrorCode e = uiLogic()->doInstallAction([this, containerConfig, newContainerConfig](){
ErrorCode e = uiLogic()->doInstallAction([this, containerConfig, &newContainerConfig](){
return ServerController::updateContainer(m_settings.serverCredentials(uiLogic()->selectedServerIndex), uiLogic()->selectedDockerContainer, containerConfig, newContainerConfig);
},
page_proto_shadowsocks, progressBar_proto_shadowsocks_reset,

View file

@ -43,7 +43,13 @@ PageBase {
onContainerSelected: {
var containerProto = ContainerProps.defaultProtocol(c_index)
tf_port_num.text = ProtocolProps.defaultPort(containerProto)
if (ProtocolProps.defaultPort(containerProto) < 0) {
tf_port_num.enabled = false
tf_port_num.text = qsTr("Default")
}
else tf_port_num.text = ProtocolProps.defaultPort(containerProto)
cb_port_proto.currentIndex = ProtocolProps.defaultTransportProto(containerProto)
tf_port_num.enabled = ProtocolProps.defaultPortChangeable(containerProto)

View file

@ -19,294 +19,386 @@ PageProtocolBase {
text: qsTr("OpenVPN Settings")
}
Item {
enabled: logic.pageEnabled
Flickable {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: parent.bottom
width: parent.width
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
LabelType {
id: lb_subnet
x: 30
contentHeight: content.height
clip: true
ColumnLayout {
id: content
enabled: logic.pageEnabled
anchors.top: parent.top
width: parent.width
height: 21
text: qsTr("VPN Addresses Subnet")
}
TextFieldType {
id: tf_subnet
x: 30
anchors.top: lb_subnet.bottom
width: parent.width - 60
height: 31
text: logic.lineEditProtoOpenVpnSubnetText
onEditingFinished: {
logic.lineEditProtoOpenVpnSubnetText = text
}
}
//
LabelType {
id: lb_proto
x: 30
anchors.top: tf_subnet.bottom
width: parent.width
height: 21
text: qsTr("Network protocol")
}
Rectangle {
id: rect_proto
x: 30
anchors.top: lb_proto.bottom
width: parent.width - 60
height: 71
border.width: 1
border.color: "lightgray"
radius: 2
RadioButtonType {
x: 10
y: 40
width: 171
height: 19
text: qsTr("TCP")
enabled: logic.radioButtonProtoOpenVpnTcpEnabled
checked: logic.radioButtonProtoOpenVpnTcpChecked
onCheckedChanged: {
UiLogic.radioButtonProtoOpenVpnTcpChecked = checked
}
}
RadioButtonType {
x: 10
y: 10
width: 171
height: 19
text: qsTr("UDP")
checked: logic.radioButtonProtoOpenVpnUdpChecked
onCheckedChanged: {
logic.radioButtonProtoOpenVpnUdpChecked = checked
}
enabled: logic.radioButtonProtoOpenVpnUdpEnabled
}
}
//
LabelType {
id: lb_port
anchors.top: rect_proto.bottom
anchors.topMargin: 20
x: 30
width: root.width / 2 - 10
height: 31
text: qsTr("Port")
}
TextFieldType {
id: tf_port
anchors.top: rect_proto.bottom
anchors.topMargin: 20
anchors.left: parent.horizontalCenter
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 30
height: 31
text: logic.lineEditProtoOpenVpnPortText
onEditingFinished: {
logic.lineEditProtoOpenVpnPortText = text
LabelType {
id: lb_subnet
height: 21
text: qsTr("VPN Addresses Subnet")
}
enabled: logic.lineEditProtoOpenVpnPortEnabled
}
TextFieldType {
id: tf_subnet
//
CheckBoxType {
id: check_auto_enc
anchors.top: lb_port.bottom
anchors.topMargin: 20
x: 30
width: parent.width
height: 21
text: qsTr("Auto-negotiate encryption")
checked: logic.checkBoxProtoOpenVpnAutoEncryptionChecked
onCheckedChanged: {
logic.checkBoxProtoOpenVpnAutoEncryptionChecked = checked
implicitWidth: parent.width
height: 31
text: logic.lineEditProtoOpenVpnSubnetText
onEditingFinished: {
logic.lineEditProtoOpenVpnSubnetText = text
}
}
onClicked: {
logic.checkBoxProtoOpenVpnAutoEncryptionClicked()
//
LabelType {
id: lb_proto
Layout.topMargin: 20
height: 21
text: qsTr("Network protocol")
}
}
//
LabelType {
id: lb_cipher
x: 30
anchors.top: check_auto_enc.bottom
anchors.topMargin: 20
width: parent.width
height: 21
text: qsTr("Cipher")
}
ComboBoxType {
id: cb_cipher
x: 30
anchors.top: lb_cipher.bottom
width: parent.width - 60
height: 31
model: [
qsTr("AES-256-GCM"),
qsTr("AES-192-GCM"),
qsTr("AES-128-GCM"),
qsTr("AES-256-CBC"),
qsTr("AES-192-CBC"),
qsTr("AES-128-CBC"),
qsTr("ChaCha20-Poly1305"),
qsTr("ARIA-256-CBC"),
qsTr("CAMELLIA-256-CBC"),
qsTr("none")
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (logic.comboBoxProtoOpenVpnCipherText === model[i]) {
return i
Rectangle {
id: rect_proto
implicitWidth: root.width - 60
height: 71
border.width: 1
border.color: "lightgray"
radius: 2
RadioButtonType {
x: 10
y: 40
width: 171
height: 19
text: qsTr("TCP")
enabled: logic.radioButtonProtoOpenVpnTcpEnabled
checked: logic.radioButtonProtoOpenVpnTcpChecked
onCheckedChanged: {
UiLogic.radioButtonProtoOpenVpnTcpChecked = checked
}
}
return -1
RadioButtonType {
x: 10
y: 10
width: 171
height: 19
text: qsTr("UDP")
checked: logic.radioButtonProtoOpenVpnUdpChecked
onCheckedChanged: {
logic.radioButtonProtoOpenVpnUdpChecked = checked
}
enabled: logic.radioButtonProtoOpenVpnUdpEnabled
}
}
onCurrentTextChanged: {
logic.comboBoxProtoOpenVpnCipherText = currentText
//
RowLayout {
Layout.topMargin: 10
Layout.fillWidth: true
LabelType {
id: lb_port
height: 31
text: qsTr("Port")
Layout.preferredWidth: root.width / 2 - 10
}
TextFieldType {
id: tf_port
Layout.fillWidth: true
height: 31
text: logic.lineEditProtoOpenVpnPortText
onEditingFinished: {
logic.lineEditProtoOpenVpnPortText = text
}
enabled: logic.lineEditProtoOpenVpnPortEnabled
}
}
enabled: logic.comboBoxProtoOpenVpnCipherEnabled
}
//
LabelType {
id: lb_hash
anchors.top: cb_cipher.bottom
anchors.topMargin: 20
width: parent.width
height: 21
text: qsTr("Hash")
}
ComboBoxType {
id: cb_hash
x: 30
height: 31
anchors.top: lb_hash.bottom
width: parent.width - 60
model: [
qsTr("SHA512"),
qsTr("SHA384"),
qsTr("SHA256"),
qsTr("SHA3-512"),
qsTr("SHA3-384"),
qsTr("SHA3-256"),
qsTr("whirlpool"),
qsTr("BLAKE2b512"),
qsTr("BLAKE2s256"),
qsTr("SHA1")
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (logic.comboBoxProtoOpenVpnHashText === model[i]) {
return i
//
CheckBoxType {
id: check_auto_enc
implicitWidth: parent.width
height: 21
text: qsTr("Auto-negotiate encryption")
checked: logic.checkBoxProtoOpenVpnAutoEncryptionChecked
onCheckedChanged: {
logic.checkBoxProtoOpenVpnAutoEncryptionChecked = checked
}
onClicked: {
logic.checkBoxProtoOpenVpnAutoEncryptionClicked()
}
}
//
LabelType {
id: lb_cipher
height: 21
text: qsTr("Cipher")
}
ComboBoxType {
id: cb_cipher
implicitWidth: parent.width
height: 31
model: [
qsTr("AES-256-GCM"),
qsTr("AES-192-GCM"),
qsTr("AES-128-GCM"),
qsTr("AES-256-CBC"),
qsTr("AES-192-CBC"),
qsTr("AES-128-CBC"),
qsTr("ChaCha20-Poly1305"),
qsTr("ARIA-256-CBC"),
qsTr("CAMELLIA-256-CBC"),
qsTr("none")
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (logic.comboBoxProtoOpenVpnCipherText === model[i]) {
return i
}
}
return -1
}
onCurrentTextChanged: {
logic.comboBoxProtoOpenVpnCipherText = currentText
}
enabled: logic.comboBoxProtoOpenVpnCipherEnabled
}
//
LabelType {
id: lb_hash
height: 21
Layout.topMargin: 20
text: qsTr("Hash")
}
ComboBoxType {
id: cb_hash
height: 31
implicitWidth: parent.width
model: [
qsTr("SHA512"),
qsTr("SHA384"),
qsTr("SHA256"),
qsTr("SHA3-512"),
qsTr("SHA3-384"),
qsTr("SHA3-256"),
qsTr("whirlpool"),
qsTr("BLAKE2b512"),
qsTr("BLAKE2s256"),
qsTr("SHA1")
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (logic.comboBoxProtoOpenVpnHashText === model[i]) {
return i
}
}
return -1
}
onCurrentTextChanged: {
logic.comboBoxProtoOpenVpnHashText = currentText
}
enabled: logic.comboBoxProtoOpenVpnHashEnabled
}
CheckBoxType {
id: check_tls
implicitWidth: parent.width
Layout.topMargin: 20
height: 21
text: qsTr("Enable TLS auth")
checked: logic.checkBoxProtoOpenVpnTlsAuthChecked
onCheckedChanged: {
logic.checkBoxProtoOpenVpnTlsAuthChecked = checked
}
}
CheckBoxType {
id: check_block_dns
implicitWidth: parent.width
height: 21
text: qsTr("Block DNS requests outside of VPN")
checked: logic.checkBoxProtoOpenVpnBlockDnsChecked
onCheckedChanged: {
logic.checkBoxProtoOpenVpnBlockDnsChecked = checked
}
}
BasicButtonType {
id: pb_client_config
implicitWidth: parent.width
height: 21
text: qsTr("Additional client config commands →")
background: Item {
anchors.fill: parent
}
contentItem: Text {
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#15CDCB";
text: pb_client_config.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
antialiasing: true
checkable: true
checked: StartPageLogic.pushButtonConnectKeyChecked
}
Rectangle {
id: rect_client_conf
implicitWidth: root.width - 60
height: 101
border.width: 1
border.color: "lightgray"
radius: 2
visible: pb_client_config.checked
ScrollView {
anchors.fill: parent
TextArea {
id: te_client_config
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#181922"
}
}
return -1
}
onCurrentTextChanged: {
logic.comboBoxProtoOpenVpnHashText = currentText
}
enabled: logic.comboBoxProtoOpenVpnHashEnabled
}
CheckBoxType {
id: check_tls
x: 30
anchors.top: cb_hash.bottom
anchors.topMargin: 20
width: parent.width
height: 21
text: qsTr("Enable TLS auth")
checked: logic.checkBoxProtoOpenVpnTlsAuthChecked
onCheckedChanged: {
logic.checkBoxProtoOpenVpnTlsAuthChecked = checked
}
}
CheckBoxType {
id: check_block_dns
x: 30
anchors.top: check_tls.bottom
anchors.topMargin: 20
width: parent.width
height: 21
text: qsTr("Block DNS requests outside of VPN")
checked: logic.checkBoxProtoOpenVpnBlockDnsChecked
onCheckedChanged: {
logic.checkBoxProtoOpenVpnBlockDnsChecked = checked
}
}
BasicButtonType {
id: pb_server_config
// LabelType {
// id: label_proto_openvpn_info
// x: 30
// y: 550
// width: 321
// height: 41
// visible: logic.labelProtoOpenVpnInfoVisible
// text: logic.labelProtoOpenVpnInfoText
// }
ProgressBar {
id: progress_save
anchors.horizontalCenter: parent.horizontalCenter
y: 500
width: 321
height: 40
from: 0
to: logic.progressBarProtoOpenVpnResetMaximium
value: logic.progressBarProtoOpenVpnResetValue
visible: logic.progressBarProtoOpenVpnResetVisible
background: Rectangle {
implicitWidth: parent.width
implicitHeight: parent.height
color: "#100A44"
radius: 4
}
contentItem: Item {
implicitWidth: parent.width
implicitHeight: parent.height
Rectangle {
width: progress_save.visualPosition * parent.width
height: parent.height
radius: 4
color: Qt.rgba(255, 255, 255, 0.15);
height: 21
text: qsTr("Additional client config commands →")
background: Item {
anchors.fill: parent
}
contentItem: Text {
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#15CDCB";
text: pb_client_config.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
antialiasing: true
checkable: true
checked: StartPageLogic.pushButtonConnectKeyChecked
}
}
BlueButtonType {
id: pb_save
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 20
x: 30
width: parent.width - 60
height: 40
text: qsTr("Save and restart VPN")
visible: logic.pushButtonOpenvpnSaveVisible
onClicked: {
logic.onPushButtonProtoOpenVpnSaveClicked()
Rectangle {
id: rect_server_conf
implicitWidth: root.width - 60
height: 101
border.width: 1
border.color: "lightgray"
radius: 2
visible: pb_server_config.checked
ScrollView {
anchors.fill: parent
TextArea {
id: te_server_config
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#181922"
}
}
}
LabelType {
id: label_proto_openvpn_info
height: 41
visible: logic.labelProtoOpenVpnInfoVisible
text: logic.labelProtoOpenVpnInfoText
}
Rectangle {
id: it_save
implicitWidth: parent.width
Layout.topMargin: 20
height: 40
BlueButtonType {
id: pb_save
z: 1
height: 40
text: qsTr("Save and restart VPN")
width: parent.width
visible: logic.pushButtonOpenvpnSaveVisible
onClicked: {
logic.onPushButtonProtoOpenVpnSaveClicked()
}
}
ProgressBar {
id: progress_save
anchors.fill: pb_save
from: 0
to: logic.progressBarProtoOpenVpnResetMaximium
value: logic.progressBarProtoOpenVpnResetValue
visible: logic.progressBarProtoOpenVpnResetVisible
background: Rectangle {
implicitWidth: parent.width
implicitHeight: parent.height
color: "#100A44"
radius: 4
}
contentItem: Item {
implicitWidth: parent.width
implicitHeight: parent.height
Rectangle {
width: progress_save.visualPosition * parent.width
height: parent.height
radius: 4
color: Qt.rgba(255, 255, 255, 0.15);
}
}
}
}
}
}
}

View file

@ -37,7 +37,8 @@ PageProtocolBase {
horizontalItemAlignment: Grid.AlignHCenter
verticalItemAlignment: Grid.AlignVCenter
topPadding: 5
leftPadding: 10
leftPadding: 30
rightPadding: 30
spacing: 5
@ -76,4 +77,61 @@ PageProtocolBase {
}
}
LabelType {
anchors.bottom: check_persist.top
anchors.bottomMargin: 10
width: parent.width - 60
x: 30
font.pixelSize: 14
textFormat: Text.RichText
MouseArea {
anchors.fill: parent
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
acceptedButtons: Qt.NoButton
}
// text: "In order to mount remote SFTP folder as local drive, perform following steps:
//- Install the latest version of WinFsp [https://github.com/billziss-gh/winfsp/releases/latest].
//- Install the latest version of SSHFS-Win. Choose the x64 or x86 installer according to your computer's architecture [https://github.com/billziss-gh/sshfs-win/releases]"
onLinkActivated: Qt.openUrlExternally(link)
text:"In order to mount remote SFTP folder as local drive, perform following steps:
<ul>
<li>Install the latest version of <a href=\"https://github.com/billziss-gh/winfsp/releases/latest\">WinFsp</a>.</li>
<li>Install the latest version of <a href=\"https://github.com/billziss-gh/sshfs-win/releases\">SSHFS-Win</a>. Choose the x64 or x86 installer according to your computer's architecture.</li>
</ul>"
}
CheckBoxType {
id: check_persist
anchors.bottom: pb_mount.top
anchors.bottomMargin: 10
x: 30
width: parent.width
height: 21
text: qsTr("Restore drive after restart")
checked: logic.checkBoxSftpRestoreChecked
onCheckedChanged: {
logic.checkBoxSftpRestoreChecked = checked
}
onClicked: {
logic.checkBoxSftpRestoreClicked()
}
}
BlueButtonType {
id: pb_mount
enabled: logic.pushButtonSftpMountEnabled
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 20
x: 30
width: parent.width - 60
height: 40
text: qsTr("Mount drive")
onClicked: {
logic.onPushButtonSftpMountDriveClicked()
}
}
}

View file

@ -0,0 +1,58 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import ProtocolEnum 1.0
import "../"
import "../../Controls"
import "../../Config"
PageProtocolBase {
id: root
protocol: ProtocolEnum.TorWebSite
logic: UiLogic.protocolLogic(protocol)
BackButton {
id: back
}
Caption {
id: caption
text: qsTr("TOR Web site settings")
}
Rectangle {
id: frame_settings
width: parent.width
anchors.top: caption.bottom
anchors.topMargin: 10
border.width: 1
border.color: "lightgray"
anchors.bottomMargin: 5
anchors.horizontalCenter: parent.horizontalCenter
radius: 2
Grid {
id: grid
anchors.fill: parent
columns: 2
horizontalItemAlignment: Grid.AlignHCenter
verticalItemAlignment: Grid.AlignVCenter
topPadding: 5
leftPadding: 30
rightPadding: 30
spacing: 5
LabelType {
width: 130
text: qsTr("Web site onion address")
}
TextFieldType {
id: tf_site_address
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
text: logic.labelTorWebSiteAddressText
readOnly: true
}
}
}
}

View file

@ -100,6 +100,7 @@ UiLogic::UiLogic(QObject *parent) :
m_protocolLogicMap.insert(Protocol::Dns, new OtherProtocolsLogic(this));
m_protocolLogicMap.insert(Protocol::Sftp, new OtherProtocolsLogic(this));
m_protocolLogicMap.insert(Protocol::TorWebSite, new OtherProtocolsLogic(this));
}
@ -138,7 +139,7 @@ void UiLogic::initalizeUiLogic()
selectedServerIndex = m_settings.defaultServerIndex();
//goToPage(Page::ServerContainers, true, false);
//goToPage(Page::NewServerProtocols, true, false);
onGotoProtocolPage(Protocol::OpenVpn);
//onGotoProtocolPage(Protocol::OpenVpn);
//ui->pushButton_general_settings_exit->hide();
@ -399,7 +400,7 @@ QString UiLogic::containerDesc(int container)
void UiLogic::installServer(const QMap<DockerContainer, QJsonObject> &containers)
void UiLogic::installServer(QMap<DockerContainer, QJsonObject> &containers)
{
if (containers.isEmpty()) return;
@ -473,7 +474,7 @@ void UiLogic::installServer(const QMap<DockerContainer, QJsonObject> &containers
}
bool UiLogic::installContainers(ServerCredentials credentials,
const QMap<DockerContainer, QJsonObject> &containers,
QMap<DockerContainer, QJsonObject> &containers,
const PageFunc &page,
const ProgressFunc &progress,
const ButtonFunc &button,
@ -496,7 +497,7 @@ bool UiLogic::installContainers(ServerCredentials credentials,
}
int cnt = 0;
for (QMap<DockerContainer, QJsonObject>::const_iterator i = containers.constBegin(); i != containers.constEnd(); i++, cnt++) {
for (QMap<DockerContainer, QJsonObject>::iterator i = containers.begin(); i != containers.end(); i++, cnt++) {
QTimer timer;
connect(&timer, &QTimer::timeout, [progress](){
progress.setValueFunc(progress.getValueFunc() + 1);

View file

@ -35,6 +35,8 @@ class OpenVpnLogic;
class ShadowSocksLogic;
class CloakLogic;
class OtherProtocolsLogic;
class VpnConnection;
@ -78,6 +80,8 @@ public:
friend class ShadowSocksLogic;
friend class CloakLogic;
friend class OtherProtocolsLogic;
Q_INVOKABLE void initalizeUiLogic();
Q_INVOKABLE void onCloseWindow();
@ -128,7 +132,9 @@ private:
QString m_dialogConnectErrorText;
private slots:
void installServer(const QMap<DockerContainer, QJsonObject> &containers);
// containers - INOUT arg
void installServer(QMap<DockerContainer, QJsonObject> &containers);
void setTrayState(VpnProtocol::ConnectionState state);
private:
@ -153,7 +159,7 @@ private:
};
bool installContainers(ServerCredentials credentials,
const QMap<DockerContainer, QJsonObject> &containers,
QMap<DockerContainer, QJsonObject> &containers,
const PageFunc& page,
const ProgressFunc& progress,
const ButtonFunc& button,