1
0
Fork 0
mirror of https://gitlab.com/niansa/simpsh-httpd.git synced 2025-03-06 20:53:36 +01:00
simpsh-httpd/sendfile.sh
2020-08-02 22:24:46 +02:00

21 lines
640 B
Bash
Executable file

#! /bin/bash
# TODO: Create a Plugin system
# Check: Is it a Directory, a PHP script or something else?
if [[ "$FILE" == *.php ]] && [ "$(which php)" != "" ] && [ "$ENABLE_PHP" = "true" ]; then
CONTENTTYPE="text/html"
. ./httpheaders.sh
php "$FILE" >> $OUTFILE
elif [[ "$FILE" == *.md ]] && [ "$(which markdown)" != "" ] && [ "$ENABLE_MARKDOWN" = "true" ]; then
CONTENTTYPE="text/html"
. ./httpheaders.sh
pandoc -f markdown_github "$FILE" >> $OUTFILE
elif [ -f "${FILE}" ]; then
CONTENTTYPE=$(file -b -i "$FILE")
. ./httpheaders.sh
cat "${FILE}" >> ${OUTFILE}
else
CONTENTTYPE="text/html"
. ./httpheaders.sh
. ./filelist.sh
fi