fix img routing
This commit is contained in:
+1
-1
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user