From 8d7e708d98a3a46ba3ba08f9c8deeb4838bb8ca5 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Fri, 17 May 2024 23:37:43 +0200 Subject: Render posts completely using common rendering methods The aim is to reduce reliance on custom logic in the handlers for every protocol, eventually outsourcing all of it into `render.Methods`, leaving each protocol to simply direct calls to the correct template. --- src/gmi/gmi.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/gmi/gmi.go') diff --git a/src/gmi/gmi.go b/src/gmi/gmi.go index 467ab5a..e37ca74 100644 --- a/src/gmi/gmi.go +++ b/src/gmi/gmi.go @@ -14,14 +14,14 @@ import ( "path/filepath" "strings" - "git.sr.ht/~adnano/go-gemini" - "git.sr.ht/~adnano/go-gemini/certificate" "dev.mediocregopher.com/mediocre-blog.git/src/cache" "dev.mediocregopher.com/mediocre-blog.git/src/cfg" "dev.mediocregopher.com/mediocre-blog.git/src/post" "dev.mediocregopher.com/mediocre-blog.git/src/post/asset" "dev.mediocregopher.com/mediocre-go-lib.git/mctx" "dev.mediocregopher.com/mediocre-go-lib.git/mlog" + "git.sr.ht/~adnano/go-gemini" + "git.sr.ht/~adnano/go-gemini/certificate" ) // Params are used to instantiate a new API instance. All fields are required @@ -37,7 +37,8 @@ type Params struct { ListenAddr string CertificatesPath string - HTTPPublicURL *url.URL + HTTPPublicURL *url.URL + HTTPGeminiGatewayURL *url.URL } // SetupCfg implement the cfg.Cfger interface. @@ -193,12 +194,7 @@ func postsMiddleware(tplHandler gemini.Handler) gemini.Handler { return } - query := r.URL.Query() - query.Set("id", id) - r.URL.RawQuery = query.Encode() - - r.URL.Path = "/posts/post.gmi" - + ctx = withTplPath(ctx, "/posts/post.gmi") tplHandler.ServeGemini(ctx, rw, r) }) } -- cgit v1.2.3