~moody/rc-gemd

rc-gemd/select-handler -rwxr-xr-x 312 bytes
8b3ea55d — Jacob Moody path name should be cleaned, prevents $fs_root escape 29 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/rc
fs_root=/lib/gem
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