summaryrefslogtreecommitdiff
path: root/contrib/fs/gemini.go
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/fs/gemini.go')
-rw-r--r--contrib/fs/gemini.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/contrib/fs/gemini.go b/contrib/fs/gemini.go
index 21ca32d..fbf8d08 100644
--- a/contrib/fs/gemini.go
+++ b/contrib/fs/gemini.go
@@ -6,15 +6,15 @@ import (
"strings"
"text/template"
- "tildegit.org/tjp/gus"
- "tildegit.org/tjp/gus/gemini"
+ sr "tildegit.org/tjp/sliderule"
+ "tildegit.org/tjp/sliderule/gemini"
)
// GeminiFileHandler builds a handler which serves up files from a file system.
//
// It only serves responses for paths which do not correspond to directories on disk.
-func GeminiFileHandler(fileSystem fs.FS) gus.Handler {
- return gus.HandlerFunc(func(ctx context.Context, request *gus.Request) *gus.Response {
+func GeminiFileHandler(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 gemini.Failure(err)
@@ -41,8 +41,8 @@ func GeminiFileHandler(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 GeminiDirectoryDefault(fileSystem fs.FS, filenames ...string) gus.Handler {
- return gus.HandlerFunc(func(ctx context.Context, request *gus.Request) *gus.Response {
+func GeminiDirectoryDefault(fileSystem fs.FS, filenames ...string) sr.Handler {
+ return sr.HandlerFunc(func(ctx context.Context, request *sr.Request) *sr.Response {
dirpath, dir, response := handleDirGemini(request, fileSystem)
if response != nil {
return response
@@ -77,8 +77,8 @@ func GeminiDirectoryDefault(fileSystem fs.FS, filenames ...string) gus.Handler {
//
// The template may be nil, in which case DefaultGeminiDirectoryList is used instead. The
// template is then processed with RenderDirectoryListing.
-func GeminiDirectoryListing(fileSystem fs.FS, template *template.Template) gus.Handler {
- return gus.HandlerFunc(func(ctx context.Context, request *gus.Request) *gus.Response {
+func GeminiDirectoryListing(fileSystem fs.FS, template *template.Template) sr.Handler {
+ return sr.HandlerFunc(func(ctx context.Context, request *sr.Request) *sr.Response {
dirpath, dir, response := handleDirGemini(request, fileSystem)
if response != nil {
return response
@@ -109,7 +109,7 @@ var DefaultGeminiDirectoryList = template.Must(template.New("gemini_dirlist").Pa
=> ../
`[1:]))
-func handleDirGemini(request *gus.Request, fileSystem fs.FS) (string, fs.ReadDirFile, *gus.Response) {
+func handleDirGemini(request *sr.Request, fileSystem fs.FS) (string, fs.ReadDirFile, *sr.Response) {
path, dir, err := ResolveDirectory(request, fileSystem)
if err != nil {
return "", nil, gemini.Failure(err)