|
|
|
@ -33,8 +33,9 @@ type rendererGetPostSeriesNextPreviousRes struct { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type renderer struct { |
|
|
|
|
url *url.URL |
|
|
|
|
postStore post.Store |
|
|
|
|
url *url.URL |
|
|
|
|
postStore post.Store |
|
|
|
|
httpPublicURL *url.URL |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (r renderer) GetPosts(page, count int) (rendererGetPostsRes, error) { |
|
|
|
@ -98,7 +99,9 @@ func (r renderer) PostBody(p post.StoredPost) (string, error) { |
|
|
|
|
return filepath.Join("/posts", id) |
|
|
|
|
}, |
|
|
|
|
StaticURL: func(path string) string { |
|
|
|
|
return filepath.Join("/static", path) |
|
|
|
|
httpPublicURL := *r.httpPublicURL |
|
|
|
|
httpPublicURL.Path = filepath.Join(httpPublicURL.Path, "/static", path) |
|
|
|
|
return httpPublicURL.String() |
|
|
|
|
}, |
|
|
|
|
Image: func(args ...string) (string, error) { |
|
|
|
|
|
|
|
|
@ -207,8 +210,9 @@ func (a *api) tplHandler() (gemini.Handler, error) { |
|
|
|
|
buf := new(bytes.Buffer) |
|
|
|
|
|
|
|
|
|
err := tpl.Execute(buf, renderer{ |
|
|
|
|
url: r.URL, |
|
|
|
|
postStore: a.params.PostStore, |
|
|
|
|
url: r.URL, |
|
|
|
|
postStore: a.params.PostStore, |
|
|
|
|
httpPublicURL: a.params.HTTPPublicURL, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|