add allow_write value

This commit is contained in:
Nils 2021-07-11 01:28:01 +02:00
parent 66fe5e35ed
commit 80ca4a40cd
Signed by: byreqz
GPG Key ID: 396A62D7D436749E
4 changed files with 12 additions and 4 deletions

View File

@ -6,6 +6,9 @@ fi
if [ -n "$userpass" ];then
creds="-c "$userpass""
fi
if [ "$allow_write" == "true" ];then
allow_write="-w"
fi
if [ -z "$title" ];then
title=gotty
fi
@ -20,7 +23,7 @@ if [ -z "$command" ];then
fi
if [ "$use_tmux" == "false" ];then
/gotty -p "$port" $creds --title-format "$title" "$command"
/gotty -p "$port" $allow_write $creds --title-format "$title" "$command"
else
/gotty -p "$port" $creds --title-format "$title" tmux new-session -A -s "$title" "$command"
/gotty -p "$port" $allow_write $creds --title-format "$title" tmux new-session -A -s "$title" "$command"
fi

View File

@ -25,6 +25,7 @@ this is a dynamically built gotty container
- pkgs - additional packages to install when the container is started (optional, def. none)
- command - the command to run (required, def. none/pfetch)
- use_tmux - either open a subshell for every page load (false) or just attach to a single shell started at the beginning (true) (optional, def. true)
- allow_write - allow users to send input, should be used with auth (optional, def. false)
## compose
this example can also be found in the repo

View File

@ -14,3 +14,4 @@ services:
- pkgs=htop
- command=htop
- use_tmux=true
- allow_write=false

7
run.sh
View File

@ -6,6 +6,9 @@ fi
if [ -n "$userpass" ];then
creds="-c "$userpass""
fi
if [ "$allow_write" == "true" ];then
allow_write="-w"
fi
if [ -z "$title" ];then
title=gotty
fi
@ -20,7 +23,7 @@ if [ -z "$command" ];then
fi
if [ "$use_tmux" == "false" ];then
/gotty -p "$port" $creds --title-format "$title" "$command"
/gotty -p "$port" $allow_write $creds --title-format "$title" "$command"
else
/gotty -p "$port" $creds --title-format "$title" tmux new-session -A -s "$title" "$command"
/gotty -p "$port" $allow_write $creds --title-format "$title" tmux new-session -A -s "$title" "$command"
fi