Compare commits

...

28 commits
0.3.0 ... main

Author SHA1 Message Date
Morgan McMillian 7d6f6f232c Updated README for new project location 2023-02-10 05:59:08 -08:00
Morgan McMillian cb1aa162ce updated links in README 2022-06-22 06:25:24 -07:00
Morgan McMillian 3eaf32d215 update min clickable version to 7 2022-02-12 10:30:49 -08:00
Morgan McMillian 51b7dea71b don't upgrade pip, bad things happen 2022-02-12 09:41:39 -08:00
Morgan McMillian a36c12ad5c update python version 2021-10-31 08:39:41 -07:00
Morgan McMillian e428dd9776 Fix README yet again 2021-09-08 07:15:24 -07:00
Morgan McMillian 4d465d09da clarify chat room in README 2021-09-08 07:14:07 -07:00
Morgan McMillian 92f3105ac8 updated README and About for release 2021-09-08 06:59:16 -07:00
Morgan McMillian d41345adaa Enable debug encryption when logging set to debug 2021-09-08 06:45:30 -07:00
Morgan McMillian e25e526ec1 revert to using on-device builds for package 2021-09-06 14:47:09 -07:00
Morgan McMillian 3aa5494e7d move cross-build configuration 2021-09-06 14:46:23 -07:00
Morgan McMillian be7e59e0fe pyinstaller hack for armhf and remote patch 2021-09-06 14:44:30 -07:00
Morgan McMillian a602478ccb update pantalaimon to latest 2021-09-06 12:23:24 -07:00
Morgan McMillian e253f575be olm update from upstream 2021-09-05 13:35:09 -07:00
Morgan McMillian b0c720d079 update device build dependencies
Added support for building the current version of the python
cryptography library which now requires rust. Also included the ability
to build panctl.
2021-09-05 13:28:17 -07:00
Morgan McMillian 808fefb4be add build requirements 2021-03-13 14:34:51 -08:00
Morgan McMillian fe755f4c05 Update pantalaimon to 0.9.2 2021-03-13 08:56:02 -08:00
Morgan McMillian 1f4c5c3ec5 full cross compile using clickable 2021-03-09 22:27:12 -08:00
Morgan McMillian bd24d6416d add olm submodule 2021-03-09 22:17:08 -08:00
Morgan McMillian 50dc681fe7 I made an oops 2021-02-17 14:37:28 -08:00
Morgan McMillian f9752e5ca9 updated readme 2021-02-17 14:36:07 -08:00
Morgan McMillian 91309d6ac7 pin python cryptography to 3.2.1
This is the last version of python cryptography that will cleanly
build on Ubuntu Touch 16.04. The 3.3 series depends on newer openssl and
the 3.4 series depends on Rust.
2021-02-09 12:07:15 -08:00
Morgan McMillian 48de066938 fix loglevel setting on save
selectedIndex doesn't actually change until after onDelegateClicked
completes, which results in the previous value being saved rather
than the desired one. This correctly handles the change in setting.
2020-09-07 20:50:41 -07:00
Morgan McMillian 2f68728ea9 add gloabl setting for loglevel 2020-09-07 20:23:50 -07:00
Morgan McMillian 4896d2e0c9 added default section to config load and save 2020-09-07 20:19:12 -07:00
Morgan McMillian e4231ce306 fix proxy and ssl default 2020-09-03 21:39:10 -07:00
Morgan McMillian 961c34e37e add additional settings 2020-09-03 15:04:34 -07:00
Morgan McMillian 653f888312 update pantalaimon to 0.7.0 2020-09-03 06:26:23 -07:00
15 changed files with 472 additions and 114 deletions

2
.gitignore vendored
View file

@ -1,3 +1,5 @@
build/
pantalaimon-arm64
pantalaimon-armhf
panctl-arm64
panctl-armhf

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "libs/olm"]
path = libs/olm
url = https://gitlab.matrix.org/matrix-org/olm.git

View file

