summaryrefslogtreecommitdiff
path: root/src/render/methods.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/methods.go')
-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)
}