diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2024-05-18 18:29:19 +0200 |
---|---|---|
committer | Brian Picciano <mediocregopher@gmail.com> | 2024-05-18 18:29:19 +0200 |
commit | 0665d0c65974533fbd313f4e0b062b5103057aeb (patch) | |
tree | 5287795eed9767bd959a5139b77ef78b4024216d /src/render/methods.go | |
parent | ffa26298c95451639a6e01db6692d02d50b3d518 (diff) |
Replace all URL rendering within templates by a URLConstructor
Diffstat (limited to 'src/render/methods.go')
-rw-r--r-- | src/render/methods.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/render/methods.go b/src/render/methods.go index 9b5a41e..ee22dfd 100644 --- a/src/render/methods.go +++ b/src/render/methods.go @@ -56,6 +56,8 @@ type Methods struct { ctx context.Context url *url.URL publicURL *url.URL + httpURL *url.URL + geminiURL *url.URL geminiGatewayURL *url.URL postStore post.Store postAssetStore asset.Store @@ -71,6 +73,8 @@ func NewMethods( ctx context.Context, url *url.URL, publicURL *url.URL, + httpURL *url.URL, + geminiURL *url.URL, geminiGatewayURL *url.URL, postStore post.Store, postAssetStore asset.Store, @@ -81,6 +85,8 @@ func NewMethods( ctx, url, publicURL, + httpURL, + geminiURL, geminiGatewayURL, postStore, postAssetStore, @@ -91,6 +97,10 @@ func NewMethods( } } +func (m *Methods) RootURL() URLBuilder { + return NewURLBuilder(m.publicURL, m.httpURL, m.geminiURL) +} + func (m *Methods) GetTags() ([]string, error) { return m.postStore.GetTags() } @@ -263,7 +273,3 @@ func (m *Methods) GetPath() (string, error) { } func (m *Methods) Add(a, b int) int { return a + b } - -func (m *Methods) URLIsSafe(s string) template.URL { - return template.URL(s) -} |