diff --git a/code/.dockerignore b/code/.dockerignore new file mode 100644 index 0000000..96eac8b --- /dev/null +++ b/code/.dockerignore @@ -0,0 +1,3 @@ +*.pyc +__pycache__ +*.swp diff --git a/code/Dockerfile b/code/Dockerfile index a7fadcc..e5ef3e8 100644 --- a/code/Dockerfile +++ b/code/Dockerfile @@ -11,10 +11,7 @@ COPY docker-requirements.txt /requirements.txt RUN pip3 install -r /requirements.txt COPY static /code/static COPY templates /code/templates -COPY utils/__init__.py /code/utils/__init__.py -COPY utils/files.py /code/utils/files.py -COPY utils/misc.py /code/utils/misc.py -COPY utils/crypt.py /code/utils/crypt.py +COPY utils /code/utils COPY revprox.py /code/revprox.py COPY notifier.py /code/notifier.py COPY app.py /code/app.py diff --git a/code/app.py b/code/app.py index bcf3968..b54d58d 100644 --- a/code/app.py +++ b/code/app.py @@ -13,7 +13,7 @@ from revprox import ReverseProxied from utils import * -__FLEES_VERSION__ = "20190830.0" +__FLEES_VERSION__ = "20191020.0" app = Flask(__name__) app.config.from_object(__name__) config_values = read_config(app) diff --git a/code/templates/flip b/code/templates/flip index 609718e..86af539 100755 --- a/code/templates/flip +++ b/code/templates/flip @@ -72,6 +72,8 @@ _simple_list() { } _write() { + # stdin is open + [ -t 0 ] || stream_in=1 # no file mentioned, use the name as file [[ -z "$FILE" ]] && { [[ -e "$NAME" ]] && { @@ -80,24 +82,28 @@ _write() { NAME=$( basename "$NAME" ) } } - # stdin is open, use stdin - [ -t 0 ] || stream_in=1 + [[ -e "$FILE" ]] && { + # Input file exists, dont use stream + stream_in=0 + } - [ -t 0 ] && [[ -z "$FILE" ]] && { + [[ $stream_in -ne 1 ]] && [[ -z "$FILE" ]] && { _msg File to read needed, or use stdin exit 1 } _msg "Writing $NAME" [[ "$stream_in" -eq 1 ]] && { _write_stdin "$NAME" - } || { - [[ -d "$FILE" ]] && { - [[ "${NAME,,}" = *".tar" ]] || NAME="${NAME}".tar - _write_folder "$NAME" "$FILE" - } || { - _write_file "$NAME" "$FILE" - } + return $? } + + [[ -d "$FILE" ]] && { + [[ "${NAME,,}" = *".tar" ]] || NAME="${NAME}".tar + _write_folder "$NAME" "$FILE" + return $? + } + + _write_file "$NAME" "$FILE" } _write_folder() { # name, file