diff options
author | Aleksey Veresov <aleksey@veresov.pro> | 2020-12-07 09:53:49 +0300 |
---|---|---|
committer | Aleksey Veresov <aleksey@veresov.pro> | 2020-12-07 09:53:49 +0300 |
commit | 8bb86acc75a348599c706c89715d71b2eae6bed0 (patch) | |
tree | 845ed1b1ed936af2ea6e7076f4c5548bf2280a9c /site/act | |
parent | dea08ca16cd843b787d109ef66dda67206183a6a (diff) | |
download | vsvs-8bb86acc75a348599c706c89715d71b2eae6bed0.tar vsvs-8bb86acc75a348599c706c89715d71b2eae6bed0.tar.xz vsvs-8bb86acc75a348599c706c89715d71b2eae6bed0.zip |
.
Diffstat (limited to 'site/act')
-rw-r--r-- | site/act/admin | 3 | ||||
-rw-r--r-- | site/act/article | 5 | ||||
-rw-r--r-- | site/act/entry | 18 |
3 files changed, 26 insertions, 0 deletions
diff --git a/site/act/admin b/site/act/admin new file mode 100644 index 0000000..e87c758 --- /dev/null +++ b/site/act/admin @@ -0,0 +1,3 @@ +#!/bin/bash +# Some admin act. (No such now, so 404.) +cat 404.html diff --git a/site/act/article b/site/act/article new file mode 100644 index 0000000..fbd4d5a --- /dev/null +++ b/site/act/article @@ -0,0 +1,5 @@ +#!/bin/bash +if test -z "$1" +then # Response list of articles +else # Response article page +fi diff --git a/site/act/entry b/site/act/entry new file mode 100644 index 0000000..33fd084 --- /dev/null +++ b/site/act/entry @@ -0,0 +1,18 @@ +#!/bin/bash +# This is the process to be called. +# $proc and $base (initial working directory) is already set. +# Requested path is in $1, any other request data is in proc/$proc/request. +# Usually you want to dispatch the path here and call some other programs. =) +# Path has ending / and no starting one (apth for root is empty). +# Response meta should be formed in proc/$proc/response, +# output is response body. +after () { test -z "${2##*$1*}" && echo -n "${2#*$1}"; } +startswith() { case $2 in "$1"*) true;; *) false;; esac; } +if test -z "$1" +then cat index.html +elif startswith "article/" "$1" +then ./act/article "$(after / $1)" +elif startswith "admin/" "$1" +then ./act/admin "$(after / $1)" +else cat 404.html +fi |