@ -80,7 +80,7 @@ Page {
Label {
width: parent.width
horizontalAlignment: Text.AlignHCenter
text: i18n.tr("Copyright (c) 2020 Morgan McMillian &lt;<a href='mailto:thrrgilag@dreamfall.space'>thrrgilag@dreamfall.space</a>&gt;")
text: i18n.tr("Copyright (c) 2021 Morgan McMillian &lt;<a href='mailto:thrrgilag@dreamfall.space'>thrrgilag@dreamfall.space</a>&gt;")
wrapMode: Text.WordWrap
}
@ -94,7 +94,7 @@ Page {
Label {
width: parent.width
horizontalAlignment: Text.AlignHCenter
text: i18n.tr("Pantalaimon v0.6.5")
text: i18n.tr("Pantalaimon v0.10.3")
wrapMode: Text.WordWrap
fontSize: "large"
}
@ -102,7 +102,7 @@ Page {
Label {
width: parent.width
horizontalAlignment: Text.AlignHCenter
text: i18n.tr("Copyright (c) 2019 The Matrix.org Foundation CIC")
text: i18n.tr("Copyright (c) 2021 The Matrix.org Foundation CIC")
wrapMode: Text.WordWrap
}

View file

@ -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.6.0")
set(PROJECT_NAME "pantalaimon")
set(FULL_PROJECT_NAME "pantalaimon.thrrgilag")
set(CMAKE_INSTALL_PREFIX /)
@ -41,6 +41,7 @@ endif()
configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
configure_file(AboutPage.qml.in ${CMAKE_CURRENT_BINARY_DIR}/AboutPage.qml)
# NOTE: cross-build: configure_file(pantalaimon.sh.in ${CMAKE_CURRENT_BINARY_DIR}/pantalaimon.sh)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES ${PROJECT_NAME}.apparmor DESTINATION ${DATA_DIR})
install(DIRECTORY assets DESTINATION ${DATA_DIR})
@ -48,9 +49,15 @@ install(DIRECTORY src DESTINATION ${DATA_DIR})
install(DIRECTORY qml DESTINATION ${DATA_DIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/AboutPage.qml DESTINATION ${DATA_DIR}qml/)
# TODO: example config file for local testing
# NOTE: example config file for local testing
# install(FILES example.conf DESTINATION ${CMAKE_INSTALL_PREFIX} RENAME pantalaimon.conf)
# NOTE: cross-build: thesse are used for the cross compiled package
# file(GLOB_RECURSE OLM_SO_FILES "$ENV{OLM_LIB_INSTALL_DIR}/lib/libolm.so*")
# install(FILES ${OLM_SO_FILES} DESTINATION ${QT_IMPORTS_DIR})
# install(PROGRAMS build/${ARCH_TRIPLET}/pantalaimon/dist/pantalaimon DESTINATION ${CMAKE_INSTALL_PREFIX} RENAME pantalaimonexec)
# install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/pantalaimon.sh DESTINATION ${CMAKE_INSTALL_PREFIX} RENAME pantalaimon)
# Translations
file(GLOB_RECURSE I18N_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po qml/*.qml qml/*.js)
list(APPEND I18N_SRC_FILES ${DESKTOP_FILE_NAME}.in.h)
@ -72,8 +79,10 @@ add_custom_target(${DESKTOP_FILE_NAME} ALL
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME} DESTINATION ${DATA_DIR})
# TODO: figure out how to cross compile this
install(PROGRAMS ${PROJECT_NAME}-${CLICK_ARCH} DESTINATION ${CMAKE_INSTALL_PREFIX} RENAME ${PROJECT_NAME})
# NOTE: dev-build: these are used for the dev-build package
install(PROGRAMS pantalaimon-${CLICK_ARCH} DESTINATION ${CMAKE_INSTALL_PREFIX} RENAME pantalaimon)
install(PROGRAMS panctl-${CLICK_ARCH} DESTINATION ${CMAKE_INSTALL_PREFIX} RENAME panctl)
# TODO: not needed? install(PROGRAMS build/${ARCH_TRIPLET}/pantalaimon/dist/pantalaimon DESTINATION ${CMAKE_INSTALL_PREFIX})
add_subdirectory(po)

View file

@ -1,52 +1,51 @@
# Pantalaimon UT
*This project is no longer in active development.*
End-to-end encryption aware Matrix reverse proxy daemon for Ubuntu Touch.
[source code](https://git.sr.ht/~thrrgilag/pantalaimon-ut) -
[issue tracker](https://todo.sr.ht/~thrrgilag/pantalaimon-ut) -
[mailing list](https://lists.sr.ht/~thrrgilag/pantalaimon-ut) -
[releases](https://git.sr.ht/~thrrgilag/pantalaimon-ut/refs)
[source code](https://git.dreamfall.space/thrrgilag/pantalaimon-ut) -
[issue tracker](https://git.dreamfall.space/thrrgilag/pantalaimon-ut/issues) -
[releases](https://git.dreamfall.space/thrrgilag/pantalaimon-ut/releases)
## TODO
- [x] About page
- [x] App icon
- [ ] Cross compile python+pantalaimon
- [ ] Release on open-store.io
- [ ] Fix image fetching
- [ ] Ability to verify, ignore, or blacklist devices
## Build
This project is not currently setup for cross building. A binary will need to
be compiled on a device for each target architecture. Make sure there is
enough space on the device to install the build tools and compile python, olm,
and pantalaimon.
* `git clone https://git.sr.ht/~thrrgilag/pantalaimon-ut`
* push dev-build.sh to /home/phablet
* run `dev-build.sh`
* pull /home/phablet/pantalaimon-build/dist/pantalaimon
* rename pantalaimon to pantalaimon-armhf (or pantalaimon-arm64)
* run `clickable`
- [x] Fix image fetching (fixed in fluffychat)
- [x] Cross compile python+pantalaimon
- [x] Import/export keys (panctl only)
- [x] Ability to verify, ignore, or blacklist devices (panctl only)
## Known Issues
* Images (including avatars) are not fetched
* No user interaction to verify, ignore, or blacklist devices
- Previously encrypted messages may not be decrypted
- Slow to sync on certain devices
## panctl
The ability to verify, ignore, or blacklist devices is currently limited to the use of the panctl utility which can be accessed using the Terminal app by running `/opt/click.ubuntu.com/pantalaimon.thrrgilag/current/panctl`. See the [man](https://github.com/matrix-org/pantalaimon/blob/master/docs/man/panctl.md) for details on how to use it.
## Build pantalaimon and panctl
The background daemon (pantalaimon) and shell utility (panctl) are built directly on device due to complications with cross compiling dependencies. You'll need a device with sufficient space free on the system partition to install all of the required packages. For the most recent release I utilized a Raspberry Pi 4 to create the binaries for arm64 and armhf.
1. Put the dev-build.sh script in /home/phablet on the target device and execute `./dev-build.sh`
2. Pull the ~/pantalaimon-build/dist/pantalaimon and ~/pantalaimon-build/dist/panctl to your local source tree
3. Rename the files to add -{ARCH} *(e.g. mv pantalaimon pantalaimon-arm64)*
## Build click package
- Install or update [clickable](https://clickable-ut.dev/en/latest/install.html)
- For ARM64 devices run `clickable --arch=arm64`
- For ARMHF devices run `clickable --arch=armhf`
## Contributing
Send patches to
[~thrrgilag/pantalaimon-ut@lists.sr.ht](https://lists.sr.ht/~thrrgilag/pantalaimon-ut)
A tutorial for git send-email can be found at [git-send-email.io](https://git-send-email.io/)
if you're not familiar with this method.
Bugs can be filed at https://todo.sr.ht/~thrrgilag/pantalaimon-ut
Report bugs or send patches to morgan@mcmillian.dev.
## License
Copyright (C) 2020 Morgan McMillian
Copyright (C) 2021 Morgan McMillian
Licensed under the Apache Software License 2.0

46
build-python.sh Executable file
View file

@ -0,0 +1,46 @@
#!/bin/bash
PYTHON_VERSION="3.7.7"
CRYPTOGRAPHY_VERSION="3.2.1"
cd ${BUILD_DIR}
echo
echo "...building python..."
echo
wget -qO- "https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz" | tar -xz
cd Python-${PYTHON_VERSION}
./configure --prefix="${INSTALL_DIR}" --enable-shared
make
make install
cd ..
export LD_LIBRARY_PATH=${INSTALL_DIR}/lib:${LD_LIBRARY_PATH}
echo
echo "...installing pyinstaller..."
echo
${INSTALL_DIR}/bin/pip3 install --upgrade pyinstaller
# dirty hack to work around pyinstaller locating the bootloader when building for armhf
ln -s ${INSTALL_DIR}/lib/python3.7/site-packages/PyInstaller/bootloader/Linux-32bit-unknown ${INSTALL_DIR}/lib/python3.7/site-packages/PyInstaller/bootloader/Linux-32bit-arm
echo
echo "...installing cryptography..."
echo
export CRYPTOGRAPHY_ALLOW_OPENSSL_102="yes"
${INSTALL_DIR}/bin/pip3 install --upgrade cryptography==${CRYPTOGRAPHY_VERSION}
echo
echo "...installing pantalaimon..."
echo
export LD_LIBRARY_PATH=${ROOT}/build/${ARCH_TRIPLET}/olm/install/lib/${ARCH_TRIPLET}:${LD_LIBRARY_PATH}
export CFLAGS=-I${ROOT}/build/${ARCH_TRIPLET}/olm/install/include
export LDFLAGS=-L${ROOT}/build/${ARCH_TRIPLET}/olm/install/lib/${ARCH_TRIPLET}
${INSTALL_DIR}/bin/pip3 install --upgrade pantalaimon
export PATH=/usr/${ARCH_TRIPLET}/bin:${PATH}
echo
echo "...creating executable..."
echo
${INSTALL_DIR}/bin/pyinstaller --onefile ${INSTALL_DIR}/bin/pantalaimon

View file

@ -0,0 +1,24 @@
{
"clickable_minimum_required": "6.12.2",
"builder": "cmake",
"libraries": {
"olm": {
"builder": "cmake",
"build_args": [ "-Bbuild",
"-DOLM_TESTS=OFF",
"-DBUILD_SHARED_LIBS=ON"
],
"prebuild": "git submodule update --init --recursive"
},
"pantalaimon": {
"builder": "custom",
"dependencies_target": [
"libffi-dev",
"libssl-dev",
"libsqlite3-dev"
],
"build": "${ROOT}/build-python.sh"
}
},
"kill": "qmlscene"
}

View file

@ -1,5 +1,6 @@
{
"clickable_minimum_required": "6.12.2",
"builder": "cmake",
"kill": "qmlscene"
"always_clean": true,
"clickable_minimum_required": "7",
"kill": "qmlscene",
"builder": "cmake"
}

View file

@ -3,37 +3,21 @@
PROJECT_DIR=~/pantalaimon-build
TMP_DIR="${PROJECT_DIR}/tmp"
VIRTENV_DIR="${PROJECT_DIR}/virtenv"
OLM_DIR="${PROJECT_DIR}/olm"
PANTALAIMON_DIR="${PROJECT_DIR}/pantalaimon"
PYTHON_VERSION_MINOR="3.7"
PYTHON_VERSION_PATCH="7"
PYTHON_VERSION_MINOR="3.8"
PYTHON_VERSION_PATCH="12"
PYTHON_VERSION="${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}"
PYTHON_DIR="${PROJECT_DIR}/python"
PYTHON_SRC_DIR="${TMP_DIR}/Python-${PYTHON_VERSION}"
PYTHON="${PYTHON_DIR}/bin/python${PYTHON_VERSION_MINOR}"
PIP="${PYTHON_DIR}/bin/pip3"
mkdir -p "${PROJECT_DIR}"
mkdir -p "${TMP_DIR}"
PACKAGES="make cmake build-essential zlibc python3-venv libffi-dev ppa-purge libssl-dev libsqlite3-dev"
PANTALAIMON_PATCH_CONTENT="
diff --git a/pantalaimon/main.py b/pantalaimon/main.py
index 896d29e..3e0fee8 100644
--- a/pantalaimon/main.py
+++ b/pantalaimon/main.py
@@ -32,6 +32,7 @@ from pantalaimon.log import logger
from pantalaimon.thread_messages import DaemonResponse
from pantalaimon.ui import UI_ENABLED
+keyring.core.set_keyring(keyring.core.load_keyring('keyring.backends.SecretService.Keyring'))
def create_dirs(data_dir, conf_dir):
try:
"
PACKAGES="make cmake build-essential zlibc python3-venv libffi-dev ppa-purge libssl-dev libsqlite3-dev zlib1g-dev rustc cargo libgirepository1.0-dev libdbus-1-dev libcairo2-dev"
echo "Remounting RootFS writable..."
sudo mount -o remount,rw /
@ -42,53 +26,69 @@ echo "Installing dependencies..."
sudo apt update
sudo apt install -y ${PACKAGES}
if [ ! -e "${OLM_DIR}/usr/local/lib/libolm.so" ]; then
OLMCK=${OLM_DIR}/usr/local/lib/libolm.so
if test -f ${OLMCK}; then
echo "olm found, skipping..."
else
cd "${TMP_DIR}"
echo "Downloading Olm..."
wget -qO- "https://gitlab.matrix.org/matrix-org/olm/-/archive/master/olm-master.tar.gz" | tar -xz
echo "Building Olm..."
echo "Building olm..."
cd olm-master
cmake . -Bbuild
cmake --build build
echo "Installing Olm..."
cd build
make install DESTDIR="${OLM_DIR}"
else
echo "Olm found. Skipping Olm Install..."
fi
if [ ! -e "${PYTHON}" ]; then
if test -f ${PYTHON}; then
echo "python found, skipping..."
else
echo "Downloading Python..."
cd "${TMP_DIR}"
wget -qO- "https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz" | tar -xz
echo "Installing Python..."
echo "Installing python..."
cd "${PYTHON_SRC_DIR}"
#./configure --prefix="${PYTHON_DIR}" --with-openssl=${OPENSSL_DIR} --enable-shared
./configure --prefix="${PYTHON_DIR}" --enable-shared
make
make install
else
echo "Python found. Skipping Python Install..."
fi
LD_LIBRARY_PATH=${PYTHON_DIR}/lib:${OLM_DIR}/usr/local/lib:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
echo "Updating setuptools..."
${PIP} install --upgrade setuptools
${PIP} install --upgrade wheel
echo "Installing PyInstaller..."
${PYTHON} -m pip install --upgrade pyinstaller
${PIP} install --upgrade pyinstaller
# dirty hack to work around pyinstaller locating the bootloader when building for armhf
ln -s ${PYTHON_DIR}/lib/python3.7/site-packages/PyInstaller/bootloader/Linux-32bit-unknown ${PYTHON_DIR}/lib/python3.7/site-packages/PyInstaller/bootloader/Linux-32bit-arm
# NOTE: Newer versions of cryptography require rustc+cargo to build. While the
# new version builds fine with rust on arm64 it fails on armhf
echo "Installing cryptography..."
export CRYPTOGRAPHY_ALLOW_OPENSSL_102="yes"
${PIP} install cryptography==3.2.1
echo "Installing pycairo..."
${PIP} install pycairo==1.19.1
echo "Installing pygobject..."
PYGOBJECT_WITHOUT_PYCAIRO=1 ${PIP} install --no-build-isolation pygobject==3.38
echo "Installing Pantalaimon..."
CFLAGS=-I"${OLM_DIR}/usr/local/include -I${OLM_DIR}/usr/local/include" LDFLAGS="-L${OLM_DIR}/usr/local/lib" ${PYTHON} -m pip install --upgrade pantalaimon
CFLAGS=-I${OLM_DIR}/usr/local/include LDFLAGS=-L${OLM_DIR}/usr/local/lib ${PIP} install --upgrade pantalaimon[ui]
echo "Bundling Pantalaimon..."
cd ${PROJECT_DIR}
echo "${PANTALAIMON_PATCH_CONTENT}" > main.patch
patch ${PYTHON_DIR}/lib/python${PYTHON_VERSION_MINOR}/site-packages/pantalaimon/main.py main.patch
${PYTHON_DIR}/bin/pyinstaller --onefile ${PYTHON_DIR}/bin/pantalaimon
${PYTHON_DIR}/bin/pyinstaller --onefile ${PYTHON_DIR}/bin/panctl
echo "Cleaning up, reverting changes to RootFS..."
sudo apt autoremove -y ${PACKAGES}
sudo apt clean

1
libs/olm Submodule

@ -0,0 +1 @@
Subproject commit e1aa1b32770c93919692438bee212186500020d3

6
pantalaimon.sh.in Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
INSTALL_DIR=`dirname $0`
export LD_LIBRARY_PATH=$INSTALL_DIR/lib/${ARCH_TRIPLET}:$LD_LIBRARY_PATH
$INSTALL_DIR/pantalaimonexec $@

View file

@ -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: 2021-03-10 06:14+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,50 +17,104 @@ 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:119
msgid "Homeserver"
msgstr ""
#: ../qml/Components/EditServerPage.qml:131
msgid "Listen on 127.0.0.1:"
#: ../qml/Components/EditServerPage.qml:141
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/SettingsPage.qml:18 pantalaimon.desktop.in.h:1
#: ../qml/Components/EditServerPage.qml:158
msgid "ListenPort"
msgstr ""
#: ../qml/Components/EditServerPage.qml:179
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:196
msgid "Proxy"
msgstr ""
#: ../qml/Components/EditServerPage.qml:217
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:234
msgid "SSL"
msgstr ""
#: ../qml/Components/EditServerPage.qml:258
msgid ""
"SSL verification for outgoing connections to the homeserver. Defaults to "
"'True'."
msgstr ""
#: ../qml/SettingsPage.qml:18
msgid "warning"
msgstr ""
#: ../qml/SettingsPage.qml:19
msgid "info"
msgstr ""
#: ../qml/SettingsPage.qml:20
msgid "debug"
msgstr ""
#: ../qml/SettingsPage.qml:21
msgid "error"
msgstr ""
#: ../qml/SettingsPage.qml:26 pantalaimon.desktop.in.h:1
msgid "Pantalaimon UT"
msgstr ""
#: ../qml/SettingsPage.qml:23
#: ../qml/SettingsPage.qml:31
msgid "About"
msgstr ""
#: ../qml/SettingsPage.qml:38
#: ../qml/SettingsPage.qml:46
msgid "Service start disabled"
msgstr ""
#: ../qml/SettingsPage.qml:38
#: ../qml/SettingsPage.qml:46
msgid "Service start enabled"
msgstr ""
#: ../qml/SettingsPage.qml:108
#: ../qml/SettingsPage.qml:93
msgid "LogLevel"
msgstr ""
#: ../qml/SettingsPage.qml:146
msgid "Delete homeserver"
msgstr ""
#: ../qml/SettingsPage.qml:126
#: ../qml/SettingsPage.qml:164
msgid "No homeservers"
msgstr ""
#: ../qml/SettingsPage.qml:179
#: ../qml/SettingsPage.qml:225
msgid "Add Homeserver"
msgstr ""

View file

@ -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,19 +91,22 @@ 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
}
}
// Homeserver
Row {
width: parent.width
height: units.gu(6)
@ -105,8 +114,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 +125,27 @@ 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
}
}
// ListenPort
Row {
width: parent.width
height: units.gu(6)
@ -127,19 +153,116 @@ 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
}
}
// Proxy
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
}
}
// SSL
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
}
}
// END
}
}

View file

@ -12,6 +12,14 @@ Page {
property bool is_running: false
property bool upstart: false
property string status_msg
property int loglevel_idx
property var loglevels: [
i18n.tr("warning"),
i18n.tr("info"),
i18n.tr("debug"),
i18n.tr("error")
]
header: PageHeader {
id: header
@ -73,11 +81,45 @@ Page {
}
}
Column {
id: defaultlogLevel
anchors.top: serviceState.bottom
width: parent.width
leftPadding: units.gu(2)
topPadding: units.gu(2)
OptionSelector {
id: loglevel
text: i18n.tr("LogLevel")
width: parent.width - units.gu(4)
model: loglevels
containerHeight: itemHeight * 6
onDelegateClicked: {
loglevel_idx = index;
saveConfig();
if (is_running) {
py.call('service.stop', [], function(result) {});
py.call('service.start', [], function(result) {});
get_status();
}
}
}
Label {
text: " "
height: units.gu(2)
}
ListItems.Divider {
height: units.gu(.5)
}
}
ListView {
id: listView
width: parent.width
height: parent.height - bottomEdgeHint.height
anchors.top: serviceState.bottom
anchors.top: defaultlogLevel.bottom
visible: (listView.count !== 0)
model: ListModel {
id: listModel
@ -91,12 +133,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: item.ssl
});
}
}
@ -137,8 +180,13 @@ Page {
importModule('config', function() {
py.call('config.load', [], function(result) {
for (var i=0; i<result.length; i++) {
listModel.append(result[i])
console.log('DEBUG: ' + JSON.stringify(result));
var defaults = result[0];
loglevel.selectedIndex = defaults.loglevel_idx;
loglevel_idx = defaults.loglevel_idx;
var data = result[1];
for (var i=0; i<data.length; i++) {
listModel.append(data[i]);
}
});
console.log("debug: python config loaded...");
@ -157,7 +205,10 @@ Page {
for (var i = 0; i < listModel.count; ++i) {
lmdata.push(listModel.get(i));
}
py.call("config.save", [JSON.stringify(lmdata)], function(result) {});
var defaults = {
'loglevel': loglevels[loglevel_idx]
}
py.call("config.save", [JSON.stringify(defaults), JSON.stringify(lmdata)], function(result) {});
}
function get_status() {

View file

@ -11,36 +11,75 @@ CONFFILE = 'pantalaimon.conf'
def load():
entries = []
loglevels = [ "warning", "info", "debug", "error" ]
defaults = {
'name': "Default",
'loglevel': "warning",
'loglevel_idx': 0,
'notifications': True
}
if os.path.exists(CONFDIR + CONFFILE):
config = configparser.ConfigParser()
config.read_file(open(CONFDIR + CONFFILE))
for instance in config.sections():
item = {'name': instance}
item['homeserver'] = config[instance].get('homeserver')
item['listenaddress'] = config[instance].get('listenaddress')
item['listenport'] = config[instance].get('listenport')
item['ignoreverification'] = config[instance].get('ignoreverification')
item['usekeyring'] = config[instance].get('usekeyring')
entries.append(item)
if instance == "Default":
item['loglevel'] = config[instance].get('loglevel', "warning")
item['loglevel_idx'] = loglevels.index(config[instance].get('loglevel', 0))
item['notifications'] = config[instance].getboolean('notifications', True)
defaults = item
return entries
else:
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', True)
item['ignoreverification'] = config[instance].getboolean('ignoreverification', True)
item['usekeyring'] = config[instance].get('usekeyring')
entries.append(item)
def save(data):
return (defaults, entries)
def save(defaults, data):
logging.debug("save config")
dataobj = json.loads(data)
config = configparser.ConfigParser()
defobj = json.loads(defaults)
config['Default'] = {
'loglevel': defobj['loglevel']
}
if defobj['loglevel'] == 'debug':
config['Default']['DebugEncryption'] = 'true'
else:
config['Default']['DebugEncryption'] = 'false'
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']]['ssl'] = sslval
config[item['name']]['ignoreverification'] = "true"
config[item['name']]['usekeyring'] = "false"
if 'proxy' in item:
if len(item['proxy']) > 0:
config[item['name']]['proxy'] = item['proxy']
if not os.path.exists(CONFDIR):
os.makedirs(CONFDIR)