2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-16 04:36:02 +00:00

50_Signalbot: Mandatory signal-cli v0.11.2 update

git-svn-id: https://svn.fhem.de/fhem/trunk@26492 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Adimarantis 2022-10-06 19:28:36 +00:00
parent ced68eb209
commit e7b12602ad
3 changed files with 18 additions and 34 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- change: 50_Signalbot: Mandatory signal-cli v0.11.2 update
- change: 88_HMCCU: Fixed set pct/level bug
- change: 37_SHC: Support current smarthomatic version.
Basestation uses 115200 Baud by default and CRC.

View File

@ -1,6 +1,6 @@
##############################################
#$Id$
my $Signalbot_VERSION="3.10";
my $Signalbot_VERSION="3.11";
# Simple Interface to Signal CLI running as Dbus service
# Author: Adimarantis
# License: GPL
@ -33,6 +33,7 @@ use FHEM::Text::Unicode qw(:ALL);
use vars qw(%FW_webArgs); # all arguments specified in the GET
use vars qw($FW_detail); # currently selected device for detail view
use vars qw($FW_RET);
use vars qw($FW_wname);
#maybe really get introspective here instead of handwritten list
my %signatures = (
@ -1832,7 +1833,8 @@ sub Signalbot_createRegfiles($) {
if (! -d "www/signal") {
mkdir("www/signal");
}
my $http="http";
$http="https" if (AttrVal($FW_wname,"HTTPS",0) eq 1);
my $fh;
#1. For Windows
my $tmpfilename="www/signal/signalcaptcha.reg";
@ -1843,8 +1845,8 @@ sub Signalbot_createRegfiles($) {
$msg .= '[HKEY_CLASSES_ROOT\signalcaptcha\shell]'."\n";
$msg .= '[HKEY_CLASSES_ROOT\signalcaptcha\shell\open]'."\n";
$msg .= '[HKEY_CLASSES_ROOT\signalcaptcha\shell\open\command]'."\n";
$msg .= '@="powershell.exe Start-Process -FilePath ( $(\'http://';
$msg .= $ip;
$msg .= '@="powershell.exe Start-Process -FilePath ( $(\'';
$msg .= $http."://".$ip;
$msg .= ':8083/fhem?cmd=set%%20'.$hash->{NAME}.'%%20captcha%%20\'+($(\'%1\')';
#Captcha has an extra "\" at the end which makes replacing with CSRF a bit more complicated
if ($FW_CSRF ne "") {
@ -1863,7 +1865,7 @@ sub Signalbot_createRegfiles($) {
$tmpfilename="www/signal/signalcaptcha.desktop";
$msg = "[Desktop Entry]\n";
$msg .= "Name=Signalcaptcha\n";
$msg .= 'Exec=xdg-open http://'.$ip.':8083/fhem?cmd=set%%20'.$hash->{NAME}.'%%20captcha%%20%u'.$FW_CSRF."\n";
$msg .= 'Exec=xdg-open '.$http.'://'.$ip.':8083/fhem?cmd=set%%20'.$hash->{NAME}.'%%20captcha%%20%u'.$FW_CSRF."\n";
$msg .= "Type=Application\n";
$msg .= "Terminal=false\n";
$msg .= "StartupNotify=false\n";
@ -1965,21 +1967,18 @@ sub Signalbot_Detail {
my $multi=$hash->{helper}{multi};
my $version=$hash->{helper}{version};
$multi=0 if !defined $multi;
if($version<900) {
$ret .= "<b>signal-cli v0.9.0+ required.</b><br>Please use installer to install or update<br>";
if($version<1100) {
$ret .= "<b>signal-cli v0.11.2+ required.</b><br>Please use installer to install or update<br>";
$ret .= "<b>Note:</b> The installer only supports Debian based Linux distributions like Ubuntu and Raspberry OS<br>";
$ret .= " and X86 or armv7l CPUs<br>";
}
if($version==901) {
$ret .= "<b>Warning: signal-cli v0.9.1 has issues affecting Signalbot.</b><br>Please use installer to upgrade to 0.9.2+<br>";
}
if ($multi==0 && $version>0) {
$ret .= "Signal-cli is running in single-mode, please consider starting it without -u parameter (e.g. by re-running the installer)<br>";
}
if($version<900 || $multi==0) {
if($version<1100 || $multi==0) {
$ret .= '<br>You can download the installer <a href="www/signal/signal_install.sh" download>here</a> or your www/signal directory and run it with<br><b>sudo ./signal_install.sh</b><br><br>';
}
return $ret if ($hash->{helper}{version}<900);
return $ret if ($hash->{helper}{version}<1100);
my $current=ReadingsVal($name,"account","none");
my $account=$hash->{helper}{register};

View File

@ -1,14 +1,13 @@
#!/bin/bash
#$Id:$
SCRIPTVERSION="3.9"
SCRIPTVERSION="3.10"
# Author: Adimarantis
# License: GPL
#Install script for signal-cli
SIGNALPATH=/opt
SIGNALUSER=signal-cli
LIBPATH=/usr/lib
SIGNALVERSION="0.9.2" #Default for systems that don't hava Java17
ALTVERSION="0.10.9" #Default for systems with Java17
SIGNALVERSION="0.11.2"
SIGNALVAR=/var/lib/$SIGNALUSER
DBSYSTEMD=/etc/dbus-1/system.d
DBSYSTEMS=/usr/share/dbus-1/system-services
@ -33,23 +32,16 @@ if [ -e "/opt/java" ]; then
fi
JVER=`$JAVACMD --version | grep -m1 -o '[0-9][0-9]\.[0-9]'`
if [ "$J17" != "" ] || [ "$JVER" = "17.0" ]; then
SIGNALVERSION=$ALTVERSION
VEXT="-Linux"
JAVA_VERSION=17.0
NATIVE_JAVA17=yes
else
JAVA_VERSION=11.0
echo "Warning: No Java17 found - will try experimental download of a Java 17 package"
JAVA_VERSION=17.0
NATIVE_JAVA17=no
VEXT=
fi
if [ "$OPERATION" = "experimental" ]; then
SIGNALVERSION=$ALTVERSION
VEXT="-Linux"
JAVA_VERSION=17.0
OPERATION=
fi
#Get OS data
if [ -e /etc/os-release ]; then
source /etc/os-release
@ -179,7 +171,7 @@ fi
GLIBC=`ldd --version | grep -m1 -o '[0-9]\.[0-9][0-9]' | head -n 1`
IDENTSTR=$ARCH-glibc$GLIBC-$SIGNALVERSION
KNOWN=("amd64-glibc2.27-0.9.2" "amd64-glibc2.28-0.9.2" "amd64-glibc2.31-0.9.2" "armhf-glibc2.28-0.9.2" "armhf-glibc2.31-0.9.2" "amd64-glibc2.28-0.10.9" "amd64-glibc2.31-0.10.9" "armhf-glibc2.28-0.10.9" "armhf-glibc2.31-0.10.9")
KNOWN=("amd64-glibc2.28-0.11.2" "amd64-glibc2.31-0.11.2" "armhf-glibc2.28-0.11.2" "armhf-glibc2.31-0.11.2")
GETLIBS=1
if [[ ! " ${KNOWN[*]} " =~ " ${IDENTSTR} " ]]; then
@ -379,18 +371,10 @@ if [ $NEEDINSTALL = 1 ]; then
echo -n "Downloading native libraries..."
cd /tmp
rm -rf libsignal_jni.so libzkgroup.so
if [ $JAVA_VERSION = "11.0" ]; then
wget -qN https://github.com/bublath/FHEM-Signalbot/raw/main/$IDENTSTR/libzkgroup.so
fi
wget -qN https://github.com/bublath/FHEM-Signalbot/raw/main/$IDENTSTR/libsignal_jni.so
echo "done"
echo "Updating native libs for $IDENTSTR"
if [ $JAVA_VERSION = "11.0" ]; then
zip -u $SIGNALPATH/signal/lib/zkgroup-java-*.jar libzkgroup.so
zip -u $SIGNALPATH/signal/lib/signal-client-java-*.jar libsignal_jni.so
else
zip -u $SIGNALPATH/signal/lib/libsignal-client-*.jar libsignal_jni.so
fi
zip -u $SIGNALPATH/signal/lib/libsignal-client-*.jar libsignal_jni.so
#Use updated libs in jar instead of /usr/lib
#mv libsignal_jni.so libzkgroup.so $LIBPATH