summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2020-12-07 09:53:49 +0300
committerAleksey Veresov <aleksey@veresov.pro>2020-12-07 09:53:49 +0300
commit8bb86acc75a348599c706c89715d71b2eae6bed0 (patch)
tree845ed1b1ed936af2ea6e7076f4c5548bf2280a9c
parentdea08ca16cd843b787d109ef66dda67206183a6a (diff)
downloadvsvs-8bb86acc75a348599c706c89715d71b2eae6bed0.tar
vsvs-8bb86acc75a348599c706c89715d71b2eae6bed0.tar.xz
vsvs-8bb86acc75a348599c706c89715d71b2eae6bed0.zip
.
-rw-r--r--site/404.html4
-rw-r--r--site/act/admin3
-rw-r--r--site/act/article5
-rw-r--r--site/act/entry18
-rw-r--r--site/article/butterfly/content (renamed from data/butterfly/content)0
-rw-r--r--site/article/butterfly/title (renamed from data/butterfly/title)0
-rw-r--r--site/article/juniper (renamed from data/juniper)0
-rw-r--r--site/article/licorice (renamed from data/licorice)0
-rw-r--r--site/index.html4
-rw-r--r--site/proc/123/request/cookie2
-rw-r--r--site/proc/123/request/file/avatar1
-rw-r--r--site/proc/123/request/meta4
-rw-r--r--site/proc/123/request/param2
-rw-r--r--site/proc/123/request/urlparam1
-rw-r--r--site/template/admin0
-rw-r--r--site/template/article13
-rwxr-xr-xtitles.sh6
17 files changed, 57 insertions, 6 deletions
diff --git a/site/404.html b/site/404.html
new file mode 100644
index 0000000..49d5ddf
--- /dev/null
+++ b/site/404.html
@@ -0,0 +1,4 @@
+<html>
+<head><title>404 Not Found</title></head>
+<body><p>404 Not Found</p></body>
+</html>
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
diff --git a/data/butterfly/content b/site/article/butterfly/content
index 5ecbc59..5ecbc59 100644
--- a/data/butterfly/content
+++ b/site/article/butterfly/content
diff --git a/data/butterfly/title b/site/article/butterfly/title
index a32b910..a32b910 100644
--- a/data/butterfly/title
+++ b/site/article/butterfly/title
diff --git a/data/juniper b/site/article/juniper
index 66e3d03..66e3d03 100644
--- a/data/juniper
+++ b/site/article/juniper
diff --git a/data/licorice b/site/article/licorice
index 613b1b7..613b1b7 100644
--- a/data/licorice
+++ b/site/article/licorice
diff --git a/site/index.html b/site/index.html
new file mode 100644
index 0000000..e163357
--- /dev/null
+++ b/site/index.html
@@ -0,0 +1,4 @@
+<html>
+<head><title>Welcome!</title></head>
+<body><p>Welcome!</p></body>
+</html>
diff --git a/site/proc/123/request/cookie b/site/proc/123/request/cookie
new file mode 100644
index 0000000..07766a7
--- /dev/null
+++ b/site/proc/123/request/cookie
@@ -0,0 +1,2 @@
+monster-name monster-value
+another-name another-value
diff --git a/site/proc/123/request/file/avatar b/site/proc/123/request/file/avatar
new file mode 100644
index 0000000..61a0691
--- /dev/null
+++ b/site/proc/123/request/file/avatar
@@ -0,0 +1 @@
+Some image, probably PNG. (Too lazy to insert actual one.)
diff --git a/site/proc/123/request/meta b/site/proc/123/request/meta
new file mode 100644
index 0000000..f58e6e5
--- /dev/null
+++ b/site/proc/123/request/meta
@@ -0,0 +1,4 @@
+host veresov.pro
+port 80
+method POST
+secure no
diff --git a/site/proc/123/request/param b/site/proc/123/request/param
new file mode 100644
index 0000000..5bc8bae
--- /dev/null
+++ b/site/proc/123/request/param
@@ -0,0 +1,2 @@
+name Aleksey Veresov
+email aleksey@veresov.pro
diff --git a/site/proc/123/request/urlparam b/site/proc/123/request/urlparam
new file mode 100644
index 0000000..e5e0334
--- /dev/null
+++ b/site/proc/123/request/urlparam
@@ -0,0 +1 @@
+q how many cows?
diff --git a/site/template/admin b/site/template/admin
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/site/template/admin
diff --git a/site/template/article b/site/template/article
new file mode 100644
index 0000000..fec42d7
--- /dev/null
+++ b/site/template/article
@@ -0,0 +1,13 @@
+list
+ page <html>
+ <head><title>List of articles</title></head>
+ <body>
+ <p>Here are some articles for you:</p>
+ <ul>$list</ul>
+ </body>
+ </html>
+ item <li><a href=\"$id\">$title</a></li>
+page <html>
+ <head><title>$title</title></head>
+ <body>$content</body>
+ </html>
diff --git a/titles.sh b/titles.sh
deleted file mode 100755
index 374094a..0000000
--- a/titles.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-export base="$(pwd)/"
-export proc=$$
-mkdir -p "$base/proc/$proc"
-vsvs-extract $'echo "$value" | vsvs-parse \'test "$key" == "title" && echo "$value"\'' data
-rm -r "$base/proc/$proc"