mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-10-23 03:26:59 +09:00
* Feat: split xray client and server settings * remove test logs * in-place save and TLS pin * fixed xhttp/mkcp + tls * remove check version xray in start connect * address review findings for the settings split * reset namespace * reset namespace * remove template xray * fix: stop xray defaults from overwriting entered settings * revert dropdown selection refactor from the defaults fix * move save 'updateServerConfig' * remove comment
142 lines
4.7 KiB
QML
142 lines
4.7 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
|
|
import PageEnum 1.0
|
|
import ProtocolEnum 1.0
|
|
import Style 1.0
|
|
|
|
import "./"
|
|
import "../Controls2"
|
|
import "../Controls2/TextTypes"
|
|
import "../Config"
|
|
import "../Components"
|
|
|
|
PageType {
|
|
id: root
|
|
|
|
BackButtonType {
|
|
id: backButton
|
|
anchors.top: parent.top
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.topMargin: 20 + PageController.safeAreaTopMargin
|
|
}
|
|
|
|
ListViewType {
|
|
id: listView
|
|
anchors.top: backButton.bottom
|
|
anchors.bottom: saveButton.visible ? saveButton.top : parent.bottom
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
|
|
enabled: ServersUiController.isProcessedServerHasWriteAccess()
|
|
model: XrayConfigModel
|
|
|
|
delegate: ColumnLayout {
|
|
width: listView.width
|
|
spacing: 0
|
|
|
|
// xtls-rprx-vision requires the RAW (TCP) transport; it is invalid with XHTTP / mKCP.
|
|
readonly property bool visionAllowed: transport === "" || transport === "raw"
|
|
|
|
BaseHeaderType {
|
|
Layout.fillWidth: true
|
|
Layout.leftMargin: 16
|
|
Layout.rightMargin: 16
|
|
Layout.topMargin: 0
|
|
Layout.bottomMargin: 24
|
|
headerText: qsTr("Flow")
|
|
}
|
|
|
|
VerticalRadioButton {
|
|
Layout.fillWidth: true
|
|
Layout.leftMargin: 16
|
|
Layout.rightMargin: 16
|
|
text: qsTr("Empty")
|
|
checked: flow === "" || !visionAllowed
|
|
onClicked: flow = ""
|
|
}
|
|
|
|
DividerType {
|
|
}
|
|
|
|
VerticalRadioButton {
|
|
Layout.fillWidth: true
|
|
Layout.leftMargin: 16
|
|
Layout.rightMargin: 16
|
|
text: "xtls-rprx-vision"
|
|
enabled: visionAllowed
|
|
checked: flow === "xtls-rprx-vision" && visionAllowed
|
|
onClicked: flow = "xtls-rprx-vision"
|
|
}
|
|
|
|
DividerType {
|
|
}
|
|
|
|
VerticalRadioButton {
|
|
Layout.fillWidth: true
|
|
Layout.leftMargin: 16
|
|
Layout.rightMargin: 16
|
|
text: "xtls-rprx-vision-udp443"
|
|
descriptionText: qsTr("For apps that require QUIC. Browsers may stop loading.")
|
|
enabled: visionAllowed
|
|
checked: flow === "xtls-rprx-vision-udp443" && visionAllowed
|
|
onClicked: flow = "xtls-rprx-vision-udp443"
|
|
}
|
|
|
|
DividerType {
|
|
}
|
|
|
|
CaptionTextType {
|
|
Layout.fillWidth: true
|
|
Layout.leftMargin: 16
|
|
Layout.rightMargin: 16
|
|
Layout.topMargin: 8
|
|
visible: !visionAllowed
|
|
color: AmneziaStyle.color.goldenApricot
|
|
text: qsTr("xtls-rprx-vision is available only with the RAW (TCP) transport.")
|
|
}
|
|
|
|
Item {
|
|
Layout.preferredHeight: 16
|
|
}
|
|
}
|
|
}
|
|
|
|
BasicButtonType {
|
|
id: saveButton
|
|
|
|
anchors.left: root.left
|
|
anchors.right: root.right
|
|
anchors.bottom: root.bottom
|
|
anchors.leftMargin: 16
|
|
anchors.rightMargin: 16
|
|
anchors.bottomMargin: 16 + PageController.safeAreaBottomMargin
|
|
|
|
visible: listView.enabled && XrayConfigModel.hasUnsavedChanges
|
|
enabled: visible
|
|
text: qsTr("Save")
|
|
clickedFunc: function () {
|
|
var headerText = qsTr("Save settings?")
|
|
var descriptionText = XrayConfigModel.saveDescription("")
|
|
var yesButtonText = qsTr("Continue")
|
|
var noButtonText = qsTr("Cancel")
|
|
var yesButtonFunction = function () {
|
|
if (ConnectionController.isConnected && ServersUiController.serverDefaultContainer(ServersUiController.defaultServerId) === ServersUiController.processedContainerIndex) {
|
|
PageController.showNotificationMessage(qsTr("Unable change settings while there is an active connection"))
|
|
return
|
|
}
|
|
PageController.goToPage(PageEnum.PageSetupWizardInstalling)
|
|
InstallController.updateServerConfig(ServersUiController.processedServerId, ServersUiController.processedContainerIndex, ProtocolEnum.Xray)
|
|
}
|
|
var noButtonFunction = function () {
|
|
if (typeof GC !== "undefined" && !GC.isMobile()) {
|
|
saveButton.forceActiveFocus()
|
|
}
|
|
}
|
|
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
|
|
}
|
|
}
|
|
}
|