Compare commits
28 commits
Author | SHA1 | Date | |
---|---|---|---|
Morgan McMillian | 7d6f6f232c | ||
Morgan McMillian | cb1aa162ce | ||
3eaf32d215 | |||
51b7dea71b | |||
a36c12ad5c | |||
e428dd9776 | |||
4d465d09da | |||
92f3105ac8 | |||
d41345adaa | |||
e25e526ec1 | |||
3aa5494e7d | |||
be7e59e0fe | |||
a602478ccb | |||
e253f575be | |||
b0c720d079 | |||
808fefb4be | |||
fe755f4c05 | |||
1f4c5c3ec5 | |||
bd24d6416d | |||
50dc681fe7 | |||
f9752e5ca9 | |||
91309d6ac7 | |||
48de066938 | |||
2f68728ea9 | |||
4896d2e0c9 | |||
e4231ce306 | |||
961c34e37e | |||
653f888312 |
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
||||||
build/
|
build/
|
||||||
pantalaimon-arm64
|
pantalaimon-arm64
|
||||||
pantalaimon-armhf
|
pantalaimon-armhf
|
||||||
|
panctl-arm64
|
||||||
|
panctl-armhf
|
||||||
|
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "libs/olm"]
|
||||||
|
path = libs/olm
|
||||||
|
url = https://gitlab.matrix.org/matrix-org/olm.git
|
|
@ -80,7 +80,7 @@ Page {
|
||||||
Label {
|
Label {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: i18n.tr("Copyright (c) 2020 Morgan McMillian <<a href='mailto:thrrgilag@dreamfall.space'>thrrgilag@dreamfall.space</a>>")
|
text: i18n.tr("Copyright (c) 2021 Morgan McMillian <<a href='mailto:thrrgilag@dreamfall.space'>thrrgilag@dreamfall.space</a>>")
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ Page {
|
||||||
Label {
|
Label {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: i18n.tr("Pantalaimon v0.6.5")
|
text: i18n.tr("Pantalaimon v0.10.3")
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
fontSize: "large"
|
fontSize: "large"
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ Page {
|
||||||
Label {
|
Label {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
horizontalAlignment: Text.AlignHCenter
|
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
|
wrapMode: Text.WordWrap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ execute_process(
|
||||||
set(QT_IMPORTS_DIR "lib/${ARCH_TRIPLET}")
|
set(QT_IMPORTS_DIR "lib/${ARCH_TRIPLET}")
|
||||||
|
|
||||||
set(APP_NAME "Pantalaimon UT")
|
set(APP_NAME "Pantalaimon UT")
|
||||||
set(APP_VERSION "0.3.0")
|
set(APP_VERSION "0.6.0")
|
||||||
set(PROJECT_NAME "pantalaimon")
|
set(PROJECT_NAME "pantalaimon")
|
||||||
set(FULL_PROJECT_NAME "pantalaimon.thrrgilag")
|
set(FULL_PROJECT_NAME "pantalaimon.thrrgilag")
|
||||||
set(CMAKE_INSTALL_PREFIX /)
|
set(CMAKE_INSTALL_PREFIX /)
|
||||||
|
@ -41,6 +41,7 @@ endif()
|
||||||
|
|
||||||
configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
|
configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
|
||||||
configure_file(AboutPage.qml.in ${CMAKE_CURRENT_BINARY_DIR}/AboutPage.qml)
|
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 ${CMAKE_CURRENT_BINARY_DIR}/manifest.json DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||||
install(FILES ${PROJECT_NAME}.apparmor DESTINATION ${DATA_DIR})
|
install(FILES ${PROJECT_NAME}.apparmor DESTINATION ${DATA_DIR})
|
||||||
install(DIRECTORY assets 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(DIRECTORY qml DESTINATION ${DATA_DIR})
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/AboutPage.qml DESTINATION ${DATA_DIR}qml/)
|
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)
|
# 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
|
# Translations
|
||||||
file(GLOB_RECURSE I18N_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po qml/*.qml qml/*.js)
|
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)
|
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})
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME} DESTINATION ${DATA_DIR})
|
||||||
|
|
||||||
# TODO: figure out how to cross compile this
|
# NOTE: dev-build: these are used for the dev-build package
|
||||||
install(PROGRAMS ${PROJECT_NAME}-${CLICK_ARCH} DESTINATION ${CMAKE_INSTALL_PREFIX} RENAME ${PROJECT_NAME})
|
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)
|
add_subdirectory(po)
|
||||||
|
|
||||||
|
|
63
README.md
63
README.md
|
@ -1,52 +1,51 @@
|
||||||
# Pantalaimon UT
|
# Pantalaimon UT
|
||||||
|
|
||||||
|
*This project is no longer in active development.*
|
||||||
|
|
||||||
End-to-end encryption aware Matrix reverse proxy daemon for Ubuntu Touch.
|
End-to-end encryption aware Matrix reverse proxy daemon for Ubuntu Touch.
|
||||||
|
|
||||||
[source code](https://git.sr.ht/~thrrgilag/pantalaimon-ut) -
|
[source code](https://git.dreamfall.space/thrrgilag/pantalaimon-ut) -
|
||||||
[issue tracker](https://todo.sr.ht/~thrrgilag/pantalaimon-ut) -
|
[issue tracker](https://git.dreamfall.space/thrrgilag/pantalaimon-ut/issues) -
|
||||||
[mailing list](https://lists.sr.ht/~thrrgilag/pantalaimon-ut) -
|
[releases](https://git.dreamfall.space/thrrgilag/pantalaimon-ut/releases)
|
||||||
[releases](https://git.sr.ht/~thrrgilag/pantalaimon-ut/refs)
|
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- [x] About page
|
- [x] About page
|
||||||
- [x] App icon
|
- [x] App icon
|
||||||
- [ ] Cross compile python+pantalaimon
|
- [x] Fix image fetching (fixed in fluffychat)
|
||||||
- [ ] Release on open-store.io
|
- [x] Cross compile python+pantalaimon
|
||||||
- [ ] Fix image fetching
|
- [x] Import/export keys (panctl only)
|
||||||
- [ ] Ability to verify, ignore, or blacklist devices
|
- [x] Ability to verify, ignore, or blacklist devices (panctl only)
|
||||||
|
|
||||||
## 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`
|
|
||||||
|
|
||||||
## Known Issues
|
## Known Issues
|
||||||
|
|
||||||
* Images (including avatars) are not fetched
|
- Previously encrypted messages may not be decrypted
|
||||||
* No user interaction to verify, ignore, or blacklist devices
|
- 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
|
## Contributing
|
||||||
|
|
||||||
Send patches to
|
Report bugs or send patches to morgan@mcmillian.dev.
|
||||||
[~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
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Copyright (C) 2020 Morgan McMillian
|
Copyright (C) 2021 Morgan McMillian
|
||||||
|
|
||||||
Licensed under the Apache Software License 2.0
|
Licensed under the Apache Software License 2.0
|
||||||
|
|
46
build-python.sh
Executable file
46
build-python.sh
Executable 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
|
||||||
|
|
24
clickable-cross-build.json
Normal file
24
clickable-cross-build.json
Normal 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"
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"clickable_minimum_required": "6.12.2",
|
"always_clean": true,
|
||||||
"builder": "cmake",
|
"clickable_minimum_required": "7",
|
||||||
"kill": "qmlscene"
|
"kill": "qmlscene",
|
||||||
|
"builder": "cmake"
|
||||||
}
|
}
|
||||||
|
|
70
dev-build.sh
70
dev-build.sh
|
@ -3,37 +3,21 @@
|
||||||
PROJECT_DIR=~/pantalaimon-build
|
PROJECT_DIR=~/pantalaimon-build
|
||||||
TMP_DIR="${PROJECT_DIR}/tmp"
|
TMP_DIR="${PROJECT_DIR}/tmp"
|
||||||
|
|
||||||
VIRTENV_DIR="${PROJECT_DIR}/virtenv"
|
|
||||||
|
|
||||||
OLM_DIR="${PROJECT_DIR}/olm"
|
OLM_DIR="${PROJECT_DIR}/olm"
|
||||||
PANTALAIMON_DIR="${PROJECT_DIR}/pantalaimon"
|
PANTALAIMON_DIR="${PROJECT_DIR}/pantalaimon"
|
||||||
|
|
||||||
PYTHON_VERSION_MINOR="3.7"
|
PYTHON_VERSION_MINOR="3.8"
|
||||||
PYTHON_VERSION_PATCH="7"
|
PYTHON_VERSION_PATCH="12"
|
||||||
PYTHON_VERSION="${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}"
|
PYTHON_VERSION="${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}"
|
||||||
PYTHON_DIR="${PROJECT_DIR}/python"
|
PYTHON_DIR="${PROJECT_DIR}/python"
|
||||||
PYTHON_SRC_DIR="${TMP_DIR}/Python-${PYTHON_VERSION}"
|
PYTHON_SRC_DIR="${TMP_DIR}/Python-${PYTHON_VERSION}"
|
||||||
PYTHON="${PYTHON_DIR}/bin/python${PYTHON_VERSION_MINOR}"
|
PYTHON="${PYTHON_DIR}/bin/python${PYTHON_VERSION_MINOR}"
|
||||||
|
PIP="${PYTHON_DIR}/bin/pip3"
|
||||||
|
|
||||||
mkdir -p "${PROJECT_DIR}"
|
mkdir -p "${PROJECT_DIR}"
|
||||||
mkdir -p "${TMP_DIR}"
|
mkdir -p "${TMP_DIR}"
|
||||||
|
|
||||||
PACKAGES="make cmake build-essential zlibc python3-venv libffi-dev ppa-purge libssl-dev libsqlite3-dev"
|
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"
|
||||||
|
|
||||||
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:
|
|
||||||
"
|
|
||||||
|
|
||||||
echo "Remounting RootFS writable..."
|
echo "Remounting RootFS writable..."
|
||||||
sudo mount -o remount,rw /
|
sudo mount -o remount,rw /
|
||||||
|
@ -42,53 +26,69 @@ echo "Installing dependencies..."
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install -y ${PACKAGES}
|
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}"
|
cd "${TMP_DIR}"
|
||||||
echo "Downloading Olm..."
|
echo "Downloading Olm..."
|
||||||
wget -qO- "https://gitlab.matrix.org/matrix-org/olm/-/archive/master/olm-master.tar.gz" | tar -xz
|
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
|
cd olm-master
|
||||||
cmake . -Bbuild
|
cmake . -Bbuild
|
||||||
cmake --build build
|
cmake --build build
|
||||||
|
|
||||||
echo "Installing Olm..."
|
|
||||||
cd build
|
cd build
|
||||||
make install DESTDIR="${OLM_DIR}"
|
make install DESTDIR="${OLM_DIR}"
|
||||||
else
|
|
||||||
echo "Olm found. Skipping Olm Install..."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "${PYTHON}" ]; then
|
if test -f ${PYTHON}; then
|
||||||
|
echo "python found, skipping..."
|
||||||
|
else
|
||||||
echo "Downloading Python..."
|
echo "Downloading Python..."
|
||||||
cd "${TMP_DIR}"
|
cd "${TMP_DIR}"
|
||||||
wget -qO- "https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz" | tar -xz
|
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}"
|
cd "${PYTHON_SRC_DIR}"
|
||||||
|
#./configure --prefix="${PYTHON_DIR}" --with-openssl=${OPENSSL_DIR} --enable-shared
|
||||||
./configure --prefix="${PYTHON_DIR}" --enable-shared
|
./configure --prefix="${PYTHON_DIR}" --enable-shared
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
else
|
|
||||||
echo "Python found. Skipping Python Install..."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LD_LIBRARY_PATH=${PYTHON_DIR}/lib:${OLM_DIR}/usr/local/lib:${LD_LIBRARY_PATH}
|
LD_LIBRARY_PATH=${PYTHON_DIR}/lib:${OLM_DIR}/usr/local/lib:${LD_LIBRARY_PATH}
|
||||||
export LD_LIBRARY_PATH
|
export LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
echo "Updating setuptools..."
|
||||||
|
${PIP} install --upgrade setuptools
|
||||||
|
${PIP} install --upgrade wheel
|
||||||
|
|
||||||
echo "Installing PyInstaller..."
|
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..."
|
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..."
|
echo "Bundling Pantalaimon..."
|
||||||
cd ${PROJECT_DIR}
|
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/pantalaimon
|
||||||
|
${PYTHON_DIR}/bin/pyinstaller --onefile ${PYTHON_DIR}/bin/panctl
|
||||||
|
|
||||||
echo "Cleaning up, reverting changes to RootFS..."
|
echo "Cleaning up, reverting changes to RootFS..."
|
||||||
sudo apt autoremove -y ${PACKAGES}
|
sudo apt autoremove -y ${PACKAGES}
|
||||||
sudo apt clean
|
sudo apt clean
|
||||||
|
|
||||||
|
|
1
libs/olm
Submodule
1
libs/olm
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit e1aa1b32770c93919692438bee212186500020d3
|
6
pantalaimon.sh.in
Executable file
6
pantalaimon.sh.in
Executable 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 $@
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: pantalaimon.thrrgilag\n"
|
"Project-Id-Version: pantalaimon.thrrgilag\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -17,50 +17,104 @@ msgstr ""
|
||||||
"Content-Type: text/plain; charset=CHARSET\n"
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: ../qml/Components/EditServerPage.qml:19
|
#: ../qml/Components/EditServerPage.qml:21
|
||||||
msgid "Homeserver Configuration"
|
msgid "Homeserver Configuration"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/Components/EditServerPage.qml:24
|
#: ../qml/Components/EditServerPage.qml:26
|
||||||
msgid "Save"
|
msgid "Save"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/Components/EditServerPage.qml:89
|
#: ../qml/Components/EditServerPage.qml:96
|
||||||
msgid "Description:"
|
msgid "InstanceName"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/Components/EditServerPage.qml:109
|
#: ../qml/Components/EditServerPage.qml:119
|
||||||
msgid "Homeserver URL:"
|
msgid "Homeserver"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/Components/EditServerPage.qml:131
|
#: ../qml/Components/EditServerPage.qml:141
|
||||||
msgid "Listen on 127.0.0.1:"
|
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 ""
|
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"
|
msgid "Pantalaimon UT"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:23
|
#: ../qml/SettingsPage.qml:31
|
||||||
msgid "About"
|
msgid "About"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:38
|
#: ../qml/SettingsPage.qml:46
|
||||||
msgid "Service start disabled"
|
msgid "Service start disabled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:38
|
#: ../qml/SettingsPage.qml:46
|
||||||
msgid "Service start enabled"
|
msgid "Service start enabled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:108
|
#: ../qml/SettingsPage.qml:93
|
||||||
|
msgid "LogLevel"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../qml/SettingsPage.qml:146
|
||||||
msgid "Delete homeserver"
|
msgid "Delete homeserver"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:126
|
#: ../qml/SettingsPage.qml:164
|
||||||
msgid "No homeservers"
|
msgid "No homeservers"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:179
|
#: ../qml/SettingsPage.qml:225
|
||||||
msgid "Add Homeserver"
|
msgid "Add Homeserver"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
@ -11,6 +11,8 @@ Page {
|
||||||
property alias instance: instance.text
|
property alias instance: instance.text
|
||||||
property alias homeserver: homeserver.text
|
property alias homeserver: homeserver.text
|
||||||
property alias listenport: listenport.text
|
property alias listenport: listenport.text
|
||||||
|
property alias proxy: proxy.text
|
||||||
|
property alias ssl: ssl.checked
|
||||||
|
|
||||||
signal save()
|
signal save()
|
||||||
|
|
||||||
|
@ -32,7 +34,9 @@ Page {
|
||||||
var data = {
|
var data = {
|
||||||
name: instance.text,
|
name: instance.text,
|
||||||
homeserver: homeserver.text,
|
homeserver: homeserver.text,
|
||||||
listenport: listenport.text
|
listenport: listenport.text,
|
||||||
|
proxy: proxy.text,
|
||||||
|
ssl: ssl.checked
|
||||||
}
|
}
|
||||||
if (editmode) {
|
if (editmode) {
|
||||||
listModel.set(idx, data);
|
listModel.set(idx, data);
|
||||||
|
@ -55,6 +59,8 @@ Page {
|
||||||
instance.text = "";
|
instance.text = "";
|
||||||
homeserver.text = "";
|
homeserver.text = "";
|
||||||
listenport.text = "8009"; // TODO: maybe autoincrement based on existing entries?
|
listenport.text = "8009"; // TODO: maybe autoincrement based on existing entries?
|
||||||
|
proxy.text = "";
|
||||||
|
ssl.checked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
|
@ -85,19 +91,22 @@ Page {
|
||||||
spacing: units.gu(1)
|
spacing: units.gu(1)
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
id: instanceLabel
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: i18n.tr('Description:')
|
text: i18n.tr('InstanceName')
|
||||||
|
font.bold: true
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: instance
|
id: instance
|
||||||
text: "my-homeserver"
|
text: "my-homeserver"
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
Layout.fillWidth: true
|
width: parent.width - units.gu(6) - instanceLabel.width
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Homeserver
|
||||||
Row {
|
Row {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: units.gu(6)
|
height: units.gu(6)
|
||||||
|
@ -105,8 +114,10 @@ Page {
|
||||||
spacing: units.gu(1)
|
spacing: units.gu(1)
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
id: homeserverLabel
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: i18n.tr('Homeserver URL:')
|
text: i18n.tr('Homeserver')
|
||||||
|
font.bold: true
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
|
@ -114,12 +125,27 @@ Page {
|
||||||
text: ""
|
text: ""
|
||||||
placeholderText: "https://matrix.org"
|
placeholderText: "https://matrix.org"
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
Layout.fillWidth: true
|
width: parent.width - units.gu(6) - homeserverLabel.width
|
||||||
inputMethodHints: Qt.ImhUrlCharactersOnly
|
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 {
|
Row {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: units.gu(6)
|
height: units.gu(6)
|
||||||
|
@ -127,19 +153,116 @@ Page {
|
||||||
spacing: units.gu(1)
|
spacing: units.gu(1)
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
id: listenportLabel
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: i18n.tr('Listen on 127.0.0.1:')
|
text: i18n.tr('ListenPort')
|
||||||
|
font.bold: true
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: listenport
|
id: listenport
|
||||||
text: "8009"
|
text: "8009"
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
Layout.fillWidth: true
|
width: parent.width - units.gu(6) - listenportLabel.width
|
||||||
inputMethodHints: Qt.ImhDigitsOnly
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,14 @@ Page {
|
||||||
property bool is_running: false
|
property bool is_running: false
|
||||||
property bool upstart: false
|
property bool upstart: false
|
||||||
property string status_msg
|
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 {
|
header: PageHeader {
|
||||||
id: header
|
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 {
|
ListView {
|
||||||
id: listView
|
id: listView
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height - bottomEdgeHint.height
|
height: parent.height - bottomEdgeHint.height
|
||||||
anchors.top: serviceState.bottom
|
anchors.top: defaultlogLevel.bottom
|
||||||
visible: (listView.count !== 0)
|
visible: (listView.count !== 0)
|
||||||
model: ListModel {
|
model: ListModel {
|
||||||
id: listModel
|
id: listModel
|
||||||
|
@ -91,12 +133,13 @@ Page {
|
||||||
progression: true
|
progression: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var item = listModel.get(index);
|
var item = listModel.get(index);
|
||||||
console.log(item);
|
|
||||||
pageStack.push(editConfigPage, {
|
pageStack.push(editConfigPage, {
|
||||||
idx: index,
|
idx: index,
|
||||||
instance: item.name,
|
instance: item.name,
|
||||||
homeserver: item.homeserver,
|
homeserver: item.homeserver,
|
||||||
listenport: item.listenport
|
listenport: item.listenport,
|
||||||
|
proxy: item.proxy,
|
||||||
|
ssl: item.ssl
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,8 +180,13 @@ Page {
|
||||||
|
|
||||||
importModule('config', function() {
|
importModule('config', function() {
|
||||||
py.call('config.load', [], function(result) {
|
py.call('config.load', [], function(result) {
|
||||||
for (var i=0; i<result.length; i++) {
|
console.log('DEBUG: ' + JSON.stringify(result));
|
||||||
listModel.append(result[i])
|
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...");
|
console.log("debug: python config loaded...");
|
||||||
|
@ -157,7 +205,10 @@ Page {
|
||||||
for (var i = 0; i < listModel.count; ++i) {
|
for (var i = 0; i < listModel.count; ++i) {
|
||||||
lmdata.push(listModel.get(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() {
|
function get_status() {
|
||||||
|
|
|
@ -11,36 +11,75 @@ CONFFILE = 'pantalaimon.conf'
|
||||||
def load():
|
def load():
|
||||||
entries = []
|
entries = []
|
||||||
|
|
||||||
|
loglevels = [ "warning", "info", "debug", "error" ]
|
||||||
|
|
||||||
|
defaults = {
|
||||||
|
'name': "Default",
|
||||||
|
'loglevel': "warning",
|
||||||
|
'loglevel_idx': 0,
|
||||||
|
'notifications': True
|
||||||
|
}
|
||||||
|
|
||||||
if os.path.exists(CONFDIR + CONFFILE):
|
if os.path.exists(CONFDIR + CONFFILE):
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read_file(open(CONFDIR + CONFFILE))
|
config.read_file(open(CONFDIR + CONFFILE))
|
||||||
|
|
||||||
for instance in config.sections():
|
for instance in config.sections():
|
||||||
|
|
||||||
item = {'name': instance}
|
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")
|
logging.debug("save config")
|
||||||
dataobj = json.loads(data)
|
dataobj = json.loads(data)
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
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:
|
for item in dataobj:
|
||||||
|
if item['ssl']:
|
||||||
|
sslval = 'true'
|
||||||
|
else:
|
||||||
|
sslval = 'false'
|
||||||
|
|
||||||
config[item['name']] = {}
|
config[item['name']] = {}
|
||||||
config[item['name']]['homeserver'] = item['homeserver']
|
config[item['name']]['homeserver'] = item['homeserver']
|
||||||
config[item['name']]['listenaddress'] = "127.0.0.1"
|
config[item['name']]['listenaddress'] = "127.0.0.1"
|
||||||
config[item['name']]['listenport'] = item['listenport']
|
config[item['name']]['listenport'] = item['listenport']
|
||||||
|
config[item['name']]['ssl'] = sslval
|
||||||
config[item['name']]['ignoreverification'] = "true"
|
config[item['name']]['ignoreverification'] = "true"
|
||||||
config[item['name']]['usekeyring'] = "false"
|
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):
|
if not os.path.exists(CONFDIR):
|
||||||
os.makedirs(CONFDIR)
|
os.makedirs(CONFDIR)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue