Skip to content

Instantly share code, notes, and snippets.

@phx
Last active September 3, 2021 15:11
Show Gist options
  • Save phx/ed35edc41e1769fbcb935f4d887eac13 to your computer and use it in GitHub Desktop.
Save phx/ed35edc41e1769fbcb935f4d887eac13 to your computer and use it in GitHub Desktop.
BUILD_SIGNAL_RELEASE_WITH_LOCKSCREEN

Signal Desktop (with Lock Screen)

(Build script supports MacOS and Linux)

This repository was created as a fix for my lockscreen patch that quit working with Signal Desktop v5.15.0. That repository, which provides more information about the included functionality can be found here.

I try to keep the master branch of this repository up-to-date with the latest release branch of the official Signal-Desktop repo (currently: @@@VERSION@@@).

The only difference is this README.md file and the BUILD_SIGNAL_RELEASE_WITH_LOCKSCREEN.sh.

Development requirements are listed on the official CONTRIBUTING.md from Signal.

Basically you just need the following:

  • sudo
  • git
  • git-lfs
  • nvm

To build the latest release version (version @@@VERSION@@@):

git clone https://github.com/phx/Signal-Desktop-With-Lockscreen
cd signal
./BUILD_SIGNAL_RELEASE_WITH_LOCKSCREEN.sh

Releases will be located in ./releases.

From there, for example, on MacOS, you can just sudo rm -rf /Application/Signal.app and sudo mv releases/macos/Signal.app /Applications/.

You may need to chown -R $USER releases/macos/Signal.app before moving the app.

This will not affect the Signal database, which you will only have problems with if running a newer version before running this version.

#!/usr/bin/env bash
cd $(cd -P -- "$(dirname -- "$0")" && pwd -P)
nvm install "$(cat .nvmrc)"
nvm use
git-lfs install &&\
npm install --global yarn &&\
sudo yarn install --frozen-lockfile || exit 1
if uname -a | grep -q Darwin >/dev/null 2>&1; then
MAC=1
else
MAC=0
fi
if [ $MAC -eq 1 ]; then
SIGNAL_DIR="/Applications/Signal.app/Contents/Resources"
PASSWD_KEY="$HOME/Library/Application Support/Signal/.lockkey"
else
SIGNAL_DIR="/opt/Signal/resources"
PASSWD_KEY="$HOME/.config/Signal/.lockkey"
fi
if [ ! -d "$SIGNAL_DIR" ]; then
mkdir -p "$SIGNAL_DIR"
fi
curl -fskSLo js/lockscreen.js 'https://raw.githubusercontent.com/phx/signal-desktop-lockscreen/master/lockscreen.template.js'
if ! grep -q 'lockscreen.js' background.html >/dev/null 2>&1; then
IFS=''
while read -r line; do
if echo "$line" | grep -q "</body>" >/dev/null 2>&1; then
#echo -e "$line"
echo -e " <script type='text/javascript' src='js/lockscreen.js'></script>"
echo -e "$line"
else
echo -e "$line"
fi
done < "background.html" > "tmp" &&\
mv tmp background.html
fi
sed "s@\*\*\*LOCK_KEY_FILE_HERE\*\*\*@${PASSWD_KEY}@" "js/lockscreen.js" > "tmp" &&\
mv tmp js/lockscreen.js
pass_prompt() {
echo -e "\nThe following password file will be stored at $PASSWD_KEY:\n"
read -r -s -p 'Please type the passphrase you wish to use to unlock Signal: ' PASS1
echo
read -r -s -p 'Please re-type the password for verification: ' PASS2
echo
if [ "$PASS1" != "$PASS2" ]; then
echo "Passwords do not match."
pass_prompt
else
echo "$PASS1" > "$PASSWD_KEY"
fi
}
if [ ! -f "$PASSWD_KEY" ]; then
pass_prompt
fi
sudo yarn grunt &&\
sudo yarn build:webpack &&\
sudo yarn build-release || exit 1
echo '\nReleases are located in ./releases.\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment