summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--nginx/sites-available/vps16
-rw-r--r--www/Makefile11
-rwxr-xr-xwww/scripts/update-feeds.sh28
-rw-r--r--www/templates/header.html5
4 files changed, 47 insertions, 13 deletions
diff --git a/nginx/sites-available/vps b/nginx/sites-available/vps
index afc5714..b2e40f2 100644
--- a/nginx/sites-available/vps
+++ b/nginx/sites-available/vps
@@ -76,6 +76,10 @@ server {
76 error_log /tmp/cgi info; 76 error_log /tmp/cgi info;
77 } 77 }
78 78
79 location ^~ /links/feeds/ {
80 alias /srv/rss/feeds/;
81 }
82
79 location ~ [^/]$ { 83 location ~ [^/]$ {
80 try_files $uri @rewrite_no_slash; 84 try_files $uri @rewrite_no_slash;
81 } 85 }
@@ -85,13 +89,13 @@ server {
85 rewrite ^(.+)$ $1.html permanent; 89 rewrite ^(.+)$ $1.html permanent;
86 } 90 }
87 91
88 location ~ /$ { 92 #location ~ /$ {
89 try_files $uri @rewrite_slash; 93 # try_files $uri @rewrite_slash;
90 } 94 #}
91 95
92 location @rewrite_slash { 96 #location @rewrite_slash {
93 rewrite ^(.+)/$ $1.html permanent; 97 # rewrite ^(.+)/$ $1.html permanent;
94 } 98 #}
95 99
96 rewrite ^/posts$ /posts/ permanent; 100 rewrite ^/posts$ /posts/ permanent;
97 location = /posts/ { 101 location = /posts/ {
diff --git a/www/Makefile b/www/Makefile
index 699abb2..d54081b 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -4,10 +4,15 @@ ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
4# build html files for public/ 4# build html files for public/
5build: 5build:
6 cd $(ROOT_DIR) 6 cd $(ROOT_DIR)
7 @input_dir=~/log/public \ 7 export input_dir=~/log/public
8 output_dir=/srv/http \ 8 export output_dir=/srv/http
9 scripts/build.sh 9 @scripts/build.sh
10 10
11# Migrage frontmatter from '---' to HTML comment '<!-- -->' 11# Migrage frontmatter from '---' to HTML comment '<!-- -->'
12frontmatter: 12frontmatter:
13 find content -type f -name '*.md' | xargs sed -i ':frontmatter { 1s/^---/<!--/; 1!s/^---/-->/; 1!b}; /^---/ {1b frontmatter}' 13 find content -type f -name '*.md' | xargs sed -i ':frontmatter { 1s/^---/<!--/; 1!s/^---/-->/; 1!b}; /^---/ {1b frontmatter}'
14
15rss:
16 cd /srv/rss
17 export LIST=~/log/public/links/rss.list
18 $(ROOT_DIR)/scripts/update-feeds.sh
diff --git a/www/scripts/update-feeds.sh b/www/scripts/update-feeds.sh
new file mode 100755
index 0000000..8dff837
--- /dev/null
+++ b/www/scripts/update-feeds.sh
@@ -0,0 +1,28 @@
1#! /bin/bash
2
3cd /srv/rss
4mkdir -p feeds
5
6LIST=${LIST:?}
7curlOpts='--insecure'
8
9cat "${LIST}" | while read url interval tags; do
10 feed=feeds/${url//\//%2F}
11 unset next_fetch; declare -i next_fetch=0
12
13 # Get time of next fetch
14 if [ -f $feed ]; then
15 interval=$(<<<"$interval" sed 's/m/minute/; s/h/hour/; s/d/day/;')
16 next_fetch=$(date -d "$(date -r $feed) + $interval" +'%s')
17 fi
18
19 # Do not fetch feed if interval covers current time
20 [ $(date +'%s') -lt $next_fetch ] && continue
21
22 # Set limit of HTTP connections
23 while [ $(jobs -p | wc -l) -ge 10 ]; do
24 sleep 0.5;
25 done
26
27 curl -s $curlOpts $url -o $feed || echo Fail to fetch $url >&2 &
28done
diff --git a/www/templates/header.html b/www/templates/header.html
index a77079a..d5975fd 100644
--- a/www/templates/header.html
+++ b/www/templates/header.html
@@ -4,10 +4,7 @@
4 <a href="/about.html" data-tooltip="About this site">About</a> | 4 <a href="/about.html" data-tooltip="About this site">About</a> |
5 <a href="/posts/">Posts</a> | 5 <a href="/posts/">Posts</a> |
6 <a href="/projects.html" data-tooltip="Not valid now...">Projects</a> | 6 <a href="/projects.html" data-tooltip="Not valid now...">Projects</a> |
7 <!-- 7 <a href="/links/" data-tooltip="Not valid now...">Links</a>
8 <a href="/links.html" data-tooltip="Cool sites you might be interested">Links</a>
9 -->
10 <a href="/links.html" data-tooltip="Not valid now...">Links</a>
11 </nav> 8 </nav>
12 <nav class="right"> 9 <nav class="right">
13 <a href="/rss.xml" data-tooltip="Not valid now...">RSS</a> | 10 <a href="/rss.xml" data-tooltip="Not valid now...">RSS</a> |