Browse Source

Generating scuttlebot invites on the mesh

Bob Mottram 7 years ago
parent
commit
fc69415506

BIN
img/avatars/invite.png View File


+ 3
- 0
src/freedombone-image-customise View File

@@ -887,6 +887,9 @@ function configure_user_interface {
887 887
     # USB cloning tool
888 888
     chroot "$rootdir" apt-get -yq install gnome-multi-writer
889 889
 
890
+    # clipboard
891
+    chroot "$rootdir" apt-get -yq install xclip
892
+
890 893
     # Produce a text file on the desktop listing users on the mesh
891 894
     cat <<EOF > $rootdir/usr/bin/list-tox-users
892 895
 #!/bin/bash

+ 10
- 0
src/freedombone-image-mesh View File

@@ -311,6 +311,16 @@ function show_desktop_icons {
311 311
     echo 'Terminal=false' >> /home/$MY_USERNAME/Desktop/audio.desktop
312 312
     echo 'Categories=Application;' >> /home/$MY_USERNAME/Desktop/audio.desktop
313 313
 
314
+    echo '[Desktop Entry]' > /home/$MY_USERNAME/Desktop/invite.desktop
315
+    echo 'Version=1.0' >> /home/$MY_USERNAME/Desktop/invite.desktop
316
+    echo 'Name=Create Invite' >> /home/$MY_USERNAME/Desktop/invite.desktop
317
+    echo 'Type=Application' >> /home/$MY_USERNAME/Desktop/invite.desktop
318
+    echo 'Comment=Create an invite for Patchwork or Ferment' >> /home/$MY_USERNAME/Desktop/invite.desktop
319
+    echo 'Exec=mate-terminal -e freedombone-mesh-invite' >> /home/$MY_USERNAME/Desktop/invite.desktop
320
+    echo 'Icon=/usr/share/freedombone/avatars/invite.png' >> /home/$MY_USERNAME/Desktop/invite.desktop
321
+    echo 'Terminal=false' >> /home/$MY_USERNAME/Desktop/invite.desktop
322
+    echo 'Categories=Application;' >> /home/$MY_USERNAME/Desktop/invite.desktop
323
+
314 324
     # set permissions
315 325
     chmod +x /home/$MY_USERNAME/Desktop/*.desktop
316 326
     chown ${MY_USERNAME}:${MY_USERNAME} /home/$MY_USERNAME/Desktop/*

+ 46
- 0
src/freedombone-mesh-invite View File

@@ -0,0 +1,46 @@
1
+#!/bin/bash
2
+#
3
+# .---.                  .              .
4
+# |                      |              |
5
+# |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
6
+# |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
7
+# '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
8
+#
9
+#                    Freedom in the Cloud
10
+#
11
+# Creates a scuttlebot invite for use with Ferment or Patchwork
12
+#
13
+# License
14
+# =======
15
+#
16
+# This program is free software: you can redistribute it and/or modify
17
+# it under the terms of the GNU Affero General Public License as published by
18
+# the Free Software Foundation, either version 3 of the License, or
19
+# (at your option) any later version.
20
+#
21
+# This program is distributed in the hope that it will be useful,
22
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
+# GNU Affero General Public License for more details.
25
+#
26
+# You should have received a copy of the GNU Affero General Public License
27
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
28
+
29
+PROJECT_NAME='freedombone'
30
+
31
+export TEXTDOMAIN=${PROJECT_NAME}-mesh-invite
32
+export TEXTDOMAINDIR="/usr/share/locale"
33
+
34
+invite=$(su -c 'sbot invite.create 1' - scuttlebot | awk -F '"' '{print $2}')
35
+
36
+if [ ${#invite} -lt 10 ]; then
37
+   dialog --title $"Create Invite" \
38
+          --msgbox $"\nThe invite could not be created" 7 70
39
+fi
40
+
41
+echo "$invite" | xclip -selection c
42
+
43
+dialog --title $"Create Invite" \
44
+       --msgbox $"\nThe invite has been copied to the clipboard.\n\nYou can paste it with CTRL+v" 9 70
45
+
46
+exit 0