From cade848b78d7f06b69a195f5a543b23c25eedd14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tel=C3=A9rico=20Jones?= Date: Sat, 29 May 2021 21:09:08 -0300 Subject: blog.sh project start --- index.sh | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100755 index.sh (limited to 'index.sh') diff --git a/index.sh b/index.sh new file mode 100755 index 0000000..16eb31c --- /dev/null +++ b/index.sh @@ -0,0 +1,95 @@ +#!/bin/bash + +if [ "$REQUEST_URI" = '/favicon.ico' ]; then + exit 0 +fi + +RESPONSE_CONTENT_TYPE="text/html" +STATUS=200 + +HEADER_TITLE='source ./programadores/Jefferson Júlio/site/home.sh' +HEADER_TITLE_MOBILE='cd ./programadores/ && \\ ;> source Jefferson Júlio/\\ ;> site/home.sh' + +urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } + +html () { + cat < + + + jefferson.sh + + + + + + + $(source ./nav.sh) + $(source ./header.sh) + +
+ $BODY +
+ + $(source ./footer.sh) + + +HTML +} + +router () { + REQUEST_URI=$(urldecode "$REQUEST_URI") + + case "$REQUEST_URI" in + /) + BODY=$(source ./pages/home.sh) + ;; + /contato) + HEADER_TITLE="source ./pages/contato.sh" + HEADER_TITLE_MOBILE="$HEADER_TITLE" + BODY=$(source ./pages/contato.sh) + ;; + /artigo/*.txt) + ARTICLE_FILE=./pages/articles/${REQUEST_URI/\/artigo\//} + HEADER_TITLE="cat $ARTICLE_FILE" + HEADER_TITLE_MOBILE="$HEADER_TITLE" + BODY=$(source ./pages/article.sh) + ;; + /json) + RESPONSE_CONTENT_TYPE="application/json" + STATUS=200 + BODY=$(cat <