~moody/rc-gemd

a2cdff91c941cebc075bd5b4421c6634ee15d247 — Moody 7 months ago bf0e251
Add option to display folders as pages of links
2 files changed, 18 insertions(+), 0 deletions(-)

A handlers/dir-index
A handlers/static-or-index
A handlers/dir-index => handlers/dir-index +8 -0
@@ 0,0 1,8 @@
#!/bin/rc
full_path=`{echo $"fs_root^$"location | urlencode -d}
full_path=$"full_path

echo '20 text/gemini'^$cr
ls $full_path | sed '
		s,^'$fs_root'/,,g
		s,^,=> /,g'

A handlers/static-or-index => handlers/static-or-index +10 -0
@@ 0,0 1,10 @@
#!/bin/rc
full_path=`{echo $"fs_root^$"location | urlencode -d}
full_path=$"full_path
if(~ $"location */)
	exec dir-index
if(test -d $full_path){
	location=$location^'/'
	exec dir-index
}
exec serve-static