From ff2e640bdeff3ab1b4fb3c2fae896157f67e4f40 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 9 Apr 2016 20:51:37 +0100 Subject: [PATCH] Syncthing devices on user control panel --- src/freedombone-controlpanel-user | 38 ++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/src/freedombone-controlpanel-user b/src/freedombone-controlpanel-user index f091ee59..a98c6910 100755 --- a/src/freedombone-controlpanel-user +++ b/src/freedombone-controlpanel-user @@ -616,6 +616,20 @@ function menu_admin { fi } +function syncthing_devices { + SYNCTHING_CONFIG_FILE=~/.syncthingids + SYNCTHING_ID=$(cat ~/.syncthing-server-id) + if [ ! -f $SYNCTHING_CONFIG_FILE ]; then + echo $'# Your syncthing configuration file' > $SYNCTHING_CONFIG_FILE + echo '#' >> $SYNCTHING_CONFIG_FILE + echo $"# The ${PROJECT_NAME} syncthing ID is: $SYNCTHING_ID" + echo '#' >> $SYNCTHING_CONFIG_FILE + echo '# Paste the IDs of your devices below' >> $SYNCTHING_CONFIG_FILE + echo '#' >> $SYNCTHING_CONFIG_FILE + fi + editor $SYNCTHING_CONFIG_FILE +} + function menu_top_level { while true do @@ -623,18 +637,19 @@ function menu_top_level { trap "rm -f $data" 0 1 2 5 15 dialog --backtitle $"Freedombone User Control Panel" \ --title $"User Control Panel" \ - --radiolist $"Choose an operation:" 18 50 11 \ + --radiolist $"Choose an operation:" 19 50 12 \ 1 $"Use Email" off \ 2 $"Change Email Filtering Rules" off \ 3 $"Use Tox Chat" off \ 4 $"Use XMPP Chat" off \ 5 $"Use IRC" off \ 6 $"Browse the Web" off \ - 7 $"Your Encryption Keys" off \ - 8 $"Set an outgoing email proxy" off \ - 9 $"Administrator controls" off \ - 10 $"Exit to the command line" off \ - 11 $"Log out" on 2> $data + 7 $"Syncthing devices" off \ + 8 $"Your Encryption Keys" off \ + 9 $"Set an outgoing email proxy" off \ + 10 $"Administrator controls" off \ + 11 $"Exit to the command line" off \ + 12 $"Log out" on 2> $data sel=$? case $sel in 1) exit 1;; @@ -647,11 +662,12 @@ function menu_top_level { 4) torify profanity;; 5) torify irssi;; 6) torify elinks;; - 7) menu_encryption_keys;; - 8) smtp_proxy;; - 9) menu_admin;; - 10) break;; - 11) kill -HUP `pgrep -s 0 -o`;; + 7) syncthing_devices;; + 8) menu_encryption_keys;; + 9) smtp_proxy;; + 10) menu_admin;; + 11) break;; + 12) kill -HUP `pgrep -s 0 -o`;; esac done }