mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of ssh://code.freedombone.net:2222/bashrc/epicyon into main
commit
963c48366c
|
|
@ -8,10 +8,10 @@ fi
|
||||||
|
|
||||||
if [ ! -f /usr/bin/zenity ]; then
|
if [ ! -f /usr/bin/zenity ]; then
|
||||||
if [ -f /usr/bin/apt ]; then
|
if [ -f /usr/bin/apt ]; then
|
||||||
sudo apt install zenity
|
sudo apt -y install zenity
|
||||||
fi
|
fi
|
||||||
if [ -f /usr/bin/pacman ]; then
|
if [ -f /usr/bin/pacman ]; then
|
||||||
sudo pacman -S zenity
|
sudo pacman -S --noconfirm zenity
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -32,19 +32,28 @@ fi
|
||||||
|
|
||||||
if [ ! -f /usr/bin/git ]; then
|
if [ ! -f /usr/bin/git ]; then
|
||||||
if [ -f /usr/bin/apt ]; then
|
if [ -f /usr/bin/apt ]; then
|
||||||
sudo apt install git
|
sudo apt -y install git
|
||||||
fi
|
fi
|
||||||
if [ -f /usr/bin/pacman ]; then
|
if [ -f /usr/bin/pacman ]; then
|
||||||
sudo pacman -S git
|
sudo pacman -S --noconfirm git
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f /usr/bin/gpg ]; then
|
||||||
|
if [ -f /usr/bin/apt ]; then
|
||||||
|
sudo apt -y install gnupg
|
||||||
|
fi
|
||||||
|
if [ -f /usr/bin/pacman ]; then
|
||||||
|
sudo pacman -S --noconfirm gnupg
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f /usr/bin/python3 ]; then
|
if [ ! -f /usr/bin/python3 ]; then
|
||||||
if [ -f /usr/bin/apt ]; then
|
if [ -f /usr/bin/apt ]; then
|
||||||
sudo apt install python3
|
sudo apt -y install python3
|
||||||
fi
|
fi
|
||||||
if [ -f /usr/bin/pacman ]; then
|
if [ -f /usr/bin/pacman ]; then
|
||||||
sudo pacman -S python
|
sudo pacman -S --noconfirm python
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -65,7 +74,7 @@ if [ -f /usr/bin/notify-send ]; then
|
||||||
notificationType='notify-send'
|
notificationType='notify-send'
|
||||||
else
|
else
|
||||||
if [ -f /usr/bin/zenity ]; then
|
if [ -f /usr/bin/zenity ]; then
|
||||||
notificationType='zenity'
|
notificationType='zenity'
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ ! "$notificationType" ]]; then
|
if [[ ! "$notificationType" ]]; then
|
||||||
|
|
@ -73,6 +82,11 @@ if [[ ! "$notificationType" ]]; then
|
||||||
exit 5
|
exit 5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -d ${HOME}/.gnupg ]; then
|
||||||
|
echo 'Generating GPG key'
|
||||||
|
gpg --quick-generate-key "${HANDLE}" ed25519 cert
|
||||||
|
fi
|
||||||
|
|
||||||
{ echo '[Unit]';
|
{ echo '[Unit]';
|
||||||
echo 'Description=Epicyon Desktop Notifications';
|
echo 'Description=Epicyon Desktop Notifications';
|
||||||
echo '';
|
echo '';
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,8 @@ def _speakerEspeak(espeak, pitch: int, rate: int, srange: int,
|
||||||
|
|
||||||
def _speakerPicospeaker(pitch: int, rate: int, systemLanguage: str,
|
def _speakerPicospeaker(pitch: int, rate: int, systemLanguage: str,
|
||||||
sayText: str) -> None:
|
sayText: str) -> None:
|
||||||
|
"""TTS using picospeaker
|
||||||
|
"""
|
||||||
speakerLang = 'en-GB'
|
speakerLang = 'en-GB'
|
||||||
if systemLanguage:
|
if systemLanguage:
|
||||||
if systemLanguage.startswith('fr'):
|
if systemLanguage.startswith('fr'):
|
||||||
|
|
@ -363,6 +365,15 @@ def _readLocalBoxPost(boxName: str, index: int,
|
||||||
sayStr = 'Reading ' + boxName + ' post ' + str(index) + '.'
|
sayStr = 'Reading ' + boxName + ' post ' + str(index) + '.'
|
||||||
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
||||||
|
|
||||||
|
if speakerJson.get('id') and isPGPEncrypted(content):
|
||||||
|
sayStr = 'Encrypted message. Please enter your passphrase.'
|
||||||
|
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
||||||
|
content = pgpDecrypt(content, speakerJson['id'])
|
||||||
|
if isPGPEncrypted(content):
|
||||||
|
sayStr = 'Message could not be decrypted'
|
||||||
|
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
||||||
|
return
|
||||||
|
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
# say the speaker's name
|
# say the speaker's name
|
||||||
|
|
@ -462,7 +473,9 @@ def _showLocalBox(notifyJson: {}, boxName: str,
|
||||||
while len(name) < 16:
|
while len(name) < 16:
|
||||||
name += ' '
|
name += ' '
|
||||||
content = speakerJson['content']
|
content = speakerJson['content']
|
||||||
if speakerJson.get('detectedLinks'):
|
if isPGPEncrypted(content):
|
||||||
|
content = '🔒' + content
|
||||||
|
elif speakerJson.get('detectedLinks'):
|
||||||
if len(speakerJson['detectedLinks']) > 0:
|
if len(speakerJson['detectedLinks']) > 0:
|
||||||
content = '🔗' + content
|
content = '🔗' + content
|
||||||
if len(content) > 40:
|
if len(content) > 40:
|
||||||
|
|
@ -853,15 +866,13 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
if speakerJson.get('id') and \
|
if speakerJson.get('id') and \
|
||||||
isPGPEncrypted(messageStr):
|
isPGPEncrypted(messageStr):
|
||||||
encryptedMessage = True
|
encryptedMessage = True
|
||||||
messageStr = pgpDecrypt(messageStr,
|
|
||||||
speakerJson['id'])
|
|
||||||
|
|
||||||
content = messageStr
|
content = messageStr
|
||||||
if speakerJson.get('content'):
|
if speakerJson.get('content'):
|
||||||
if not encryptedMessage:
|
if not encryptedMessage:
|
||||||
content = speakerJson['content']
|
content = speakerJson['content']
|
||||||
else:
|
else:
|
||||||
content = '🔓 ' + messageStr
|
content = '🔒 Encrypted message'
|
||||||
|
|
||||||
if showNewPosts:
|
if showNewPosts:
|
||||||
# say the speaker's name
|
# say the speaker's name
|
||||||
|
|
@ -877,12 +888,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
nameStr, gender)
|
nameStr, gender)
|
||||||
|
|
||||||
# store incoming post
|
# store incoming post
|
||||||
if encryptedMessage:
|
if encryptedMessage or speakerJson.get('direct'):
|
||||||
speakerJson['content'] = content
|
|
||||||
speakerJson['say'] = messageStr
|
|
||||||
speakerJson['decrypted'] = True
|
|
||||||
_storeMessage(speakerJson, 'dm')
|
|
||||||
elif speakerJson.get('direct'):
|
|
||||||
speakerJson['decrypted'] = False
|
speakerJson['decrypted'] = False
|
||||||
_storeMessage(speakerJson, 'dm')
|
_storeMessage(speakerJson, 'dm')
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue