summary refs log tree commit diff
path: root/ssh-command.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ssh-command.sh31
1 files changed, 27 insertions, 4 deletions
diff --git a/ssh-command.sh b/ssh-command.sh
index 98b959e..8461d3b 100644
--- a/ssh-command.sh
+++ b/ssh-command.sh
@@ -1,9 +1,10 @@
 #!/bin/sh
 set -e -u
 
-SSH_HOST=stream@ascii.town
+SSH_URL=stream@ascii.town
+GIT_URL=git@ascii.town:stream.git
 
-if [ -z "${SSH_ORIGINAL_COMMAND:-}" ]; then
+welcome() {
     echo
     echo 'Welcome to Twinch!'
     echo
@@ -12,15 +13,37 @@ if [ -z "${SSH_ORIGINAL_COMMAND:-}" ]; then
 
     cd public
     for id in *; do
-        echo "    ssh -t $SSH_HOST $id"
+        echo "    ssh -t $SSH_URL $id"
     done
     echo
+}
 
-    exit
+start() {
+    local key
+    key=$(setup $1)
+    echo
+    echo 'Stream created!'
+    echo
+    echo 'To view the stream, run:'
+    echo
+    echo "    ssh -t $SSH_URL $1"
+    echo
+    echo 'To broadcast to the stream, run:'
+    echo
+    echo "    git clone $GIT_URL"
+    echo "    cd stream"
+    echo "    make broadcast"
+    echo "    ./broadcast | ssh $SSH_URL ingest $key"
+    echo
+}
 
+if [ -z "${SSH_ORIGINAL_COMMAND:-}" ]; then
+    welcome
+    exit
 else
     set $SSH_ORIGINAL_COMMAND
     case $1 in
+        start) start ${2##*/} ;;
         ingest) exec ingest private/${2##*/} ;;
         view) exec view public/${2##*/} ;;
         *) exec view public/${1##*/} ;;
d>June McEnroe 2019-07-24Warn when date has changedJune McEnroe 2019-07-24Add whenJune McEnroe When? Now. 2019-07-24Remove histedit from bitJune McEnroe