From 0665d0c65974533fbd313f4e0b062b5103057aeb Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sat, 18 May 2024 18:29:19 +0200 Subject: Replace all URL rendering within templates by a URLConstructor --- src/render/methods.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/render/methods.go') 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) -} -- cgit v1.2.3