summary refs log tree commit diff
path: root/ssh-command.sh
blob: f91c5b1a3167d3ab2702fa838997485fa9234b26 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
set -e -u

SSH_HOST=stream@ascii.town

if [ -z "${SSH_ORIGINAL_COMMAND:-}" ]; then
    echo
    echo 'Welcome to Twinch!'
    echo
    echo 'To view a public stream, run one of the following commands:'
    echo

    cd public
    for id in *; do
        echo "ssh -t $SSH_HOST $id"
    done
    echo

    exit

else
    set $SSH_ORIGINAL_COMMAND
    case $1 in
        ingest) exec ingest private/${2##*/} ;;
        view) exec view public/${2##*/} ;;
        *) exec view public/${1##*/} ;;
    esac
fi