diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2024-05-17 23:37:43 +0200 |
---|---|---|
committer | Brian Picciano <mediocregopher@gmail.com> | 2024-05-18 14:47:09 +0200 |
commit | 8d7e708d98a3a46ba3ba08f9c8deeb4838bb8ca5 (patch) | |
tree | 6662c3e4c6c3baaea058a3deaba0d9cfc8e9cc40 /src/gmi/gmi.go | |
parent | fac06df97a47cda6e8989bfc5f40f2a627279b92 (diff) |
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.
Diffstat (limited to 'src/gmi/gmi.go')
-rw-r--r-- | src/gmi/gmi.go | 14 |
1 files changed, 5 insertions, 9 deletions
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) }) } |