mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* MM-10417 Add local image proxy and enable by default * Remove unused function * Add dependencies for willnorris/imageproxy * Fixed compilation errors * Lock to the master version of willnorris/imageproxy * Fix atmos/camo proxy when no SiteURL is specified * Re-add default values for deprecated settings * Fix unit tests added by merge * Pass imageproxy to App struct * Remove unneeded locking when creating the image proxy * Remove empty test file
22 lines
493 B
Go
22 lines
493 B
Go
// 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) {
|
|
if !*c.App.Config().ImageProxySettings.Enable {
|
|
http.NotFound(w, r)
|
|
return
|
|
}
|
|
|
|
c.App.ImageProxy.GetImage(w, r, r.URL.Query().Get("url"))
|
|
}
|