shithub: rc-gemd

ref: 220cfb7a23dd0e6f6efb2cabe1389e723073e5b6
dir: /select-handler/

View raw version
#!/bin/rc
rfork n
skel=$rc_gemd_dir^/skel
fs_root=/lib/gem

bind $fs_root $skel^/pages
bind /bin $skel^/bin
bind /rc $skel^/rc
bind -c '#e' $skel^/env
bind $skel /
fs_root=/pages

if(~ $location /)
	location=/index.gem

if(~ $location /search){
	. $rc_gemd_dir/handlers/require-input 'Input a search query'
	echo 20^' '^'text/gemini'^$cr
	sq=`{echo $query | urlencode -d}
	ls $fs_root | grep $"sq | sed '
		s,^'$fs_root'/,,g
		s,^,=> ,g'
	exit
}

exec serve-static