summaryrefslogtreecommitdiff
path: root/apps/blagh/app.rc
diff options
context:
space:
mode:
authorGravatar Jeremiah Dow <jeremdow@gmail.com> 2011-03-15 23:58:45 -0400
committerGravatar Jeremiah Dow <jeremdow@gmail.com> 2011-03-15 23:58:45 -0400
commit5fbd62e4dfe508c6f1164ac57a17433f57bf1c87 (patch)
treedc9d9711eceabeac5b5b091477570e2fd9741b75 /apps/blagh/app.rc
parent100a09cc7534c5c10c72c7f70109c77564191b07 (diff)
downloadjeremdow.us-5fbd62e4dfe508c6f1164ac57a17433f57bf1c87.tar.gz
better index handling for blagh app
Diffstat (limited to 'apps/blagh/app.rc')
-rw-r--r--apps/blagh/app.rc21
1 files changed, 19 insertions, 2 deletions
diff --git a/apps/blagh/app.rc b/apps/blagh/app.rc
index 71bcef6..a2e231e 100644
--- a/apps/blagh/app.rc
+++ b/apps/blagh/app.rc
@@ -32,7 +32,7 @@ fn blagh_init {
ll_add handlers_bar_left echo '<a href="'$blagh_uri'new_post">Make a new post</a>'
}
- if(~ $req_path $blagh_uri) {
+ if(~ $req_path $blagh_uri /*/) {
handler_body_main=blagh_body
u=$blagh_uri'index'
extraHeaders=$"extraHeaders ^ \
@@ -88,7 +88,24 @@ fn blagh_body {
fn get_post_list {
# /./->/|/ done to sort -t| and order by date
# Note: $paths in blagh_dirs should not contain '/./' or '|'
- ls -F $*^/./[0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]/ >[2]/dev/null | sed -n '/'^$forbidden_uri_chars^'/d; s,/\./,/|/,; /\/$/p' | sort -r '-t|' +1 | sed -e 's,/+\|/+,/,' -e $conf_max_posts_per_page^'q'
+ eval ls -F $*^/./`{req_path_date}/ >[2]/dev/null | sed -n '/'^$forbidden_uri_chars^'/d; s,/\./,/|/,; /\/$/p' | sort -r '-t|' +1 | sed -e 's,/+\|/+,/,' -e $conf_max_posts_per_page^'q'
+}
+
+fn req_path_date {
+ year=`{echo $req_path | awk -F'/' '{print $2}'}
+ month=`{echo $req_path | awk -F'/' '{print $3}'}
+ day =`{echo $req_path | awk -F'/' '{print $4}'}
+
+ if(~ $year '')
+ year='[0-9][0-9][0-9][0-9]'
+
+ if(~ $month '')
+ month='[0-9][0-9]'
+
+ if(~ $day '')
+ day='[0-9][0-9]'
+
+ echo $year/$month/$day
}
fn mkbpost {