summaryrefslogtreecommitdiff
path: root/src/render
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2024-05-26 21:16:02 +0200
committerBrian Picciano <mediocregopher@gmail.com>2024-05-26 21:16:02 +0200
commit43d8951296ce2f232ca94f0577e2e726291bf783 (patch)
treea04793b1e15e10040201dfafd1c25c649030f72c /src/render
parenta6342a3748beaee1ec3c2dc662af6deec0c3959d (diff)
Replace URL building methods with the URLBuilder
Diffstat (limited to 'src/render')
-rw-r--r--src/render/methods.go16
1 files changed, 5 insertions, 11 deletions
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)
}