Updating dependencies. (#11680)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f226f672f3
Коммит
20825a1702
72
vendor/willnorris.com/go/imageproxy/CHANGELOG.md
сгенерированный
поставляемый
72
vendor/willnorris.com/go/imageproxy/CHANGELOG.md
сгенерированный
поставляемый
@@ -1,72 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
This file contains all notable changes to
|
||||
[imageproxy](https://github.com/willnorris/imageproxy). The format is based on
|
||||
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
|
||||
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
- updated docker image to use go1.12 compiler and build imageproxy as a go module.
|
||||
|
||||
- options are now sorted when converting to string. This is a breaking change
|
||||
for anyone relying on the option order, and will additionally invalidate
|
||||
most cached values, since the option string is part of the cache key.
|
||||
|
||||
Both the original remote image, as well as any transformations on that image
|
||||
are cached, but only the transformed images will be impacted by this change.
|
||||
This will result in imageproxy having to re-perform the transformations, but
|
||||
should not result in re-fetching the remote image, unless it has already
|
||||
otherwise expired.
|
||||
|
||||
### Removed
|
||||
- removed deprecated `whitelist` flag and `Proxy.Whitelist` struct field. Use
|
||||
`allowHosts` and `Proxy.AllowHosts` instead.
|
||||
|
||||
## [0.8.0] (2019-03-21)
|
||||
|
||||
### Added
|
||||
- added support for restricting proxied URLs [based on Content-Type
|
||||
headers](https://github.com/willnorris/imageproxy#allowed-content-type-list)
|
||||
([#141](https://github.com/willnorris/imageproxy/pull/141),
|
||||
[ccbrown](https://github.com/ccbrown))
|
||||
- added ability to [deny requests](https://github.com/willnorris/imageproxy#allowed-and-denied-hosts-list)
|
||||
for certain remote hosts
|
||||
([#85](https://github.com/willnorris/imageproxy/pull/85),
|
||||
[geriljaSA](https://github.com/geriljaSA))
|
||||
- added `userAgent` flag to specify a custom user agent when fetching images
|
||||
([#83](https://github.com/willnorris/imageproxy/pull/83),
|
||||
[huguesalary](https://github.com/huguesalary))
|
||||
- added support for [s3 compatible](https://github.com/willnorris/imageproxy#cache)
|
||||
storage providers
|
||||
([#147](https://github.com/willnorris/imageproxy/pull/147),
|
||||
[ruledio](https://github.com/ruledio))
|
||||
- log URL when image transform fails for easier debugging
|
||||
([#149](https://github.com/willnorris/imageproxy/pull/149),
|
||||
[daohoangson](https://github.com/daohoangson))
|
||||
- added support for building imageproxy as a [go module](https://golang.org/wiki/Modules).
|
||||
A future version will remove vendored dependencies, at which point building
|
||||
as a module will be the only supported method of building imageproxy.
|
||||
|
||||
### Changed
|
||||
- when a remote URL is denied, return a generic error message that does not specify exactly why it failed
|
||||
([7e19b5c](https://github.com/willnorris/imageproxy/commit/7e19b5c))
|
||||
|
||||
### Deprecated
|
||||
- `whitelist` flag and `Proxy.Whitelist` struct field renamed to `allowHosts`
|
||||
and `Proxy.AllowHosts`. Old values are still supported, but will be removed
|
||||
in a future release.
|
||||
|
||||
### Fixed
|
||||
- fixed tcp_mem resource leak on 304 responses
|
||||
([#153](https://github.com/willnorris/imageproxy/pull/153),
|
||||
[Micr0mega](https://github.com/Micr0mega))
|
||||
|
||||
## Older Versions
|
||||
|
||||
Additional changelog entries for older versions to be written as time permits.
|
||||
Contributions are welcome.
|
||||
|
||||
[Unreleased]: https://github.com/willnorris/imageproxy/compare/v0.8.0...HEAD
|
||||
[0.8.0]: https://github.com/willnorris/imageproxy/compare/v0.7.0...v0.8.0
|
||||
1
vendor/willnorris.com/go/imageproxy/Dockerfile
сгенерированный
поставляемый
1
vendor/willnorris.com/go/imageproxy/Dockerfile
сгенерированный
поставляемый
@@ -6,6 +6,7 @@ RUN useradd -u 1001 go
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
COPY third_party/envy/go.mod ./third_party/envy/
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
71
vendor/willnorris.com/go/imageproxy/README.md
сгенерированный
поставляемый
71
vendor/willnorris.com/go/imageproxy/README.md
сгенерированный
поставляемый
@@ -3,6 +3,7 @@
|
||||
[](https://godoc.org/willnorris.com/go/imageproxy)
|
||||
[](https://travis-ci.org/willnorris/imageproxy)
|
||||
[](https://codecov.io/gh/willnorris/imageproxy)
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/2611)
|
||||
|
||||
imageproxy is a caching image proxy server written in go. It features:
|
||||
|
||||
@@ -57,16 +58,16 @@ source image][small-things], which measures 1024 by 678 pixels.
|
||||
|
||||
Options | Meaning | Image
|
||||
--------|------------------------------------------|------
|
||||
200x | 200px wide, proportional height | <a href="https://willnorris.com/api/imageproxy/200x/https://willnorris.com/2013/12/small-things.jpg"><img src="https://willnorris.com/api/imageproxy/200x/https://willnorris.com/2013/12/small-things.jpg" alt="200x"></a>
|
||||
x0.15 | 15% original height, proportional width | <a href="https://willnorris.com/api/imageproxy/x0.15/https://willnorris.com/2013/12/small-things.jpg"><img src="https://willnorris.com/api/imageproxy/x0.15/https://willnorris.com/2013/12/small-things.jpg" alt="x0.15"></a>
|
||||
100x150 | 100 by 150 pixels, cropping as needed | <a href="https://willnorris.com/api/imageproxy/100x150/https://willnorris.com/2013/12/small-things.jpg"><img src="https://willnorris.com/api/imageproxy/100x150/https://willnorris.com/2013/12/small-things.jpg" alt="100x150"></a>
|
||||
100 | 100px square, cropping as needed | <a href="https://willnorris.com/api/imageproxy/100/https://willnorris.com/2013/12/small-things.jpg"><img src="https://willnorris.com/api/imageproxy/100/https://willnorris.com/2013/12/small-things.jpg" alt="100"></a>
|
||||
150,fit | scale to fit 150px square, no cropping | <a href="https://willnorris.com/api/imageproxy/150,fit/https://willnorris.com/2013/12/small-things.jpg"><img src="https://willnorris.com/api/imageproxy/150,fit/https://willnorris.com/2013/12/small-things.jpg" alt="150,fit"></a>
|
||||
100,r90 | 100px square, rotated 90 degrees | <a href="https://willnorris.com/api/imageproxy/100,r90/https://willnorris.com/2013/12/small-things.jpg"><img src="https://willnorris.com/api/imageproxy/100,r90/https://willnorris.com/2013/12/small-things.jpg" alt="100,r90"></a>
|
||||
100,fv,fh | 100px square, flipped horizontal and vertical | <a href="https://willnorris.com/api/imageproxy/100,fv,fh/https://willnorris.com/2013/12/small-things.jpg"><img src="https://willnorris.com/api/imageproxy/100,fv,fh/https://willnorris.com/2013/12/small-things.jpg" alt="100,fv,fh"></a>
|
||||
200x,q60 | 200px wide, proportional height, 60% quality | <a href="https://willnorris.com/api/imageproxy/200x,q60/https://willnorris.com/2013/12/small-things.jpg"><img src="https://willnorris.com/api/imageproxy/200x,q60/https://willnorris.com/2013/12/small-things.jpg" alt="200x,q60"></a>
|
||||
200x,png | 200px wide, converted to PNG format | <a href="https://willnorris.com/api/imageproxy/200x,png/https://willnorris.com/2013/12/small-things.jpg"><img src="https://willnorris.com/api/imageproxy/200x,png/https://willnorris.com/2013/12/small-things.jpg" alt="200x,png"></a>
|
||||
cx175,cw400,ch300,100x | crop to 400x300px starting at (175,0), scale to 100px wide | <a href="https://willnorris.com/api/imageproxy/cx175,cw400,ch300,100x/https://willnorris.com/2013/12/small-things.jpg"><img src="https://willnorris.com/api/imageproxy/cx175,cw400,ch300,100x/https://willnorris.com/2013/12/small-things.jpg" alt="cx175,cw400,ch300,100x"></a>
|
||||
200x | 200px wide, proportional height | <a href="https://imageproxy.willnorris.com/200x/https://willnorris.com/2013/12/small-things.jpg"><img src="https://imageproxy.willnorris.com/200x/https://willnorris.com/2013/12/small-things.jpg" alt="200x"></a>
|
||||
x0.15 | 15% original height, proportional width | <a href="https://imageproxy.willnorris.com/x0.15/https://willnorris.com/2013/12/small-things.jpg"><img src="https://imageproxy.willnorris.com/x0.15/https://willnorris.com/2013/12/small-things.jpg" alt="x0.15"></a>
|
||||
100x150 | 100 by 150 pixels, cropping as needed | <a href="https://imageproxy.willnorris.com/100x150/https://willnorris.com/2013/12/small-things.jpg"><img src="https://imageproxy.willnorris.com/100x150/https://willnorris.com/2013/12/small-things.jpg" alt="100x150"></a>
|
||||
100 | 100px square, cropping as needed | <a href="https://imageproxy.willnorris.com/100/https://willnorris.com/2013/12/small-things.jpg"><img src="https://imageproxy.willnorris.com/100/https://willnorris.com/2013/12/small-things.jpg" alt="100"></a>
|
||||
150,fit | scale to fit 150px square, no cropping | <a href="https://imageproxy.willnorris.com/150,fit/https://willnorris.com/2013/12/small-things.jpg"><img src="https://imageproxy.willnorris.com/150,fit/https://willnorris.com/2013/12/small-things.jpg" alt="150,fit"></a>
|
||||
100,r90 | 100px square, rotated 90 degrees | <a href="https://imageproxy.willnorris.com/100,r90/https://willnorris.com/2013/12/small-things.jpg"><img src="https://imageproxy.willnorris.com/100,r90/https://willnorris.com/2013/12/small-things.jpg" alt="100,r90"></a>
|
||||
100,fv,fh | 100px square, flipped horizontal and vertical | <a href="https://imageproxy.willnorris.com/100,fv,fh/https://willnorris.com/2013/12/small-things.jpg"><img src="https://imageproxy.willnorris.com/100,fv,fh/https://willnorris.com/2013/12/small-things.jpg" alt="100,fv,fh"></a>
|
||||
200x,q60 | 200px wide, proportional height, 60% quality | <a href="https://imageproxy.willnorris.com/200x,q60/https://willnorris.com/2013/12/small-things.jpg"><img src="https://imageproxy.willnorris.com/200x,q60/https://willnorris.com/2013/12/small-things.jpg" alt="200x,q60"></a>
|
||||
200x,png | 200px wide, converted to PNG format | <a href="https://imageproxy.willnorris.com/200x,png/https://willnorris.com/2013/12/small-things.jpg"><img src="https://imageproxy.willnorris.com/200x,png/https://willnorris.com/2013/12/small-things.jpg" alt="200x,png"></a>
|
||||
cx175,cw400,ch300,100x | crop to 400x300px starting at (175,0), scale to 100px wide | <a href="https://imageproxy.willnorris.com/cx175,cw400,ch300,100x/https://willnorris.com/2013/12/small-things.jpg"><img src="https://imageproxy.willnorris.com/cx175,cw400,ch300,100x/https://willnorris.com/2013/12/small-things.jpg" alt="cx175,cw400,ch300,100x"></a>
|
||||
|
||||
The [smart crop feature](https://godoc.org/willnorris.com/go/imageproxy#hdr-Smart_Crop)
|
||||
can best be seen by comparing crops of [this source image][judah-sheets], with
|
||||
@@ -74,8 +75,8 @@ and without smart crop enabled.
|
||||
|
||||
Options | Meaning | Image
|
||||
--------|------------------------------------------|------
|
||||
150x300 | 150x300px, standard crop | <a href="https://willnorris.com/api/imageproxy/150x300/https://judahnorris.com/images/judah-sheets.jpg"><img src="https://willnorris.com/api/imageproxy/150x300/https://judahnorris.com/images/judah-sheets.jpg" alt="200x400,sc"></a>
|
||||
150x300,sc | 150x300px, smart crop | <a href="https://willnorris.com/api/imageproxy/150x300,sc/https://judahnorris.com/images/judah-sheets.jpg"><img src="https://willnorris.com/api/imageproxy/150x300,sc/https://judahnorris.com/images/judah-sheets.jpg" alt="200x400"></a>
|
||||
150x300 | 150x300px, standard crop | <a href="https://imageproxy.willnorris.com/150x300/https://judahnorris.com/images/judah-sheets.jpg"><img src="https://imageproxy.willnorris.com/150x300/https://judahnorris.com/images/judah-sheets.jpg" alt="200x400,sc"></a>
|
||||
150x300,sc | 150x300px, smart crop | <a href="https://imageproxy.willnorris.com/150x300,sc/https://judahnorris.com/images/judah-sheets.jpg"><img src="https://imageproxy.willnorris.com/150x300,sc/https://judahnorris.com/images/judah-sheets.jpg" alt="200x400"></a>
|
||||
|
||||
[judah-sheets]: https://judahnorris.com/images/judah-sheets.jpg
|
||||
|
||||
@@ -84,7 +85,7 @@ image][material-animation] resized to 200px square and rotated 270 degrees:
|
||||
|
||||
[material-animation]: https://willnorris.com/2015/05/material-animations.gif
|
||||
|
||||
<a href="https://willnorris.com/api/imageproxy/200,r270/https://willnorris.com/2015/05/material-animations.gif"><img src="https://willnorris.com/api/imageproxy/200,r270/https://willnorris.com/2015/05/material-animations.gif" alt="200,r270"></a>
|
||||
<a href="https://imageproxy.willnorris.com/200,r270/https://willnorris.com/2015/05/material-animations.gif"><img src="https://imageproxy.willnorris.com/200,r270/https://willnorris.com/2015/05/material-animations.gif" alt="200,r270"></a>
|
||||
|
||||
## Getting Started ##
|
||||
|
||||
@@ -134,6 +135,11 @@ enabled using the `-cache` flag. It supports the following values:
|
||||
|
||||
s3://fake-region/bucket/folder?endpoint=minio:9000&disableSSL=1&s3ForcePathStyle=1
|
||||
|
||||
Similarly, for [Digital Ocean Spaces](https://www.digitalocean.com/products/spaces/),
|
||||
provide a dummy region value and the appropriate endpoint for your space:
|
||||
|
||||
s3://fake-region/bucket/folder?endpoint=sfo2.digitaloceanspaces.com
|
||||
|
||||
[aws-options]: https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
|
||||
|
||||
- gcs URL (e.g. `gcs://bucket-name/optional-path-prefix`) - will cache images
|
||||
@@ -160,11 +166,11 @@ version.
|
||||
|
||||
[codercat URL]: http://localhost:8080/500/https://octodex.github.com/images/codercat.jpg
|
||||
|
||||
If the `-cache` flag is specified multiple times, multiple caches will be
|
||||
created in a [tiered fashion][]. Typically this is used to put a smaller and
|
||||
faster in-memory cache in front of a larger but slower on-disk cache. For
|
||||
example, the following will first check an in-memory cache for an image,
|
||||
followed by a gcs bucket:
|
||||
Multiple caches can be specified by separating them by spaces or by repeating
|
||||
the `-cache` flag multiple times. The caches will be created in a [tiered
|
||||
fashion][]. Typically this is used to put a smaller and faster in-memory cache
|
||||
in front of a larger but slower on-disk cache. For example, the following will
|
||||
first check an in-memory cache for an image, followed by a gcs bucket:
|
||||
|
||||
imageproxy -cache memory -cache gcs://my-bucket/
|
||||
|
||||
@@ -287,6 +293,13 @@ you want to use a different caching implementation, it's probably easiest to
|
||||
just make a copy of `cmd/imageproxy/main.go` and customize it to fit your
|
||||
needs... it's a very simple command.
|
||||
|
||||
### Environment Variables ###
|
||||
|
||||
All configuration flags have equivalent environment variables of the form
|
||||
`IMAGEPROXY_$NAME`. For example, an on-disk cache could be configured by calling
|
||||
|
||||
IMAGEPROXY_CACHE="/tmp/imageproxy" imageproxy
|
||||
|
||||
## Deploying ##
|
||||
|
||||
In most cases, you can follow the normal procedure for building a deploying any
|
||||
@@ -323,17 +336,21 @@ ENTRYPOINT ["/go/bin/imageproxy", "-addr 0.0.0.0:8080"]
|
||||
|
||||
### nginx ###
|
||||
|
||||
You can use follow config to prevent URL overwritting:
|
||||
Use the `proxy_pass` directive to send requests to your imageproxy instance.
|
||||
For example, to run imageproxy at the path "/api/imageproxy/", set:
|
||||
|
||||
```
|
||||
location ~ ^/api/imageproxy/ {
|
||||
# pattern match to capture the original URL to prevent URL
|
||||
# canonicalization, which would strip double slashes
|
||||
if ($request_uri ~ "/api/imageproxy/(.+)") {
|
||||
set $path $1;
|
||||
rewrite .* /$path break;
|
||||
}
|
||||
proxy_pass http://localhost:8080;
|
||||
location /api/imageproxy/ {
|
||||
proxy_pass http://localhost:4593/;
|
||||
}
|
||||
```
|
||||
|
||||
Depending on other directives you may have in your nginx config, you might need
|
||||
to alter the precedence order by setting:
|
||||
|
||||
```
|
||||
location ^~ /api/imageproxy/ {
|
||||
proxy_pass http://localhost:4593/;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
2
vendor/willnorris.com/go/imageproxy/data.go
сгенерированный
поставляемый
2
vendor/willnorris.com/go/imageproxy/data.go
сгенерированный
поставляемый
@@ -227,7 +227,7 @@ func (o Options) transform() bool {
|
||||
// sign the remote URL in the request. The HMAC key used to verify signatures is
|
||||
// provided to the imageproxy server on startup.
|
||||
//
|
||||
// See https://github.com/willnorris/imageproxy/wiki/URL-signing
|
||||
// See https://github.com/willnorris/imageproxy/blob/master/docs/url-signing.md
|
||||
// for examples of generating signatures.
|
||||
//
|
||||
// Examples
|
||||
|
||||
4
vendor/willnorris.com/go/imageproxy/go.mod
сгенерированный
поставляемый
4
vendor/willnorris.com/go/imageproxy/go.mod
сгенерированный
поставляемый
@@ -17,6 +17,7 @@ require (
|
||||
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.8.5 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.1 // indirect
|
||||
github.com/jamiealquiza/envy v1.1.0
|
||||
github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c // indirect
|
||||
github.com/muesli/smartcrop v0.2.1-0.20181030220600-548bbf0c0965
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
|
||||
@@ -36,3 +37,6 @@ require (
|
||||
|
||||
// temporary fix to https://github.com/golang/lint/issues/436 which still seems to be a problem
|
||||
replace github.com/golang/lint => github.com/golang/lint v0.0.0-20190227174305-8f45f776aaf1
|
||||
|
||||
// local copy of envy package without cobra support
|
||||
replace github.com/jamiealquiza/envy => ./third_party/envy
|
||||
|
||||
7
vendor/willnorris.com/go/imageproxy/transform.go
сгенерированный
поставляемый
7
vendor/willnorris.com/go/imageproxy/transform.go
сгенерированный
поставляемый
@@ -29,6 +29,7 @@ import (
|
||||
"github.com/muesli/smartcrop"
|
||||
"github.com/muesli/smartcrop/nfnt"
|
||||
"github.com/rwcarlsen/goexif/exif"
|
||||
"golang.org/x/image/bmp" // register bmp format
|
||||
"golang.org/x/image/tiff" // register tiff format
|
||||
_ "golang.org/x/image/webp" // register webp format
|
||||
"willnorris.com/go/gifresize"
|
||||
@@ -79,6 +80,12 @@ func Transform(img []byte, opt Options) ([]byte, error) {
|
||||
// transform and encode image
|
||||
buf := new(bytes.Buffer)
|
||||
switch format {
|
||||
case "bmp":
|
||||
m = transformImage(m, opt)
|
||||
err = bmp.Encode(buf, m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case "gif":
|
||||
fn := func(img image.Image) image.Image {
|
||||
return transformImage(img, opt)
|
||||
|
||||
Ссылка в новой задаче
Block a user