From 9a2da81b11ad0064cca24ce7974827d032309369 Mon Sep 17 00:00:00 2001 From: tjpcc Date: Mon, 1 May 2023 07:56:25 -0600 Subject: name change gus -> sliderule --- contrib/fs/spartan.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'contrib/fs/spartan.go') diff --git a/contrib/fs/spartan.go b/contrib/fs/spartan.go index 550f549..70943ee 100644 --- a/contrib/fs/spartan.go +++ b/contrib/fs/spartan.go @@ -6,15 +6,15 @@ import ( "strings" "text/template" - "tildegit.org/tjp/gus" - "tildegit.org/tjp/gus/spartan" + sr "tildegit.org/tjp/sliderule" + "tildegit.org/tjp/sliderule/spartan" ) // SpartanFileHandler builds a handler which serves up files from a filesystem. // // It only serves responses for paths which do not correspond to directories on disk. -func SpartanFileHandler(fileSystem fs.FS) gus.Handler { - return gus.HandlerFunc(func(ctx context.Context, request *gus.Request) *gus.Response { +func SpartanFileHandler(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 spartan.ClientError(err) @@ -41,8 +41,8 @@ func SpartanFileHandler(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 any directory paths. -func SpartanDirectoryDefault(fileSystem fs.FS, filenames ...string) gus.Handler { - return gus.HandlerFunc(func(ctx context.Context, request *gus.Request) *gus.Response { +func SpartanDirectoryDefault(fileSystem fs.FS, filenames ...string) sr.Handler { + return sr.HandlerFunc(func(ctx context.Context, request *sr.Request) *sr.Response { dirpath, dir, response := handleDirSpartan(request, fileSystem) if response != nil { return response @@ -77,8 +77,8 @@ func SpartanDirectoryDefault(fileSystem fs.FS, filenames ...string) gus.Handler // // The tmeplate may be nil, in which cause DefaultSpartanDirectoryList is used instead. The // template is then processed with RenderDirectoryListing. -func SpartanDirectoryListing(filesystem fs.FS, template *template.Template) gus.Handler { - return gus.HandlerFunc(func(ctx context.Context, request *gus.Request) *gus.Response { +func SpartanDirectoryListing(filesystem fs.FS, template *template.Template) sr.Handler { + return sr.HandlerFunc(func(ctx context.Context, request *sr.Request) *sr.Response { dirpath, dir, response := handleDirSpartan(request, filesystem) if response != nil { return response @@ -103,7 +103,7 @@ func SpartanDirectoryListing(filesystem fs.FS, template *template.Template) gus. // DefaultSpartanDirectoryList is a template which renders a reasonable gemtext dir listing. var DefaultSpartanDirectoryList = DefaultGeminiDirectoryList -func handleDirSpartan(request *gus.Request, filesystem fs.FS) (string, fs.ReadDirFile, *gus.Response) { +func handleDirSpartan(request *sr.Request, filesystem fs.FS) (string, fs.ReadDirFile, *sr.Response) { path, dir, err := ResolveDirectory(request, filesystem) if err != nil { return "", nil, spartan.ServerError(err) -- cgit v1.2.3