From 43d8951296ce2f232ca94f0577e2e726291bf783 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sun, 26 May 2024 21:16:02 +0200 Subject: Replace URL building methods with the URLBuilder --- src/render/methods.go | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/render') diff --git a/src/render/methods.go b/src/render/methods.go index 2b8675b..a671f7e 100644 --- a/src/render/methods.go +++ b/src/render/methods.go @@ -57,9 +57,7 @@ type GetPostSeriesNextPreviousRes struct { type Methods struct { ctx context.Context url *url.URL - publicURL *url.URL - httpURL *url.URL - geminiURL *url.URL + urlBuilder URLBuilder geminiGatewayURL *url.URL postStore post.Store postAssetStore asset.Store @@ -74,9 +72,7 @@ type Methods struct { func NewMethods( ctx context.Context, url *url.URL, - publicURL *url.URL, - httpURL *url.URL, - geminiURL *url.URL, + urlBuilder URLBuilder, geminiGatewayURL *url.URL, postStore post.Store, postAssetStore asset.Store, @@ -86,9 +82,7 @@ func NewMethods( return &Methods{ ctx, url, - publicURL, - httpURL, - geminiURL, + urlBuilder, geminiGatewayURL, postStore, postAssetStore, @@ -100,7 +94,7 @@ func NewMethods( } func (m *Methods) RootURL() URLBuilder { - return NewURLBuilder(m.publicURL, m.httpURL, m.geminiURL) + return m.urlBuilder } func (m *Methods) GetTags() ([]string, error) { @@ -300,7 +294,7 @@ func (m *Methods) GetQueryIntValue(key string, def int) (int, error) { } func (m *Methods) GetPath() (string, error) { - basePath := filepath.Join("/", m.publicURL.Path) // in case it's empty + basePath := m.urlBuilder.String() return filepath.Rel(basePath, m.url.Path) } -- cgit v1.2.3