From 22b481863150b0b7c15c3c40458c5643cda1b210 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 16 Mar 2021 22:07:36 +0000 Subject: [PATCH] desktop client setup --- README_commandline.md | 23 ++++++-- epicyon.py | 3 +- ...op-notifications => install-desktop-client | 52 +++++++++++-------- 3 files changed, 51 insertions(+), 27 deletions(-) rename install-desktop-notifications => install-desktop-client (57%) diff --git a/README_commandline.md b/README_commandline.md index f92a10708..42a4dce76 100644 --- a/README_commandline.md +++ b/README_commandline.md @@ -411,17 +411,30 @@ python3 epicyon.py --notifyShowNewPosts --screenreader picospeaker --notify your You can also use the **--password** option to provide the password. This will then stay running and incoming posts will be announced as they arrive. -## Desktop notifications +## Desktop client -You can get desktop notifications either by running the screen reader as shown above, or if you only want notifications and not spoken messages then you can run the client as follows, without the *screenreader* option: +You can install the desktop client with: ``` bash -python3 epicyon.py --notify yournickname@yourdomain +./install-desktop-client +``` + +and run it with: + +``` bash +~/epicyon-client +``` + + +You can run a desktop client as follows: + +``` bash +python3 epicyon.py --client yournickname@yourdomain ``` You can also use the **--password** option if needed. -The notifications client also provides a number of basic commands, which may be more convenient than the web interface for some purposes: +The desktop client also provides a number of commands, which may be more convenient than the web interface for some purposes: ``` bash quit Exit from the notification client @@ -445,4 +458,4 @@ read [post number] Read a post from a timeline open [post number] Open web links within a timeline post ``` -If you have a GPG key configured on your local system and are sending a direct message to someone who has a PGP key (the exported key, not just the key ID) set as a tag on their profile then it will try to encrypt the message automatically. So under some conditions end-to-end encryption is possible, such that the instance server only sees ciphertext. Conversely, for arriving direct messages if they are PGP encrypted then the notification client will try to obtain the relevant public key and decrypt. +If you have a GPG key configured on your local system and are sending a direct message to someone who has a PGP key (the exported key, not just the key ID) set as a tag on their profile then it will try to encrypt the message automatically. So under some conditions end-to-end encryption is possible, such that the instance server only sees ciphertext. Conversely, for arriving direct messages if they are PGP encrypted then the desktop client will try to obtain the relevant public key and decrypt. diff --git a/epicyon.py b/epicyon.py index 0d9f61284..bc828851a 100644 --- a/epicyon.py +++ b/epicyon.py @@ -454,7 +454,8 @@ parser.add_argument('--level', dest='skillLevelPercent', type=int, parser.add_argument('--status', '--availability', dest='availability', type=str, default=None, help='Set an availability status') -parser.add_argument('--notifications', '--notify', dest='notifications', +parser.add_argument('--notifications', '--notify', '--client', + dest='notifications', type=str, default=None, help='Notify posts as they arrive at your ' + 'inbox. --notifications [handle]') diff --git a/install-desktop-notifications b/install-desktop-client similarity index 57% rename from install-desktop-notifications rename to install-desktop-client index d6664e141..a9b6a3b1f 100755 --- a/install-desktop-notifications +++ b/install-desktop-client @@ -15,7 +15,7 @@ if [ ! -f /usr/bin/zenity ]; then fi fi -HANDLE=$(zenity --entry --width=400 --title "Epicyon Desktop Notifications" --text "Fediverse handle (name@domain): ") +HANDLE=$(zenity --entry --width=400 --title "Epicyon Desktop Client" --text "Fediverse handle (name@domain): ") if [ ! "$HANDLE" ]; then zenity --warning --width=400 --text "No fediverse handle was given" exit 1 @@ -24,11 +24,11 @@ if [[ "$HANDLE" != *'@'* ]]; then zenity --warning --width=400 --text "Fediverse handle must be in the form username@domain" exit 2 fi -PASSWORD=$(zenity --width=400 --password --title "Epicyon Desktop Notifications") -if [ ! "$PASSWORD" ]; then - zenity --warning --width=400 --text "No password was given" - exit 3 -fi +# PASSWORD=$(zenity --width=400 --password --title "Epicyon Desktop Client") +# if [ ! "$PASSWORD" ]; then +# zenity --warning --width=400 --text "No password was given" +# exit 3 +# fi if [ ! -f /usr/bin/git ]; then if [ -f /usr/bin/apt ]; then @@ -87,19 +87,29 @@ if [ ! -d ${HOME}/.gnupg ]; then gpg --quick-generate-key "${HANDLE}" ed25519 cert fi -{ echo '[Unit]'; - echo 'Description=Epicyon Desktop Notifications'; - echo ''; - echo '[Service]'; - echo "WorkingDirectory=${HOME}/.epicyon"; - echo "ExecStart=/usr/bin/python3 epicyon.py --noKeyPress --notifyType $notificationType --notify $HANDLE --password \"$PASSWORD\""; - echo 'Type=oneshot'; - echo 'RemainAfterExit=yes'; - echo ''; - echo '[Install]'; - echo 'WantedBy=default.target'; } > "${HOME}/.config/systemd/user/epicyon-notifications.service" -systemctl --user enable epicyon-notifications.service -systemctl --user daemon-reload -systemctl --user restart epicyon-notifications.service & +#{ echo '[Unit]'; +# echo 'Description=Epicyon Desktop Notifications'; +# echo ''; +# echo '[Service]'; +# echo "WorkingDirectory=${HOME}/.epicyon"; +# echo "ExecStart=/usr/bin/python3 epicyon.py --noKeyPress --notifyType $notificationType --notify $HANDLE --password \"$PASSWORD\""; +# echo 'Type=oneshot'; +# echo 'RemainAfterExit=yes'; +# echo ''; +# echo '[Install]'; +# echo 'WantedBy=default.target'; } > "${HOME}/.config/systemd/user/epicyon-notifications.service" +#systemctl --user daemon-reload +#systemctl --user stop epicyon-notifications.service & +#systemctl --user disable epicyon-notifications.service -zenity --info --width=400 --text "Epicyon notifications are now enabled" +{ echo '#!/bin/bash'; + echo 'cd ~/.epicyon'; + echo "PASSWORD=\$(zenity --width=400 --password --title \"Epicyon Desktop Client\")"; + echo "if [ ! \"\$PASSWORD\" ]; then"; + echo " zenity --warning --width=400 --text \"No password was given\""; + echo ' exit 3'; + echo 'fi'; + echo "python3 epicyon.py --client ${HANDLE} --password \"\$PASSWORD\""; } > ~/epicyon-client +chmod +x ~/epicyon-client + +zenity --info --width=400 --text "Epicyon desktop client is now installed. You can run it with ~/epicyon-client"