diff --git a/CMakeLists.txt b/CMakeLists.txt index 23697fc..71bb392 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ execute_process( set(QT_IMPORTS_DIR "lib/${ARCH_TRIPLET}") set(APP_NAME "Pantalaimon UT") -set(APP_VERSION "0.3.0") +set(APP_VERSION "0.4.0") set(PROJECT_NAME "pantalaimon") set(FULL_PROJECT_NAME "pantalaimon.thrrgilag") set(CMAKE_INSTALL_PREFIX /) diff --git a/po/pantalaimon.thrrgilag.pot b/po/pantalaimon.thrrgilag.pot index 3d7f667..d5e0b9a 100644 --- a/po/pantalaimon.thrrgilag.pot +++ b/po/pantalaimon.thrrgilag.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: pantalaimon.thrrgilag\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-09 22:57+0000\n" +"POT-Creation-Date: 2020-09-03 22:00+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,24 +17,58 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../qml/Components/EditServerPage.qml:19 +#: ../qml/Components/EditServerPage.qml:21 msgid "Homeserver Configuration" msgstr "" -#: ../qml/Components/EditServerPage.qml:24 +#: ../qml/Components/EditServerPage.qml:26 msgid "Save" msgstr "" -#: ../qml/Components/EditServerPage.qml:89 -msgid "Description:" +#: ../qml/Components/EditServerPage.qml:96 +msgid "InstanceName" msgstr "" -#: ../qml/Components/EditServerPage.qml:109 -msgid "Homeserver URL:" +#: ../qml/Components/EditServerPage.qml:118 +msgid "Homeserver" msgstr "" -#: ../qml/Components/EditServerPage.qml:131 -msgid "Listen on 127.0.0.1:" +#: ../qml/Components/EditServerPage.qml:140 +msgid "" +"The URI of the homeserver that the pantalaimon proxy should forward requests " +"to, without the matrix API path but including the http(s) schema." +msgstr "" + +#: ../qml/Components/EditServerPage.qml:156 +msgid "ListenPort" +msgstr "" + +#: ../qml/Components/EditServerPage.qml:177 +msgid "" +"The port where the daemon will listen to client connections for this " +"homeserver. Note that the listen address/port combination needs to be unique " +"between different homeservers. Defaults to '8009'." +msgstr "" + +#: ../qml/Components/EditServerPage.qml:193 +msgid "Proxy" +msgstr "" + +#: ../qml/Components/EditServerPage.qml:214 +msgid "" +"The URI of a HTTP proxy that the daemon should use when making requests to " +"the homeserver. pantalaimon only supports HTTP proxies. The default is to " +"make a direct connection to the homeserver." +msgstr "" + +#: ../qml/Components/EditServerPage.qml:230 +msgid "SSL" +msgstr "" + +#: ../qml/Components/EditServerPage.qml:254 +msgid "" +"SSL verification for outgoing connections to the homeserver. Defaults to " +"'True'." msgstr "" #: ../qml/SettingsPage.qml:18 pantalaimon.desktop.in.h:1 @@ -53,14 +87,14 @@ msgstr "" msgid "Service start enabled" msgstr "" -#: ../qml/SettingsPage.qml:108 +#: ../qml/SettingsPage.qml:109 msgid "Delete homeserver" msgstr "" -#: ../qml/SettingsPage.qml:126 +#: ../qml/SettingsPage.qml:127 msgid "No homeservers" msgstr "" -#: ../qml/SettingsPage.qml:179 +#: ../qml/SettingsPage.qml:180 msgid "Add Homeserver" msgstr "" diff --git a/qml/Components/EditServerPage.qml b/qml/Components/EditServerPage.qml index 28d8d72..2540859 100644 --- a/qml/Components/EditServerPage.qml +++ b/qml/Components/EditServerPage.qml @@ -11,6 +11,8 @@ Page { property alias instance: instance.text property alias homeserver: homeserver.text property alias listenport: listenport.text + property alias proxy: proxy.text + property alias ssl: ssl.checked signal save() @@ -32,7 +34,9 @@ Page { var data = { name: instance.text, homeserver: homeserver.text, - listenport: listenport.text + listenport: listenport.text, + proxy: proxy.text, + ssl: ssl.checked } if (editmode) { listModel.set(idx, data); @@ -55,6 +59,8 @@ Page { instance.text = ""; homeserver.text = ""; listenport.text = "8009"; // TODO: maybe autoincrement based on existing entries? + proxy.text = ""; + ssl.checked = true; } Flickable { @@ -85,15 +91,17 @@ Page { spacing: units.gu(1) Label { + id: instanceLabel anchors.verticalCenter: parent.verticalCenter - text: i18n.tr('Description:') + text: i18n.tr('InstanceName') + font.bold: true } TextField { id: instance text: "my-homeserver" anchors.verticalCenter: parent.verticalCenter - Layout.fillWidth: true + width: parent.width - units.gu(6) - instanceLabel.width } } @@ -105,8 +113,10 @@ Page { spacing: units.gu(1) Label { + id: homeserverLabel anchors.verticalCenter: parent.verticalCenter - text: i18n.tr('Homeserver URL:') + text: i18n.tr('Homeserver') + font.bold: true } TextField { @@ -114,12 +124,26 @@ Page { text: "" placeholderText: "https://matrix.org" anchors.verticalCenter: parent.verticalCenter - Layout.fillWidth: true + width: parent.width - units.gu(6) - homeserverLabel.width inputMethodHints: Qt.ImhUrlCharactersOnly } } + Row { + width: parent.width + leftPadding: units.gu(2) + spacing: units.gu(1) + + Label { + horizontalAlignment: Text.AlignLeft + text: i18n.tr("The URI of the homeserver that the pantalaimon proxy should forward requests to, without the matrix API path but including the http(s) schema.") + wrapMode: Text.WordWrap + width: parent.width - units.gu(4) + font.italic: true + } + } + Row { width: parent.width height: units.gu(6) @@ -127,19 +151,113 @@ Page { spacing: units.gu(1) Label { + id: listenportLabel anchors.verticalCenter: parent.verticalCenter - text: i18n.tr('Listen on 127.0.0.1:') + text: i18n.tr('ListenPort') + font.bold: true } TextField { id: listenport text: "8009" anchors.verticalCenter: parent.verticalCenter - Layout.fillWidth: true + width: parent.width - units.gu(6) - listenportLabel.width inputMethodHints: Qt.ImhDigitsOnly } } + + Row { + width: parent.width + leftPadding: units.gu(2) + spacing: units.gu(1) + + Label { + horizontalAlignment: Text.AlignLeft + text: i18n.tr("The port where the daemon will listen to client connections for this homeserver. Note that the listen address/port combination needs to be unique between different homeservers. Defaults to '8009'.") + wrapMode: Text.WordWrap + width: parent.width - units.gu(4) + font.italic: true + } + } + + Row { + width: parent.width + height: units.gu(6) + leftPadding: units.gu(2) + spacing: units.gu(1) + + Label { + id: proxyLabel + anchors.verticalCenter: parent.verticalCenter + text: i18n.tr('Proxy') + font.bold: true + } + + TextField { + id: proxy + text: "" + anchors.verticalCenter: parent.verticalCenter + width: parent.width - units.gu(6) - proxyLabel.width + inputMethodHints: Qt.ImhUrlCharactersOnly + } + + } + + Row { + width: parent.width + leftPadding: units.gu(2) + spacing: units.gu(1) + + Label { + horizontalAlignment: Text.AlignLeft + text: i18n.tr("The URI of a HTTP proxy that the daemon should use when making requests to the homeserver. pantalaimon only supports HTTP proxies. The default is to make a direct connection to the homeserver.") + wrapMode: Text.WordWrap + width: parent.width - units.gu(4) + font.italic: true + } + } + + Row { + width: parent.width + height: units.gu(6) + leftPadding: units.gu(2) + spacing: units.gu(1) + + Label { + id: sslLabel + anchors.verticalCenter: parent.verticalCenter + text: i18n.tr('SSL') + font.bold: true + } + + Label { + text: " " + width: parent.width - sslLabel.width - ssl.width - units.gu(8) + } + + Switch { + id: ssl + checked: true + anchors.verticalCenter: parent.verticalCenter + } + + } + + Row { + width: parent.width + leftPadding: units.gu(2) + spacing: units.gu(1) + + Label { + horizontalAlignment: Text.AlignLeft + text: i18n.tr("SSL verification for outgoing connections to the homeserver. Defaults to 'True'.") + wrapMode: Text.WordWrap + width: parent.width - units.gu(4) + font.italic: true + } + } + } } diff --git a/qml/SettingsPage.qml b/qml/SettingsPage.qml index 299cb8a..480d85e 100644 --- a/qml/SettingsPage.qml +++ b/qml/SettingsPage.qml @@ -91,12 +91,13 @@ Page { progression: true onClicked: { var item = listModel.get(index); - console.log(item); pageStack.push(editConfigPage, { idx: index, instance: item.name, homeserver: item.homeserver, - listenport: item.listenport + listenport: item.listenport, + proxy: item.proxy, + ssl: ssl }); } } diff --git a/src/config.py b/src/config.py index d796d9b..d0c223b 100644 --- a/src/config.py +++ b/src/config.py @@ -20,6 +20,8 @@ def load(): item['homeserver'] = config[instance].get('homeserver') item['listenaddress'] = config[instance].get('listenaddress') item['listenport'] = config[instance].get('listenport') + item['proxy'] = config[instance].get('proxy') + item['ssl'] = config[instance].getboolean('ssl') item['ignoreverification'] = config[instance].get('ignoreverification') item['usekeyring'] = config[instance].get('usekeyring') @@ -34,10 +36,16 @@ def save(data): config = configparser.ConfigParser() for item in dataobj: + if item['ssl']: + sslval = 'true' + else: + sslval = 'false' config[item['name']] = {} config[item['name']]['homeserver'] = item['homeserver'] config[item['name']]['listenaddress'] = "127.0.0.1" config[item['name']]['listenport'] = item['listenport'] + config[item['name']]['proxy'] = item['proxy'] + config[item['name']]['ssl'] = sslval config[item['name']]['ignoreverification'] = "true" config[item['name']]['usekeyring'] = "false"