From a601aba795adadd278cebc0afab0b58afe8b7866 Mon Sep 17 00:00:00 2001 From: niansa Date: Sun, 15 Jul 2018 09:30:30 +0000 Subject: [PATCH] Update mkdeb.sh, config.sh, sendfile.sh files --- config.sh | 3 +++ mkdeb.sh | 2 +- sendfile.sh | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/config.sh b/config.sh index 03666ac..908f86f 100644 --- a/config.sh +++ b/config.sh @@ -24,6 +24,9 @@ WEBSITE="http://localhost:$PORT" # Should PHP be enabled? You need to install php-cli package to use it. May be false or true ENABLE_PHP="false" +# Should Markdown be enabled? You need to install markdown package to use it. May be false or true +ENABLE_MARKDOWN="false" + # Error code pages, they need to be HTML documents ERROR404="${FILES}/404.html" ERROR403="${FILES}/403.html" \ No newline at end of file diff --git a/mkdeb.sh b/mkdeb.sh index f30389c..d3f8124 100644 --- a/mkdeb.sh +++ b/mkdeb.sh @@ -19,7 +19,7 @@ Maintainer: nisa/niansa Priority: extra Architecture: all Depends: bash, socat -Recommends: php7.2-cli +Recommends: php7.2-cli, markdown Description: An usable bash-httpserver with easy configuration and very simple PHP' > ~/simpsh-httpd-pkg/DEBIAN/control cd .. diff --git a/sendfile.sh b/sendfile.sh index 6b540ec..7436c47 100644 --- a/sendfile.sh +++ b/sendfile.sh @@ -5,6 +5,10 @@ if [[ "$FILE" == *.php ]] && [ "$(which php)" != "" ] && [ "$ENABLE_PHP" = "true CONTENTTYPE="text/html" . ./httpheaders.sh php "$FILE" >> $OUTFILE +elif [[ "$FILE" == *.md ]] && [ "$(which markdown)" != "" ] && [ "$ENABLE_MARKDOWN" = "true" ]; then + CONTENTTYPE="text/html" + . ./httpheaders.sh + markdown -b "$FILES" "$FILE" >> $OUTFILE elif [ -f "${FILE}" ]; then CONTENTTYPE=$(file -b -i "$FILE") . ./httpheaders.sh