* image proxy support

* go vet fix, remove mistakenly added coverage file

* fix test compile error

* add validation to config settings and documentation to model functions

* add message_source field to post
Этот коммит содержится в:
Chris
2018-01-22 15:32:50 -06:00
коммит произвёл GitHub
родитель a844577535
Коммит 599991ea73
33 изменённых файлов: 6080 добавлений и 32 удалений

Просмотреть файл

@@ -386,7 +386,7 @@ func getPinnedPosts(c *Context, w http.ResponseWriter, r *http.Request) {
return
} else {
w.Header().Set(model.HEADER_ETAG_SERVER, posts.Etag())
w.Write([]byte(posts.ToJson()))
w.Write([]byte(c.App.PostListWithProxyAddedToImageURLs(posts).ToJson()))
}
}

Просмотреть файл

@@ -56,7 +56,7 @@ func createPost(c *Context, w http.ResponseWriter, r *http.Request) {
post.CreateAt = 0
}
rp, err := c.App.CreatePostAsUser(post)
rp, err := c.App.CreatePostAsUser(c.App.PostWithProxyRemovedFromImageURLs(post))
if err != nil {
c.Err = err
return
@@ -66,7 +66,7 @@ func createPost(c *Context, w http.ResponseWriter, r *http.Request) {
c.App.UpdateLastActivityAtIfNeeded(c.Session)
w.WriteHeader(http.StatusCreated)
w.Write([]byte(rp.ToJson()))
w.Write([]byte(c.App.PostWithProxyAddedToImageURLs(rp).ToJson()))
}
func getPostsForChannel(c *Context, w http.ResponseWriter, r *http.Request) {
@@ -135,7 +135,7 @@ func getPostsForChannel(c *Context, w http.ResponseWriter, r *http.Request) {
if len(etag) > 0 {
w.Header().Set(model.HEADER_ETAG_SERVER, etag)
}
w.Write([]byte(list.ToJson()))
w.Write([]byte(c.App.PostListWithProxyAddedToImageURLs(list).ToJson()))
}
func getFlaggedPostsForUser(c *Context, w http.ResponseWriter, r *http.Request) {
@@ -168,7 +168,7 @@ func getFlaggedPostsForUser(c *Context, w http.ResponseWriter, r *http.Request)
return
}
w.Write([]byte(posts.ToJson()))
w.Write([]byte(c.App.PostListWithProxyAddedToImageURLs(posts).ToJson()))
}
func getPost(c *Context, w http.ResponseWriter, r *http.Request) {
@@ -206,7 +206,7 @@ func getPost(c *Context, w http.ResponseWriter, r *http.Request) {
return
} else {
w.Header().Set(model.HEADER_ETAG_SERVER, post.Etag())
w.Write([]byte(post.ToJson()))
w.Write([]byte(c.App.PostWithProxyAddedToImageURLs(post).ToJson()))
}
}
@@ -272,7 +272,7 @@ func getPostThread(c *Context, w http.ResponseWriter, r *http.Request) {
return
} else {
w.Header().Set(model.HEADER_ETAG_SERVER, list.Etag())
w.Write([]byte(list.ToJson()))
w.Write([]byte(c.App.PostListWithProxyAddedToImageURLs(list).ToJson()))
}
}
@@ -313,7 +313,7 @@ func searchPosts(c *Context, w http.ResponseWriter, r *http.Request) {
}
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
w.Write([]byte(posts.ToJson()))
w.Write([]byte(c.App.PostListWithProxyAddedToImageURLs(posts).ToJson()))
}
func updatePost(c *Context, w http.ResponseWriter, r *http.Request) {
@@ -341,13 +341,13 @@ func updatePost(c *Context, w http.ResponseWriter, r *http.Request) {
post.Id = c.Params.PostId
rpost, err := c.App.UpdatePost(post, false)
rpost, err := c.App.UpdatePost(c.App.PostWithProxyRemovedFromImageURLs(post), false)
if err != nil {
c.Err = err
return
}
w.Write([]byte(rpost.ToJson()))
w.Write([]byte(c.App.PostWithProxyAddedToImageURLs(rpost).ToJson()))
}
func patchPost(c *Context, w http.ResponseWriter, r *http.Request) {
@@ -373,13 +373,13 @@ func patchPost(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
patchedPost, err := c.App.PatchPost(c.Params.PostId, post)
patchedPost, err := c.App.PatchPost(c.Params.PostId, c.App.PostPatchWithProxyRemovedFromImageURLs(post))
if err != nil {
c.Err = err
return
}
w.Write([]byte(patchedPost.ToJson()))
w.Write([]byte(c.App.PostWithProxyAddedToImageURLs(patchedPost).ToJson()))
}
func saveIsPinnedPost(c *Context, w http.ResponseWriter, r *http.Request, isPinned bool) {