2023-07-13 11:29:26 +09:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
|
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
2023-12-01 14:16:27 +07:00
|
|
|
import PageEnum 1.0
|
2024-08-20 16:54:05 +07:00
|
|
|
import Style 1.0
|
2023-12-01 14:16:27 +07:00
|
|
|
|
2023-07-13 11:29:26 +09:00
|
|
|
import "./"
|
|
|
|
|
import "../Controls2"
|
|
|
|
|
import "../Controls2/TextTypes"
|
|
|
|
|
import "../Config"
|
|
|
|
|
import "../Components"
|
|
|
|
|
|
|
|
|
|
PageType {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
ColumnLayout {
|
2024-04-18 17:54:55 +04:00
|
|
|
id: backButtonLayout
|
2023-07-13 11:29:26 +09:00
|
|
|
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
|
|
|
|
anchors.topMargin: 20
|
|
|
|
|
|
|
|
|
|
BackButtonType {
|
2024-04-18 17:54:55 +04:00
|
|
|
id: backButton
|
2023-07-13 11:29:26 +09:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FlickableType {
|
|
|
|
|
id: fl
|
2024-04-18 17:54:55 +04:00
|
|
|
anchors.top: backButtonLayout.bottom
|
2023-07-13 11:29:26 +09:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
contentHeight: content.implicitHeight
|
|
|
|
|
|
|
|
|
|
Column {
|
|
|
|
|
id: content
|
|
|
|
|
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
2024-02-19 19:54:15 +05:00
|
|
|
enabled: ServersModel.isProcessedServerHasWriteAccess()
|
2023-07-14 13:14:50 +09:00
|
|
|
|
2023-07-13 11:29:26 +09:00
|
|
|
ListView {
|
|
|
|
|
id: listview
|
|
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
property int selectedIndex: 0
|
|
|
|
|
|
2023-07-13 11:29:26 +09:00
|
|
|
width: parent.width
|
|
|
|
|
height: listview.contentItem.height
|
|
|
|
|
|
|
|
|
|
clip: true
|
2024-12-31 04:16:52 +01:00
|
|
|
reuseItems: true
|
2023-07-13 11:29:26 +09:00
|
|
|
|
|
|
|
|
model: CloakConfigModel
|
|
|
|
|
|
|
|
|
|
delegate: Item {
|
|
|
|
|
implicitWidth: listview.width
|
|
|
|
|
implicitHeight: col.implicitHeight
|
|
|
|
|
|
2024-02-17 23:09:05 +02:00
|
|
|
property alias trafficFromField: trafficFromField
|
|
|
|
|
|
2023-07-13 11:29:26 +09:00
|
|
|
ColumnLayout {
|
|
|
|
|
id: col
|
|
|
|
|
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
|
|
|
|
anchors.leftMargin: 16
|
|
|
|
|
anchors.rightMargin: 16
|
|
|
|
|
|
|
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
|
|
HeaderType {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
|
|
headerText: qsTr("Cloak settings")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextFieldWithHeaderType {
|
2024-02-17 23:09:05 +02:00
|
|
|
id: trafficFromField
|
|
|
|
|
|
2023-07-13 11:29:26 +09:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.topMargin: 32
|
|
|
|
|
|
2023-07-31 12:54:59 +09:00
|
|
|
headerText: qsTr("Disguised as traffic from")
|
2025-01-24 23:27:01 +07:00
|
|
|
textField.text: site
|
2023-07-13 11:29:26 +09:00
|
|
|
|
|
|
|
|
textField.onEditingFinished: {
|
2025-01-24 23:27:01 +07:00
|
|
|
if (textField.text !== site) {
|
|
|
|
|
var tmpText = textField.text
|
2023-09-08 21:31:47 +08:00
|
|
|
tmpText = tmpText.toLocaleLowerCase()
|
|
|
|
|
|
|
|
|
|
var indexHttps = tmpText.indexOf("https://")
|
|
|
|
|
if (indexHttps === 0) {
|
2025-01-24 23:27:01 +07:00
|
|
|
tmpText = textField.text.substring(8)
|
2023-09-08 21:31:47 +08:00
|
|
|
} else {
|
2025-01-24 23:27:01 +07:00
|
|
|
site = textField.text
|
2023-09-08 21:31:47 +08:00
|
|
|
}
|
2023-07-13 11:29:26 +09:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextFieldWithHeaderType {
|
2024-02-17 23:09:05 +02:00
|
|
|
id: portTextField
|
|
|
|
|
|
2023-07-13 11:29:26 +09:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.topMargin: 16
|
|
|
|
|
|
|
|
|
|
headerText: qsTr("Port")
|
2025-01-24 23:27:01 +07:00
|
|
|
textField.text: port
|
2023-08-16 12:11:34 +05:00
|
|
|
textField.maximumLength: 5
|
2023-08-28 14:18:41 +03:00
|
|
|
textField.validator: IntValidator { bottom: 1; top: 65535 }
|
2023-07-13 11:29:26 +09:00
|
|
|
|
|
|
|
|
textField.onEditingFinished: {
|
2025-01-24 23:27:01 +07:00
|
|
|
if (textField.text !== port) {
|
|
|
|
|
port = textField.text
|
2023-07-13 11:29:26 +09:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DropDownType {
|
|
|
|
|
id: cipherDropDown
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.topMargin: 16
|
|
|
|
|
|
|
|
|
|
descriptionText: qsTr("Cipher")
|
|
|
|
|
headerText: qsTr("Cipher")
|
|
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
drawerParent: root
|
|
|
|
|
|
2023-08-16 22:45:05 +05:00
|
|
|
listView: ListViewWithRadioButtonType {
|
2023-07-13 11:29:26 +09:00
|
|
|
id: cipherListView
|
|
|
|
|
|
|
|
|
|
rootWidth: root.width
|
|
|
|
|
|
|
|
|
|
model: ListModel {
|
|
|
|
|
ListElement { name : "chacha20-ietf-poly1305" }
|
|
|
|
|
ListElement { name : "xchacha20-ietf-poly1305" }
|
|
|
|
|
ListElement { name : "aes-256-gcm" }
|
|
|
|
|
ListElement { name : "aes-192-gcm" }
|
|
|
|
|
ListElement { name : "aes-128-gcm" }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clickedFunction: function() {
|
|
|
|
|
cipherDropDown.text = selectedText
|
|
|
|
|
cipher = cipherDropDown.text
|
2024-12-31 04:16:52 +01:00
|
|
|
cipherDropDown.closeTriggered()
|
2023-07-13 11:29:26 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
|
cipherDropDown.text = cipher
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < cipherListView.model.count; i++) {
|
|
|
|
|
if (cipherListView.model.get(i).name === cipherDropDown.text) {
|
2024-12-31 04:16:52 +01:00
|
|
|
selectedIndex = i
|
2023-07-13 11:29:26 +09:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BasicButtonType {
|
2024-02-17 23:09:05 +02:00
|
|
|
id: saveRestartButton
|
|
|
|
|
|
2023-07-13 11:29:26 +09:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.topMargin: 24
|
|
|
|
|
Layout.bottomMargin: 24
|
|
|
|
|
|
2024-03-18 12:41:53 +02:00
|
|
|
text: qsTr("Save")
|
2023-07-13 11:29:26 +09:00
|
|
|
|
2024-02-17 23:09:05 +02:00
|
|
|
clickedFunc: function() {
|
2023-07-13 11:29:26 +09:00
|
|
|
forceActiveFocus()
|
2024-04-18 14:49:57 +03:00
|
|
|
|
|
|
|
|
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ContainersModel.getProcessedContainerIndex()) {
|
|
|
|
|
PageController.showNotificationMessage(qsTr("Unable change settings while there is an active connection"))
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-01 14:16:27 +07:00
|
|
|
PageController.goToPage(PageEnum.PageSetupWizardInstalling);
|
2023-07-13 11:29:26 +09:00
|
|
|
InstallController.updateContainer(CloakConfigModel.getConfig())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|