2018-02-09 13:56:11 -06:00
|
|
|
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
|
|
|
|
|
// See License.txt for license information.
|
|
|
|
|
|
|
|
|
|
package api4
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"net/http"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func (api *API) InitImage() {
|
|
|
|
|
api.BaseRoutes.Image.Handle("", api.ApiSessionRequiredTrustRequester(getImage)).Methods("GET")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func getImage(c *Context, w http.ResponseWriter, r *http.Request) {
|
2019-01-24 16:11:32 -04:00
|
|
|
if !*c.App.Config().ImageProxySettings.Enable {
|
|
|
|
|
http.NotFound(w, r)
|
2018-08-01 16:55:18 +02:00
|
|
|
return
|
2018-02-09 13:56:11 -06:00
|
|
|
}
|
2018-08-01 16:55:18 +02:00
|
|
|
|
2019-01-24 16:11:32 -04:00
|
|
|
c.App.ImageProxy.GetImage(w, r, r.URL.Query().Get("url"))
|
2018-02-09 13:56:11 -06:00
|
|
|
}
|