summaryrefslogtreecommitdiff
path: root/contrib/fs/gopher.go
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/fs/gopher.go')
-rw-r--r--contrib/fs/gopher.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/contrib/fs/gopher.go b/contrib/fs/gopher.go
index f63785c..e7e4ab9 100644
--- a/contrib/fs/gopher.go
+++ b/contrib/fs/gopher.go
@@ -8,15 +8,15 @@ import (
"strings"
"text/template"
- "tildegit.org/tjp/gus"
- "tildegit.org/tjp/gus/gopher"
+ sr "tildegit.org/tjp/sliderule"
+ "tildegit.org/tjp/sliderule/gopher"
)
// GopherFileHandler builds a handler which serves up files from a file system.
//
// It only serves responses for paths which correspond to files, not directories.
-func GopherFileHandler(fileSystem fs.FS) gus.Handler {
- return gus.HandlerFunc(func(ctx context.Context, request *gus.Request) *gus.Response {
+func GopherFileHandler(fileSystem fs.FS) sr.Handler {
+ return sr.HandlerFunc(func(ctx context.Context, request *sr.Request) *sr.Response {
filepath, file, err := ResolveFile(request, fileSystem)
if err != nil {
return gopher.Error(err).Response()
@@ -39,8 +39,8 @@ func GopherFileHandler(fileSystem fs.FS) gus.Handler {
//
// It requires that files from the provided fs.FS implement fs.ReadDirFile. If
// they don't, it will produce nil responses for all directory paths.
-func GopherDirectoryDefault(fileSystem fs.FS, filenames ...string) gus.Handler {
- return gus.HandlerFunc(func(ctx context.Context, request *gus.Request) *gus.Response {
+func GopherDirectoryDefault(fileSystem fs.FS, filenames ...string) sr.Handler {
+ return sr.HandlerFunc(func(ctx context.Context, request *sr.Request) *sr.Response {
dirpath, dir, err := ResolveDirectory(request, fileSystem)
if err != nil {
return gopher.Error(err).Response()
@@ -71,8 +71,8 @@ func GopherDirectoryDefault(fileSystem fs.FS, filenames ...string) gus.Handler {
//
// A template may be nil, in which case DefaultGopherDirectoryList is used instead. The
// template is then processed with RenderDirectoryListing.
-func GopherDirectoryListing(fileSystem fs.FS, tpl *template.Template) gus.Handler {
- return gus.HandlerFunc(func(ctx context.Context, request *gus.Request) *gus.Response {
+func GopherDirectoryListing(fileSystem fs.FS, tpl *template.Template) sr.Handler {
+ return sr.HandlerFunc(func(ctx context.Context, request *sr.Request) *sr.Response {
dirpath, dir, err := ResolveDirectory(request, fileSystem)
if err != nil {
return gopher.Error(err).Response()
@@ -130,7 +130,7 @@ i {{ $hostname }} {{ $port }}
)
// GuessGopherItemType attempts to find the best gopher item type for a file based on its name.
-func GuessGopherItemType(filepath string) gus.Status {
+func GuessGopherItemType(filepath string) sr.Status {
ext := path.Ext(filepath)
switch ext {
case "txt", "gmi":