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

@ -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
}
}
}
}