fix img routing

This commit is contained in:
Umputun
2018-05-18 02:20:53 -05:00
parent 8c569d2771
commit 3e04384cd7
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -123,7 +123,7 @@ func main() {
DataService: dataService,
Exporter: &exporter,
WebRoot: opts.WebRoot,
ImageProxy: proxy.Image{Enabled: opts.ImageProxy, RoutePath: "/img"},
ImageProxy: proxy.Image{Enabled: opts.ImageProxy, RoutePath: "/api/v1/img"},
Authenticator: auth.Authenticator{
Admins: opts.Admins,
SessionStore: sessionStore,
+1 -1
View File
@@ -123,7 +123,7 @@ func (s *Rest) routes() chi.Router {
ropen.Get("/config", s.configCtrl)
ropen.Post("/preview", s.previewCommentCtrl)
ropen.Mount("/rss", s.rssRoutes())
ropen.Mount("/proxy", s.ImageProxy.Routes())
ropen.Mount("/img", s.ImageProxy.Routes())
})
// protected routes, require auth
+1 -1
View File
@@ -41,7 +41,7 @@ func (p Image) Routes() chi.Router {
if !p.Enabled {
return router
}
router.Get(p.RoutePath, func(w http.ResponseWriter, r *http.Request) {
router.Get("/", func(w http.ResponseWriter, r *http.Request) {
src, err := base64.URLEncoding.DecodeString(r.URL.Query().Get("src"))
if err != nil {
rest.SendErrorJSON(w, r, http.StatusBadRequest, err, "can't decode image url")