aboutsummaryrefslogtreecommitdiff
path: root/index.sh
diff options
context:
space:
mode:
Diffstat (limited to 'index.sh')
-rwxr-xr-xindex.sh39
1 files changed, 24 insertions, 15 deletions
diff --git a/index.sh b/index.sh
index 16eb31c..76d8c8d 100755
--- a/index.sh
+++ b/index.sh
@@ -4,14 +4,25 @@ if [ "$REQUEST_URI" = '/favicon.ico' ]; then
exit 0
fi
+SCRIPT_DIR="$( cd "$( dirname "$(readlink -f "$0")" )" >/dev/null 2>&1 && pwd )"
+source ./config.sh
+
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'
+HEADER_TITLE='cd programadores/;cd Jefferson\\ Julio/;source jefferson.sh'
+HEADER_TITLE_MOBILE="$HEADER_TITLE"
urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
+status-ok () {
+ [ "$STATUS" -gt 199 ] && [ "$STATUS" -lt 300 ] && echo 1
+}
+
+strip-html-tags () {
+ echo "$1" | sed 's/<[^>]*>//g'
+}
+
html () {
cat <<HTML
<html lang="pt-br">
@@ -19,15 +30,13 @@ html () {
<meta charset="utf-8" />
<title>jefferson.sh</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
-
- <style>
- $(cat ./styles.css)
- </style>
+ <link rel="stylesheet" href="/static/styles.css" />
+ <link rel="manifest" href="/static/manifest.json">
</head>
<body>
- $(source ./nav.sh)
$(source ./header.sh)
+ $(source ./nav.sh)
<main>
$BODY
@@ -47,14 +56,14 @@ router () {
BODY=$(source ./pages/home.sh)
;;
/contato)
- HEADER_TITLE="source ./pages/contato.sh"
+ 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"
+ /$ARTICLES_PATH*.txt)
+ ARTICLE_FILE=.$REQUEST_URI
+ HEADER_TITLE="ARTICLE_FILE=$ARTICLE_FILE source pages/article.sh"
+ HEADER_TITLE_MOBILE="export ARTICLE_FILE=$ARTICLE_FILE;source pages/article.sh"
BODY=$(source ./pages/article.sh)
;;
/json)
@@ -69,9 +78,9 @@ JSON
;;
*)
STATUS=404
- HEADER_TITLE="cat .$REQUEST_URI"
- HEADER_TITLE_MOBILE="$HEADER_TITLE"
- BODY="<p class='err-404'>cat: .$REQUEST_URI: Arquivo ou diretório inexistente</p>"
+ HEADER_TITLE="REQUEST_FILE=.$REQUEST_URI source page.sh"
+ HEADER_TITLE_MOBILE="export REQUEST_FILE=.$REQUEST_URI;source page.sh"
+ BODY="<p class='err-404'>404: .$REQUEST_URI: Arquivo ou diretório inexistente</p>"
;;
esac
}