From 2fb7fb949611325bcbea6fd34b9b8594d885c6e8 Mon Sep 17 00:00:00 2001 From: arno Date: Fri, 14 Jan 2022 20:52:21 +0100 Subject: [PATCH 1/4] add curl and unzip before first use (#2886) --- build_sdcard.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build_sdcard.sh b/build_sdcard.sh index 2f62c88a4..5ea69715f 100755 --- a/build_sdcard.sh +++ b/build_sdcard.sh @@ -116,6 +116,10 @@ range_argument(){ fi } +echo -e "\n*** SOFTWARE UPDATE ***" +general_utils="curl" +sudo apt install -y ${general_utils} + ## use default values for variables if empty # INTERACTION @@ -272,7 +276,7 @@ echo -e "\n*** SOFTWARE UPDATE ***" # psmisc -> install killall, fuser # ufw -> firewall # sqlite3 -> database -general_utils="htop git curl bash-completion vim jq dphys-swapfile bsdmainutils autossh telnet vnstat parted dosfstools btrfs-progs fbi sysbench build-essential dialog bc python3-dialog" +general_utils="htop git curl bash-completion vim jq dphys-swapfile bsdmainutils autossh telnet vnstat parted dosfstools btrfs-progs fbi sysbench build-essential dialog bc python3-dialog unzip" python_dependencies="python3-venv python3-dev python3-wheel python3-jinja2 python3-pip" server_utils="rsync net-tools xxd netcat openssh-client openssh-sftp-server sshpass psmisc ufw sqlite3" [ "${baseimage}" = "armbian" ] && armbian_dependencies="armbian-config" # add armbian-config From 33ed2af24a42e4a89bc8a525d25cb793c2a9bc63 Mon Sep 17 00:00:00 2001 From: Christoph Stenglein <9399034+cstenglein@users.noreply.github.com> Date: Fri, 14 Jan 2022 20:53:10 +0100 Subject: [PATCH 2/4] (webui): disable yarn 3 telemetry (#2874) --- home.admin/config.scripts/blitz.web.ui.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/home.admin/config.scripts/blitz.web.ui.sh b/home.admin/config.scripts/blitz.web.ui.sh index ecda65cef..b2ea7de83 100755 --- a/home.admin/config.scripts/blitz.web.ui.sh +++ b/home.admin/config.scripts/blitz.web.ui.sh @@ -49,6 +49,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then /home/admin/config.scripts/bonus.nodejs.sh on source <(/home/admin/config.scripts/bonus.nodejs.sh info) sudo npm install --global yarn + ${NODEPATH}/yarn config set --home enableTelemetry 0 ${NODEPATH}/yarn install ${NODEPATH}/yarn build From 7a7693caa6552ed769556b53387e1f54d3eb09b0 Mon Sep 17 00:00:00 2001 From: d11n Date: Sat, 15 Jan 2022 11:00:36 +0100 Subject: [PATCH 3/4] JoinMarket Web UI (#2747) * Add JoinMarket Web UI * Update webserver config * Add update option * Improve logging for api service * Improve install and update script * Update version and install process * Use correct onion service script * Ensure JoinMarket is installed * add joinmarket-webui precheck to load wallet.dat --- README.md | 12 +- home.admin/_provision_.sh | 9 + .../sites-available/joinmarket_webui.conf | 34 ++ .../sites-available/joinmarket_webui_ssl.conf | 37 +++ .../sites-available/joinmarket_webui_tor.conf | 34 ++ .../joinmarket_webui_tor_ssl.conf | 37 +++ .../config.scripts/bonus.joinmarket-webui.sh | 299 ++++++++++++++++++ 7 files changed, 457 insertions(+), 5 deletions(-) create mode 100644 home.admin/assets/nginx/sites-available/joinmarket_webui.conf create mode 100644 home.admin/assets/nginx/sites-available/joinmarket_webui_ssl.conf create mode 100644 home.admin/assets/nginx/sites-available/joinmarket_webui_tor.conf create mode 100644 home.admin/assets/nginx/sites-available/joinmarket_webui_tor_ssl.conf create mode 100755 home.admin/config.scripts/bonus.joinmarket-webui.sh diff --git a/README.md b/README.md index 0d520abc3..e11e6cfcd 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ There are further Services that can be switched on: * **SpecterDesktop** (Multisig Trezor, Ledger, COLDCARDwallet & Specter-DIY) [details](https://github.com/cryptoadvance/specter-desktop) [app connection guide](https://d11n.net/connect-specter-desktor-with-raspiblitz.html) * **Lightning Terminal (Loop, Pool & Faraday)** (Manage Channel Liquidity) [details](https://github.com/lightninglabs/lightning-terminal#lightning-terminal-lit) * **JoinMarket** (CoinJoin Service) [details](https://github.com/JoinMarket-Org/joinmarket-clientserver) +* **JoinMarket Web UI** (Browser-based interface for JoinMarket) [details](https://github.com/joinmarket-webui/joinmarket-webui) * **ThunderHub** (Lightning Node Manager WebUI) [details](https://www.thunderhub.io/) * **Balance Of Satoshis** (Commands for working with LND balances) [details](https://github.com/alexbosworth/balanceofsatoshis/blob/master/README.md) * **Kindle Display** (Bitcoin Status Display made with a jailbroken Kindle) [details](https://github.com/dennisreimann/kindle-display) @@ -347,7 +348,7 @@ A RaspberryPi 3 has a very low power CPU and syncing+validating the blockchain d #### 2. COPY - Copy from Laptop or another RaspiBlitz over Local Network If you have a friend that is already running a synced RaspiBlitz or you have a laptop with enough free space on the hard drive that can download & validate the Blockchain much faster you can also choose the `COPY` option. -You can then delete existing blockchain your RaspiBlitz already started syncing for you +You can then delete existing blockchain your RaspiBlitz already started syncing for you ![SSH4](pictures/ssh4-copy.png) @@ -965,7 +966,7 @@ IP2TOR is a tunnel service where you can run your RaspiBlitz anonymously behind You don't need to care about your local router or firewall settings. You can pay for this service directly through Lightning from your RaspiBlitz as subscription. -At first you select what services of your RaspiBlitz you like to tunnel through a IP2TOR bridge. +At first you select what services of your RaspiBlitz you like to tunnel through a IP2TOR bridge. You will get a list of available IP2TOR bridge offerings. Select `OK` on an IP2TOR bridge offering and you will see more details on it, such as how many satoshis the subscription will cost you. @@ -983,7 +984,8 @@ To try out the IP2TOR tunnel choose in `MAINMENU` the extra menu point of the Se If you want a web service, like BTCPay Server or LNbits, to be available to the outside internet (like with IP2TOR) people expect you to offer an HTTPS address so that the communication between the client and your RaspiBlitz is encrypted. You could use the self-signed HTTPS certificate that RaspiBlitz is offering you, but this will give users Security Warnings in their browser and is not very user friendly. -That's where you can use a LetsEncrypt Subscription to get a free valid HTTPS certificate that is accepted without warning by most browsers. + +That's where you can use a LetsEncrypt Subscription to get a free valid HTTPS certificate that is excepted without warning from almost all common browsers Because you also need a domain name for that you will need to open a free account, the following are presently supported, would be good to add more with the help of the community: [DuckDNS.org](https://www.duckdns.org) @@ -1173,7 +1175,7 @@ Instructions for Migration: * shutdown your old node * remove the SD card * [download the latest Raspiblitz sd card image & flash it to your sd card](#downloading-the-software) -* if you want to use a HDMI monitor for status & progress, create a empty file called `hdmi` (without any ending) on the SD card while connected to your laptop +* if you want to use a HDMI monitor for status & progress, create a empty file called `hdmi` (without any ending) on the SD card while connected to your laptop * [insert sd card, boot up & login by SSH](#boot-your-raspiblitz) Now RaspiBlitz should show you that old data from your node was detected and offer to do the migration for you. @@ -1225,7 +1227,7 @@ The latest version of this file is needed to recover all your funds. In case your HDD gets damaged RaspiBlitz always keeps a copy of the latest version of the `channel.backup` file on the SD card within the sub-directories of: `/home/admin/.lnd/data/chain/`. If you want to go one step further in securing your funds against total loss of the RaspiBlitz (gets completely damaged, stolen or lost), then you can additionally set up an off-location or cloud backup of the `channel.backup` file. -The file itself is encrypted by your word seed so it's acceptable to store the file with untrusted third parties for backup purposes (if you want) +The file itself is encrypted by your word seed so it's acceptable to store the file with untrusted third parties for backup purposes (if you want) This video explains in detail how you can set further back Static Channel information: diff --git a/home.admin/_provision_.sh b/home.admin/_provision_.sh index f9979e1e3..fbaaf5cca 100755 --- a/home.admin/_provision_.sh +++ b/home.admin/_provision_.sh @@ -571,6 +571,15 @@ else echo "Provisioning JoinMarket - keep default" >> ${logFile} fi +# JoinMarket Web UI +if [ "${joinmarketWebUI}" = "on" ]; then + echo "Provisioning JoinMarket Web UI - run config script" >> ${logFile} + sudo sed -i "s/^message=.*/message='Setup JoinMarket Web UI'/g" ${infoFile} + sudo /home/admin/config.scripts/bonus.joinmarket-webui.sh on >> ${logFile} 2>&1 +else + echo "Provisioning JoinMarket Web UI - keep default" >> ${logFile} +fi + # Specter if [ "${specter}" = "on" ]; then echo "Provisioning Specter - run config script" >> ${logFile} diff --git a/home.admin/assets/nginx/sites-available/joinmarket_webui.conf b/home.admin/assets/nginx/sites-available/joinmarket_webui.conf new file mode 100644 index 000000000..06e3775c3 --- /dev/null +++ b/home.admin/assets/nginx/sites-available/joinmarket_webui.conf @@ -0,0 +1,34 @@ +## joinmarket_webui.conf + +server { + listen 7500; + listen [::1]:7500; + server_name _; + + access_log /var/log/nginx/access_joinmarket_webui.log; + error_log /var/log/nginx/error_joinmarket_webui.log; + + gzip on; + gzip_types application/javascript application/json text/css image/svg+xml; + + root /home/joinmarket/webui/build; + index index.html; + + location /api/ { + include /etc/nginx/snippets/proxy-params.conf; + proxy_pass https://127.0.0.1:28183; + } + + location /ws/ { + include /etc/nginx/snippets/proxy-params.conf; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $http_connection; + proxy_pass https://127.0.0.1:28183; + } + + location / { + include /etc/nginx/snippets/proxy-params.conf; + try_files $uri $uri/ /index.html; + add_header Cache-Control no-cache; + } +} diff --git a/home.admin/assets/nginx/sites-available/joinmarket_webui_ssl.conf b/home.admin/assets/nginx/sites-available/joinmarket_webui_ssl.conf new file mode 100644 index 000000000..0382cefb7 --- /dev/null +++ b/home.admin/assets/nginx/sites-available/joinmarket_webui_ssl.conf @@ -0,0 +1,37 @@ +## joinmarket_webui_ssl.conf + +server { + listen 7501 ssl; + listen [::]:7501 ssl; + server_name _; + + include /etc/nginx/snippets/ssl-params.conf; + include /etc/nginx/snippets/ssl-certificate-app-data.conf; + + access_log /var/log/nginx/access_joinmarket_webui.log; + error_log /var/log/nginx/error_joinmarket_webui.log; + + gzip on; + gzip_types application/javascript application/json text/css image/svg+xml; + + root /home/joinmarket/webui/build; + index index.html; + + location /api/ { + include /etc/nginx/snippets/ssl-proxy-params.conf; + proxy_pass https://127.0.0.1:28183; + } + + location /ws/ { + include /etc/nginx/snippets/proxy-params.conf; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $http_connection; + proxy_pass https://127.0.0.1:28183; + } + + location / { + include /etc/nginx/snippets/ssl-proxy-params.conf; + try_files $uri $uri/ /index.html; + add_header Cache-Control no-cache; + } +} diff --git a/home.admin/assets/nginx/sites-available/joinmarket_webui_tor.conf b/home.admin/assets/nginx/sites-available/joinmarket_webui_tor.conf new file mode 100644 index 000000000..657825281 --- /dev/null +++ b/home.admin/assets/nginx/sites-available/joinmarket_webui_tor.conf @@ -0,0 +1,34 @@ +## joinmarket_webui_tor.conf + +server { + listen 7502; + listen [::1]:7502; + server_name _; + + access_log /var/log/nginx/access_joinmarket_webui.log; + error_log /var/log/nginx/error_joinmarket_webui.log; + + gzip on; + gzip_types application/javascript application/json text/css image/svg+xml; + + root /home/joinmarket/webui/build; + index index.html; + + location /api/ { + include /etc/nginx/snippets/proxy-params.conf; + proxy_pass https://127.0.0.1:28183; + } + + location /ws/ { + include /etc/nginx/snippets/proxy-params.conf; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $http_connection; + proxy_pass https://127.0.0.1:28183; + } + + location / { + include /etc/nginx/snippets/proxy-params.conf; + try_files $uri $uri/ /index.html; + add_header Cache-Control no-cache; + } +} diff --git a/home.admin/assets/nginx/sites-available/joinmarket_webui_tor_ssl.conf b/home.admin/assets/nginx/sites-available/joinmarket_webui_tor_ssl.conf new file mode 100644 index 000000000..5bbe88e67 --- /dev/null +++ b/home.admin/assets/nginx/sites-available/joinmarket_webui_tor_ssl.conf @@ -0,0 +1,37 @@ +## joinmarket_webui_tor_ssl.conf + +server { + listen 7503 ssl; + listen [::1]:7503 ssl; + server_name _; + + include /etc/nginx/snippets/ssl-params.conf; + include /etc/nginx/snippets/ssl-certificate-app-data-tor.conf; + + access_log /var/log/nginx/access_joinmarket_webui.log; + error_log /var/log/nginx/error_joinmarket_webui.log; + + gzip on; + gzip_types application/javascript application/json text/css image/svg+xml; + + root /home/joinmarket/webui/build; + index index.html; + + location /api/ { + include /etc/nginx/snippets/ssl-proxy-params.conf; + proxy_pass https://127.0.0.1:28183; + } + + location /ws/ { + include /etc/nginx/snippets/proxy-params.conf; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $http_connection; + proxy_pass https://127.0.0.1:28183; + } + + location / { + include /etc/nginx/snippets/ssl-proxy-params.conf; + try_files $uri $uri/ /index.html; + add_header Cache-Control no-cache; + } +} diff --git a/home.admin/config.scripts/bonus.joinmarket-webui.sh b/home.admin/config.scripts/bonus.joinmarket-webui.sh new file mode 100755 index 000000000..5419bdf76 --- /dev/null +++ b/home.admin/config.scripts/bonus.joinmarket-webui.sh @@ -0,0 +1,299 @@ +#!/bin/bash + +# https://github.com/joinmarket-webui/joinmarket-webui + +USERNAME=joinmarket +HOME_DIR=/home/$USERNAME +REPO=joinmarket-webui/joinmarket-webui +APP_DIR=webui +RASPIBLITZ_INFO=/home/admin/raspiblitz.info +RASPIBLITZ_CONF=/mnt/hdd/raspiblitz.conf +WEBUI_VERSION=0.0.2 + +# command info +if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then + echo "config script to switch joinmarket_webui on or off" + echo "bonus.joinmarket-webui.sh [on|off|menu|update|update commit|precheck]" + exit 1 +fi + +# check and load raspiblitz config to know which network is running +source $RASPIBLITZ_INFO +source $RASPIBLITZ_CONF + + +# show info menu +if [ "$1" = "menu" ]; then + isInstalled=$(sudo ls $HOME_DIR 2>/dev/null | grep -c "$APP_DIR") + if [ ${isInstalled} -eq 1 ]; then + # get network info + localip=$(hostname -I | awk '{print $1}') + toraddress=$(sudo cat /mnt/hdd/tor/joinmarket-webui/hostname 2>/dev/null) + fingerprint=$(openssl x509 -in /mnt/hdd/app-data/nginx/tls.cert -fingerprint -noout | cut -d"=" -f2) + + if [ "${runBehindTor}" = "on" ] && [ ${#toraddress} -gt 0 ]; then + # Info with TOR + /home/admin/config.scripts/blitz.display.sh qr "${toraddress}" + whiptail --title " JoinMarket Web UI " --msgbox "Open in your local web browser: +http://${localip}:7500\n +https://${localip}:7501 with Fingerprint: +${fingerprint}\n +Hidden Service address for TOR Browser (see LCD for QR):\n${toraddress} +" 16 67 + /home/admin/config.scripts/blitz.display.sh hide + else + # Info without TOR + whiptail --title " JoinMarket Web UI " --msgbox "Open in your local web browser & accept self-signed cert: +http://${localip}:7500\n +https://${localip}:7501 with Fingerprint: +${fingerprint}\n +Activate TOR to access the web interface from outside your local network. +" 15 57 + fi + echo "please wait ..." + else + echo "*** JOINMARKET WEB UI NOT INSTALLED ***" + fi + exit 0 +fi + + +# switch on +if [ "$1" = "1" ] || [ "$1" = "on" ]; then + isInstalled=$(sudo ls $HOME_DIR 2>/dev/null | grep -c "$APP_DIR") + if [ ${isInstalled} -eq 0 ]; then + # check if joinmarket is installed + if [ -f "/home/joinmarket/.joinmarket/joinamrket.cfg" ]; then + echo "# JoinMarket is already installed and configured." + else + sudo /home/admin/config.scripts/bonus.joinmarket.sh on + fi + + echo "*** INSTALL JOINMARKET WEB UI ***" + + # install nodeJS + /home/admin/config.scripts/bonus.nodejs.sh on + + # install JoinMarket Web UI + cd $HOME_DIR + + sudo -u $USERNAME wget https://github.com/$REPO/archive/refs/tags/v$WEBUI_VERSION.tar.gz + sudo -u $USERNAME tar -xzf v$WEBUI_VERSION.tar.gz + sudo -u $USERNAME rm v$WEBUI_VERSION.tar.gz + sudo -u $USERNAME mv joinmarket-webui-$WEBUI_VERSION $APP_DIR + + cd $APP_DIR + sudo -u $USERNAME rm -rf docker + sudo -u $USERNAME npm install + if ! [ $? -eq 0 ]; then + echo "FAIL - npm install did not run correctly, aborting" + exit 1 + fi + + sudo -u $USERNAME npm run build + + ################## + # NGINX + ################## + # setup nginx symlinks + if ! [ -f /etc/nginx/sites-available/joinmarket_webui_ssl.conf ]; then + sudo cp -f /home/admin/assets/nginx/sites-available/joinmarket_webui_ssl.conf /etc/nginx/sites-available/joinmarket_webui_ssl.conf + fi + if ! [ -f /etc/nginx/sites-available/joinmarket_webui_tor.conf ]; then + sudo cp /home/admin/assets/nginx/sites-available/joinmarket_webui_tor.conf /etc/nginx/sites-available/joinmarket_webui_tor.conf + fi + if ! [ -f /etc/nginx/sites-available/joinmarket_webui_tor_ssl.conf ]; then + sudo cp /home/admin/assets/nginx/sites-available/joinmarket_webui_tor_ssl.conf /etc/nginx/sites-available/joinmarket_webui_tor_ssl.conf + fi + sudo ln -sf /etc/nginx/sites-available/joinmarket_webui_ssl.conf /etc/nginx/sites-enabled/ + sudo ln -sf /etc/nginx/sites-available/joinmarket_webui_tor.conf /etc/nginx/sites-enabled/ + sudo ln -sf /etc/nginx/sites-available/joinmarket_webui_tor_ssl.conf /etc/nginx/sites-enabled/ + sudo nginx -t + sudo systemctl reload nginx + + # open the firewall + echo "*** Updating Firewall ***" + sudo ufw allow from any to any port 7500 comment 'allow JoinMarket Web UI HTTP' + sudo ufw allow from any to any port 7501 comment 'allow JoinMarket Web UI HTTPS' + echo "" + + # SSL + if ! [ -d $HOME_DIR/.joinmarket/ssl ]; then + sudo -u $USERNAME mkdir -p $HOME_DIR/.joinmarket/ssl + fi + if ! [ -f $HOME_DIR/.joinmarket/ssl/cert.pem ]; then + sudo ln -sf /mnt/hdd/app-data/nginx/tls.cert $HOME_DIR/.joinmarket/ssl/cert.pem + sudo chown $USERNAME:$USERNAME $HOME_DIR/.joinmarket/ssl/cert.pem + fi + if ! [ -f $HOME_DIR/.joinmarket/ssl/key.pem ]; then + sudo ln -sf /mnt/hdd/app-data/nginx/tls.key $HOME_DIR/.joinmarket/ssl/key.pem + sudo chown $USERNAME:$USERNAME $HOME_DIR/.joinmarket/ssl/key.pem + fi + + ################## + # SYSTEMD SERVICE + ################## + + echo "# Install JoinMarket API systemd" + echo "\ +# Systemd unit for JoinMarket API + +[Unit] +Description=JoinMarket API daemon +# Make sure lnd starts after bitcoind is ready +Requires=bitcoind.service +After=bitcoind.service + +[Service] +WorkingDirectory=$HOME_DIR/joinmarket-clientserver/scripts/ +ExecStartPre=/home/admin/config.scripts/bonus.joinmarket-webui.sh precheck +ExecStart=/bin/sh -c '. $HOME_DIR/joinmarket-clientserver/jmvenv/bin/activate && python jmwalletd.py' +User=joinmarket +Group=joinmarket +Restart=always +TimeoutSec=120 +RestartSec=30 +# Hardening measures +PrivateTmp=true +ProtectSystem=full +NoNewPrivileges=true +PrivateDevices=true + +[Install] +WantedBy=multi-user.target +" | sudo tee /etc/systemd/system/joinmarket-api.service + sudo systemctl enable joinmarket-api + + # setting value in raspiblitz config + sudo sed -i "s/^joinmarketWebUI=.*/joinmarketWebUI=on/g" $RASPIBLITZ_CONF + + # Hidden Service for joinmarket-webui if Tor is active + if [ "${runBehindTor}" = "on" ]; then + # make sure to keep in sync with internet.tor.sh script + /home/admin/config.scripts/tor.onion-service.sh joinmarket-webui 80 7502 443 7503 + fi + source $RASPIBLITZ_INFO + if [ "${state}" == "ready" ]; then + echo "# OK - the joinmarket-api.service is enabled, system is ready so starting service" + sudo systemctl start joinmarket-api + else + echo "# OK - the joinmarket-api.service is enabled, to start manually use: 'sudo systemctl start joinmarket-api'" + fi + else + echo "*** JOINMARKET WEB UI ALREADY INSTALLED ***" + fi + exit 0 +fi + + +# precheck +if [ "$1" = "precheck" ]; then + if [ $(/usr/local/bin/bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf listwallets | grep -c wallet.dat) -eq 0 ];then + echo "# Create wallet.dat" + /usr/local/bin/bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf createwallet wallet.dat + else + echo "# The wallet.dat is loaded in bitcoind." + fi + exit 0 +fi + + +# update +if [ "$1" = "update" ]; then + isInstalled=$(sudo ls $HOME_DIR 2>/dev/null | grep -c "$APP_DIR") + if [ ${isInstalled} -eq 1 ]; then + echo "*** UPDATE JOINMARKET WEB UI ***" + cd $HOME_DIR + + if [ "$2" = "commit" ]; then + echo "# Updating to the latest commit in the default branch" + sudo -u $USERNAME wget https://github.com/$REPO/archive/refs/heads/master.tar.gz + sudo -u $USERNAME tar -xzf master.tar.gz + sudo -u $USERNAME rm -rf master.tar.gz + sudo -u $USERNAME mv joinmarket-webui-master $APP_DIR-update + else + version=$(curl --silent "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/') + cd $APP_DIR + current=$(node -p "require('./package.json').version") + cd .. + if [ "$current" = "$version" ]; then + echo "*** JOINMARKET WEB UI IS ALREADY UPDATED TO LATEST VERSION ***" + exit 0 + fi + sudo -u $USERNAME wget https://github.com/$REPO/archive/refs/tags/v$version.tar.gz + sudo -u $USERNAME tar -xzf v$version.tar.gz + sudo -u $USERNAME rm v$version.tar.gz + sudo -u $USERNAME mv joinmarket-webui-$version $APP_DIR-update + fi + + cd $APP_DIR-update + sudo -u $USERNAME rm -rf docker + sudo -u $USERNAME npm install + if ! [ $? -eq 0 ]; then + echo "FAIL - npm install did not run correctly, aborting" + exit 1 + fi + + sudo -u $USERNAME npm run build + if ! [ $? -eq 0 ]; then + echo "FAIL - npm run build did not run correctly, aborting" + exit 1 + fi + cd .. + sudo -u $USERNAME rm -rf $APP_DIR + sudo -u $USERNAME mv $APP_DIR-update $APP_DIR + + echo "*** JOINMARKET WEB UI UPDATED ***" + else + echo "*** JOINMARKET WEB UI NOT INSTALLED ***" + fi + + exit 0 +fi + + +# switch off +if [ "$1" = "0" ] || [ "$1" = "off" ]; then + isInstalled=$(sudo ls $HOME_DIR 2>/dev/null | grep -c "$APP_DIR") + if [ ${isInstalled} -eq 1 ]; then + echo "*** UNINSTALL JOINMARKET WEB UI ***" + + # remove systemd service + sudo systemctl stop joinmarket-api + sudo systemctl disable joinmarket-api + sudo rm -f /etc/systemd/system/joinmarket-api.service + + # close ports on firewall + sudo ufw delete allow from any to any port 7500 comment 'allow JoinMarket Web UI HTTP' + sudo ufw delete allow from any to any port 7501 comment 'allow JoinMarket Web UI HTTPS' + + # remove nginx symlinks + sudo rm -f /etc/nginx/sites-enabled/joinmarket_webui_* + sudo rm -f /etc/nginx/sites-available/joinmarket_webui_* + sudo nginx -t + sudo systemctl reload nginx + + # Hidden Service if Tor is active + if [ "${runBehindTor}" = "on" ]; then + /home/admin/config.scripts/internet.hiddenservice.sh off joinmarket-webui + fi + + # remove the app + sudo rm -rf $HOME_DIR/$APP_DIR + + # remove SSL + sudo rm -rf $HOME_DIR/.joinmarket/ssl + + # setting value in raspi blitz config + sudo sed -i "s/^joinmarketWebUI=.*/joinmarketWebUI=off/g" $RASPIBLITZ_CONF + + echo "OK JOINMARKET WEB UI removed." + else + echo "*** JOINMARKET WEB UI NOT INSTALLED ***" + fi + + exit 0 +fi + +echo "FAIL - Unknown Parameter $1" +exit 1 From f65adc3a1fff151d569286b81030c1b31e76703a Mon Sep 17 00:00:00 2001 From: openoms Date: Sat, 15 Jan 2022 12:19:26 +0000 Subject: [PATCH 4/4] cl feeadjuster: fix off option #2888 --- home.admin/config.scripts/cl-plugin.feeadjuster.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home.admin/config.scripts/cl-plugin.feeadjuster.sh b/home.admin/config.scripts/cl-plugin.feeadjuster.sh index 60f9fc596..2628ead89 100644 --- a/home.admin/config.scripts/cl-plugin.feeadjuster.sh +++ b/home.admin/config.scripts/cl-plugin.feeadjuster.sh @@ -11,10 +11,10 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then fi source <(/home/admin/config.scripts/network.aliases.sh getvars cl $2) +plugin="feeadjuster" if [ "$1" = "on" ];then - plugin="feeadjuster" if [ ! -f "/home/bitcoin/cl-plugins-available/plugins/${plugin}/${plugin}.py" ]; then cd /home/bitcoin/cl-plugins-available || exit 1 sudo -u bitcoin git clone https://github.com/lightningd/plugins.git