From 80ca4a40cd13d6a19e6d9feaa841202b057875f7 Mon Sep 17 00:00:00 2001 From: Nils Date: Sun, 11 Jul 2021 01:28:01 +0200 Subject: [PATCH] add allow_write value --- Debian/run-deb.sh | 7 +++++-- README.md | 1 + docker-compose.yml | 1 + run.sh | 7 +++++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Debian/run-deb.sh b/Debian/run-deb.sh index 4b52ab3..c60d799 100644 --- a/Debian/run-deb.sh +++ b/Debian/run-deb.sh @@ -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 diff --git a/README.md b/README.md index 9502749..0d8474d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index ee2b200..8d725a9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,3 +14,4 @@ services: - pkgs=htop - command=htop - use_tmux=true + - allow_write=false diff --git a/run.sh b/run.sh index e891442..8f82019 100644 --- a/run.sh +++ b/run.sh @@ -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 \ No newline at end of file