mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-25 04:46:24 +02:00
README,docs: format and update URLs
Format docs with prettier. Update godoc.org URLs to pkg.go.dev.
This commit is contained in:
parent
7502adde1c
commit
8170536e41
5 changed files with 313 additions and 265 deletions
|
|
@ -41,7 +41,7 @@ list of parameters, which can be supplied in any order. Duplicate parameters
|
||||||
overwrite previous values.
|
overwrite previous values.
|
||||||
|
|
||||||
See the full list of available options at
|
See the full list of available options at
|
||||||
<https://godoc.org/willnorris.com/go/imageproxy#ParseOptions>.
|
<https://pkg.go.dev/willnorris.com/go/imageproxy#ParseOptions>.
|
||||||
|
|
||||||
### Remote URL
|
### Remote URL
|
||||||
|
|
||||||
|
|
@ -76,7 +76,7 @@ source image][small-things], which measures 1024 by 678 pixels.
|
||||||
| 200x,png | 200px wide, converted to PNG format | <a href="https://willnorris.com/api/imageproxy/200x,png/https://willnorris.com/images/imageproxy/small-things.jpg"><img src="https://willnorris.com/api/imageproxy/200x,png/https://willnorris.com/images/imageproxy/small-things.jpg" alt="200x,png"></a> |
|
| 200x,png | 200px wide, converted to PNG format | <a href="https://willnorris.com/api/imageproxy/200x,png/https://willnorris.com/images/imageproxy/small-things.jpg"><img src="https://willnorris.com/api/imageproxy/200x,png/https://willnorris.com/images/imageproxy/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/images/imageproxy/small-things.jpg"><img src="https://willnorris.com/api/imageproxy/cx175,cw400,ch300,100x/https://willnorris.com/images/imageproxy/small-things.jpg" alt="cx175,cw400,ch300,100x"></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/images/imageproxy/small-things.jpg"><img src="https://willnorris.com/api/imageproxy/cx175,cw400,ch300,100x/https://willnorris.com/images/imageproxy/small-things.jpg" alt="cx175,cw400,ch300,100x"></a> |
|
||||||
|
|
||||||
The [smart crop feature](https://godoc.org/willnorris.com/go/imageproxy#hdr-Smart_Crop)
|
The [smart crop feature](https://pkg.go.dev/willnorris.com/go/imageproxy#hdr-Smart_Crop-ParseOptions)
|
||||||
can best be seen by comparing crops of [this source image][judah-sheets], with
|
can best be seen by comparing crops of [this source image][judah-sheets], with
|
||||||
and without smart crop enabled.
|
and without smart crop enabled.
|
||||||
|
|
||||||
|
|
@ -182,7 +182,7 @@ first check an in-memory cache for an image, followed by a gcs bucket:
|
||||||
|
|
||||||
imageproxy -cache memory -cache gcs://my-bucket/
|
imageproxy -cache memory -cache gcs://my-bucket/
|
||||||
|
|
||||||
[tiered fashion]: https://godoc.org/github.com/die-net/lrucache/twotier
|
[tiered fashion]: https://pkg.go.dev/github.com/die-net/lrucache/twotier
|
||||||
|
|
||||||
#### Cache Duration
|
#### Cache Duration
|
||||||
|
|
||||||
|
|
@ -263,7 +263,7 @@ Reload the [codercat URL][], and you should see an error message. Now load a
|
||||||
that it loads properly.
|
that it loads properly.
|
||||||
|
|
||||||
[signed codercat URL]: http://localhost:8080/500,sXyMwWKIC5JPCtlYOQ2f4yMBTqpjtUsfI67Sp7huXIYY=/https://octodex.github.com/images/codercat.jpg
|
[signed codercat URL]: http://localhost:8080/500,sXyMwWKIC5JPCtlYOQ2f4yMBTqpjtUsfI67Sp7huXIYY=/https://octodex.github.com/images/codercat.jpg
|
||||||
[signature option]: https://godoc.org/willnorris.com/go/imageproxy#hdr-Signature
|
[signature option]: https://pkg.go.dev/willnorris.com/go/imageproxy#hdr-Signature-ParseOptions
|
||||||
|
|
||||||
Some simple code samples for generating signatures in various languages can be
|
Some simple code samples for generating signatures in various languages can be
|
||||||
found in [docs/url-signing.md](/docs/url-signing.md). Multiple valid signature
|
found in [docs/url-signing.md](/docs/url-signing.md). Multiple valid signature
|
||||||
|
|
|
||||||
|
|
@ -6,27 +6,31 @@ This file contains all notable changes to
|
||||||
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
[Unreleased]: https://github.com/willnorris/imageproxy/compare/v0.9.0...HEAD
|
[Unreleased]: https://github.com/willnorris/imageproxy/compare/v0.9.0...HEAD
|
||||||
|
|
||||||
## [0.10.0] (2020-04-02)
|
## [0.10.0] (2020-04-02)
|
||||||
|
|
||||||
[0.10.0]: https://github.com/willnorris/imageproxy/compare/v0.9.0...v0.10.0
|
[0.10.0]: https://github.com/willnorris/imageproxy/compare/v0.9.0...v0.10.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- add support for multiple signature keys to support key rotation
|
|
||||||
|
- add support for multiple signature keys to support key rotation
|
||||||
([ef09c1b](https://github.com/willnorris/imageproxy/commit/ef09c1b),
|
([ef09c1b](https://github.com/willnorris/imageproxy/commit/ef09c1b),
|
||||||
[#209](https://github.com/willnorris/imageproxy/pull/209),
|
[#209](https://github.com/willnorris/imageproxy/pull/209),
|
||||||
[maurociancio](https://github.com/maurociancio))
|
[maurociancio](https://github.com/maurociancio))
|
||||||
- added option to include referer header in remote requests
|
- added option to include referer header in remote requests
|
||||||
([#216](https://github.com/willnorris/imageproxy/issues/216))
|
([#216](https://github.com/willnorris/imageproxy/issues/216))
|
||||||
- added basic support for recording prometheus metrics
|
- added basic support for recording prometheus metrics
|
||||||
([#121](https://github.com/willnorris/imageproxy/pull/121)
|
([#121](https://github.com/willnorris/imageproxy/pull/121)
|
||||||
[benhaan](https://github.com/benhaan))
|
[benhaan](https://github.com/benhaan))
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- improved content type detection for some hosts, particularly S3
|
|
||||||
|
- improved content type detection for some hosts, particularly S3
|
||||||
([ea95ad9](https://github.com/willnorris/imageproxy/commit/ea95ad9),
|
([ea95ad9](https://github.com/willnorris/imageproxy/commit/ea95ad9),
|
||||||
[shahan312](https://github.com/shahan312))
|
[shahan312](https://github.com/shahan312))
|
||||||
- fix signature verification for some proxied URLs
|
- fix signature verification for some proxied URLs
|
||||||
([3589510](https://github.com/willnorris/imageproxy/commit/3589510),
|
([3589510](https://github.com/willnorris/imageproxy/commit/3589510),
|
||||||
[#212](https://github.com/willnorris/imageproxy/issues/212),
|
[#212](https://github.com/willnorris/imageproxy/issues/212),
|
||||||
([#215](https://github.com/willnorris/imageproxy/issues/215),
|
([#215](https://github.com/willnorris/imageproxy/issues/215),
|
||||||
|
|
@ -34,26 +38,29 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
[fieldistor](https://github.com/fieldistor) for the suggested fix)
|
[fieldistor](https://github.com/fieldistor) for the suggested fix)
|
||||||
|
|
||||||
## [0.9.0] (2019-06-10)
|
## [0.9.0] (2019-06-10)
|
||||||
|
|
||||||
[0.9.0]: https://github.com/willnorris/imageproxy/compare/v0.8.0...v0.9.0
|
[0.9.0]: https://github.com/willnorris/imageproxy/compare/v0.8.0...v0.9.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- allow request signatures to cover options
|
|
||||||
|
- allow request signatures to cover options
|
||||||
([#145](https://github.com/willnorris/imageproxy/issues/145))
|
([#145](https://github.com/willnorris/imageproxy/issues/145))
|
||||||
- add simple imageproxy-sign tool for calculating signatures
|
- add simple imageproxy-sign tool for calculating signatures
|
||||||
([e1558d5](https://github.com/willnorris/imageproxy/commit/e1558d5))
|
([e1558d5](https://github.com/willnorris/imageproxy/commit/e1558d5))
|
||||||
- allow overriding the Logger used by Proxy
|
- allow overriding the Logger used by Proxy
|
||||||
([#174](https://github.com/willnorris/imageproxy/pull/174),
|
([#174](https://github.com/willnorris/imageproxy/pull/174),
|
||||||
[hmhealey](https://github.com/hmhealey))
|
[hmhealey](https://github.com/hmhealey))
|
||||||
- allow using environment variables for configuration
|
- allow using environment variables for configuration
|
||||||
([50e0d11](https://github.com/willnorris/imageproxy/commit/50e0d11))
|
([50e0d11](https://github.com/willnorris/imageproxy/commit/50e0d11))
|
||||||
- add support for BMP images
|
- add support for BMP images
|
||||||
([d4ba520](https://github.com/willnorris/imageproxy/commit/d4ba520))
|
([d4ba520](https://github.com/willnorris/imageproxy/commit/d4ba520))
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- improvements to docker image: run as non-privileged user, use go1.12
|
|
||||||
|
- improvements to docker image: run as non-privileged user, use go1.12
|
||||||
compiler, and build imageproxy as a go module.
|
compiler, and build imageproxy as a go module.
|
||||||
|
|
||||||
- options are now sorted when converting to string. This is a breaking change
|
- options are now sorted when converting to string. This is a breaking change
|
||||||
for anyone relying on the option order, and will additionally invalidate
|
for anyone relying on the option order, and will additionally invalidate
|
||||||
most cached values, since the option string is part of the cache key.
|
most cached values, since the option string is part of the cache key.
|
||||||
|
|
||||||
|
|
@ -64,67 +71,76 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
otherwise expired.
|
otherwise expired.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- properly include Accept header on remote URL requests
|
|
||||||
|
- properly include Accept header on remote URL requests
|
||||||
([#165](https://github.com/willnorris/imageproxy/issues/165),
|
([#165](https://github.com/willnorris/imageproxy/issues/165),
|
||||||
[6aca1e0](https://github.com/willnorris/imageproxy/commit/6aca1e0))
|
[6aca1e0](https://github.com/willnorris/imageproxy/commit/6aca1e0))
|
||||||
- detect response content type if content-type header is missing
|
- detect response content type if content-type header is missing
|
||||||
([cf54b2c](https://github.com/willnorris/imageproxy/commit/cf54b2c))
|
([cf54b2c](https://github.com/willnorris/imageproxy/commit/cf54b2c))
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- removed deprecated `whitelist` flag and `Proxy.Whitelist` struct field. Use
|
|
||||||
|
- removed deprecated `whitelist` flag and `Proxy.Whitelist` struct field. Use
|
||||||
`allowHosts` and `Proxy.AllowHosts` instead.
|
`allowHosts` and `Proxy.AllowHosts` instead.
|
||||||
|
|
||||||
## [0.8.0] (2019-03-21)
|
## [0.8.0] (2019-03-21)
|
||||||
|
|
||||||
[0.8.0]: https://github.com/willnorris/imageproxy/compare/v0.7.0...v0.8.0
|
[0.8.0]: https://github.com/willnorris/imageproxy/compare/v0.7.0...v0.8.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- added support for restricting proxied URLs [based on Content-Type
|
|
||||||
|
- added support for restricting proxied URLs [based on Content-Type
|
||||||
headers](https://github.com/willnorris/imageproxy#allowed-content-type-list)
|
headers](https://github.com/willnorris/imageproxy#allowed-content-type-list)
|
||||||
([#141](https://github.com/willnorris/imageproxy/pull/141),
|
([#141](https://github.com/willnorris/imageproxy/pull/141),
|
||||||
[ccbrown](https://github.com/ccbrown))
|
[ccbrown](https://github.com/ccbrown))
|
||||||
- added ability to [deny requests](https://github.com/willnorris/imageproxy#allowed-and-denied-hosts-list)
|
- added ability to [deny requests](https://github.com/willnorris/imageproxy#allowed-and-denied-hosts-list)
|
||||||
for certain remote hosts
|
for certain remote hosts
|
||||||
([#85](https://github.com/willnorris/imageproxy/pull/85),
|
([#85](https://github.com/willnorris/imageproxy/pull/85),
|
||||||
[geriljaSA](https://github.com/geriljaSA))
|
[geriljaSA](https://github.com/geriljaSA))
|
||||||
- added `userAgent` flag to specify a custom user agent when fetching images
|
- added `userAgent` flag to specify a custom user agent when fetching images
|
||||||
([#83](https://github.com/willnorris/imageproxy/pull/83),
|
([#83](https://github.com/willnorris/imageproxy/pull/83),
|
||||||
[huguesalary](https://github.com/huguesalary))
|
[huguesalary](https://github.com/huguesalary))
|
||||||
- added support for [s3 compatible](https://github.com/willnorris/imageproxy#cache)
|
- added support for [s3 compatible](https://github.com/willnorris/imageproxy#cache)
|
||||||
storage providers
|
storage providers
|
||||||
([#147](https://github.com/willnorris/imageproxy/pull/147),
|
([#147](https://github.com/willnorris/imageproxy/pull/147),
|
||||||
[ruledio](https://github.com/ruledio))
|
[ruledio](https://github.com/ruledio))
|
||||||
- log URL when image transform fails for easier debugging
|
- log URL when image transform fails for easier debugging
|
||||||
([#149](https://github.com/willnorris/imageproxy/pull/149),
|
([#149](https://github.com/willnorris/imageproxy/pull/149),
|
||||||
[daohoangson](https://github.com/daohoangson))
|
[daohoangson](https://github.com/daohoangson))
|
||||||
- added support for building imageproxy as a [go module](https://golang.org/wiki/Modules).
|
- 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
|
A future version will remove vendored dependencies, at which point building
|
||||||
as a module will be the only supported method of building imageproxy.
|
as a module will be the only supported method of building imageproxy.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- when a remote URL is denied, return a generic error message that does not specify exactly why it failed
|
|
||||||
|
- 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))
|
([7e19b5c](https://github.com/willnorris/imageproxy/commit/7e19b5c))
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
- `whitelist` flag and `Proxy.Whitelist` struct field renamed to `allowHosts`
|
|
||||||
|
- `whitelist` flag and `Proxy.Whitelist` struct field renamed to `allowHosts`
|
||||||
and `Proxy.AllowHosts`. Old values are still supported, but will be removed
|
and `Proxy.AllowHosts`. Old values are still supported, but will be removed
|
||||||
in a future release.
|
in a future release.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- fixed tcp_mem resource leak on 304 responses
|
|
||||||
|
- fixed tcp_mem resource leak on 304 responses
|
||||||
([#153](https://github.com/willnorris/imageproxy/pull/153),
|
([#153](https://github.com/willnorris/imageproxy/pull/153),
|
||||||
[Micr0mega](https://github.com/Micr0mega))
|
[Micr0mega](https://github.com/Micr0mega))
|
||||||
|
|
||||||
## [0.7.0] (2018-02-06)
|
## [0.7.0] (2018-02-06)
|
||||||
|
|
||||||
[0.7.0]: https://github.com/willnorris/imageproxy/compare/v0.6.0...v0.7.0
|
[0.7.0]: https://github.com/willnorris/imageproxy/compare/v0.6.0...v0.7.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- added support for arbitrary [rectangular crops](https://godoc.org/willnorris.com/go/imageproxy#hdr-Rectangle_Crop)
|
|
||||||
|
- added support for arbitrary [rectangular crops](https://godoc.org/willnorris.com/go/imageproxy#hdr-Rectangle_Crop)
|
||||||
([#90](https://github.com/willnorris/imageproxy/pull/90),
|
([#90](https://github.com/willnorris/imageproxy/pull/90),
|
||||||
[maciejtarnowski](https://github.com/maciejtarnowski))
|
[maciejtarnowski](https://github.com/maciejtarnowski))
|
||||||
- added support for tiff images
|
- added support for tiff images
|
||||||
([#109](https://github.com/willnorris/imageproxy/pull/109),
|
([#109](https://github.com/willnorris/imageproxy/pull/109),
|
||||||
[mikecx](https://github.com/mikecx))
|
[mikecx](https://github.com/mikecx))
|
||||||
- added support for additional [caching backends](https://github.com/willnorris/imageproxy#cache):
|
- added support for additional [caching backends](https://github.com/willnorris/imageproxy#cache):
|
||||||
- Google Cloud Storage
|
- Google Cloud Storage
|
||||||
([#106](https://github.com/willnorris/imageproxy/pull/106),
|
([#106](https://github.com/willnorris/imageproxy/pull/106),
|
||||||
[diegomarangoni](https://github.com/diegomarangoni))
|
[diegomarangoni](https://github.com/diegomarangoni))
|
||||||
|
|
@ -136,179 +152,209 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
[dbfc693](https://github.com/willnorris/imageproxy/commit/dbfc693))
|
[dbfc693](https://github.com/willnorris/imageproxy/commit/dbfc693))
|
||||||
- Tiering multiple caches by repeating the `-cache` flag
|
- Tiering multiple caches by repeating the `-cache` flag
|
||||||
([ec5b543](https://github.com/willnorris/imageproxy/commit/ec5b543))
|
([ec5b543](https://github.com/willnorris/imageproxy/commit/ec5b543))
|
||||||
- added support for EXIF orientation tags
|
- added support for EXIF orientation tags
|
||||||
([#63](https://github.com/willnorris/imageproxy/issues/63),
|
([#63](https://github.com/willnorris/imageproxy/issues/63),
|
||||||
[67619a6](https://github.com/willnorris/imageproxy/commit/67619a6))
|
[67619a6](https://github.com/willnorris/imageproxy/commit/67619a6))
|
||||||
- added [smart crop feature](https://godoc.org/willnorris.com/go/imageproxy#hdr-Smart_Crop)
|
- added [smart crop feature](https://godoc.org/willnorris.com/go/imageproxy#hdr-Smart_Crop)
|
||||||
([#55](https://github.com/willnorris/imageproxy/issues/55),
|
([#55](https://github.com/willnorris/imageproxy/issues/55),
|
||||||
[afbd254](https://github.com/willnorris/imageproxy/commit/afbd254))
|
[afbd254](https://github.com/willnorris/imageproxy/commit/afbd254))
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- rotate values are normalized, such that `r-90` is the same as `r270`
|
|
||||||
|
- rotate values are normalized, such that `r-90` is the same as `r270`
|
||||||
([07c54b4](https://github.com/willnorris/imageproxy/commit/07c54b4))
|
([07c54b4](https://github.com/willnorris/imageproxy/commit/07c54b4))
|
||||||
- now return `200 OK` response for requests to root `/`
|
- now return `200 OK` response for requests to root `/`
|
||||||
([5ee7e28](https://github.com/willnorris/imageproxy/commit/5ee7e28))
|
([5ee7e28](https://github.com/willnorris/imageproxy/commit/5ee7e28))
|
||||||
- switch to using official AWS Go SDK for s3 cache storage. This is a
|
- switch to using official AWS Go SDK for s3 cache storage. This is a
|
||||||
breaking change for anyone using that cache implementation, since the URL
|
breaking change for anyone using that cache implementation, since the URL
|
||||||
syntax has changed. This adds support for the newer v4 auth method, as well
|
syntax has changed. This adds support for the newer v4 auth method, as well
|
||||||
as additional s3 regions.
|
as additional s3 regions.
|
||||||
([0ee5167](https://github.com/willnorris/imageproxy/commit/0ee5167))
|
([0ee5167](https://github.com/willnorris/imageproxy/commit/0ee5167))
|
||||||
- switched to standard go log library. Added `-verbose` flag for more logging
|
- switched to standard go log library. Added `-verbose` flag for more logging
|
||||||
in-memory cache backend supports limiting the max cache size
|
in-memory cache backend supports limiting the max cache size
|
||||||
([a57047f](https://github.com/willnorris/imageproxy/commit/a57047f))
|
([a57047f](https://github.com/willnorris/imageproxy/commit/a57047f))
|
||||||
- docker image sized reduced by using scratch image and multistage build
|
- docker image sized reduced by using scratch image and multistage build
|
||||||
([#113](https://github.com/willnorris/imageproxy/pull/113),
|
([#113](https://github.com/willnorris/imageproxy/pull/113),
|
||||||
[matematik7](https://github.com/matematik7))
|
[matematik7](https://github.com/matematik7))
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- removed deprecated `cacheDir` and `cacheSize` flags
|
|
||||||
|
- removed deprecated `cacheDir` and `cacheSize` flags
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- fixed interpretation of `Last-Modified` and `If-Modified-Since` headers
|
|
||||||
|
- fixed interpretation of `Last-Modified` and `If-Modified-Since` headers
|
||||||
([#108](https://github.com/willnorris/imageproxy/pull/108),
|
([#108](https://github.com/willnorris/imageproxy/pull/108),
|
||||||
[jamesreggio](https://github.com/jamesreggio))
|
[jamesreggio](https://github.com/jamesreggio))
|
||||||
- preserve original URL encoding
|
- preserve original URL encoding
|
||||||
([#115](https://github.com/willnorris/imageproxy/issues/115))
|
([#115](https://github.com/willnorris/imageproxy/issues/115))
|
||||||
|
|
||||||
## [0.6.0] (2017-08-29)
|
## [0.6.0] (2017-08-29)
|
||||||
|
|
||||||
[0.6.0]: https://github.com/willnorris/imageproxy/compare/v0.5.1...v0.6.0
|
[0.6.0]: https://github.com/willnorris/imageproxy/compare/v0.5.1...v0.6.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- added health check endpoint
|
|
||||||
|
- added health check endpoint
|
||||||
([#54](https://github.com/willnorris/imageproxy/pull/54),
|
([#54](https://github.com/willnorris/imageproxy/pull/54),
|
||||||
[immunda](https://github.com/immunda))
|
[immunda](https://github.com/immunda))
|
||||||
- preserve Link headers from remote image
|
- preserve Link headers from remote image
|
||||||
([#68](https://github.com/willnorris/imageproxy/pull/68),
|
([#68](https://github.com/willnorris/imageproxy/pull/68),
|
||||||
[xavren](https://github.com/xavren))
|
[xavren](https://github.com/xavren))
|
||||||
- added support for per-request timeout
|
- added support for per-request timeout
|
||||||
([#75](https://github.com/willnorris/imageproxy/issues/75))
|
([#75](https://github.com/willnorris/imageproxy/issues/75))
|
||||||
- added support for specifying output image format
|
- added support for specifying output image format
|
||||||
([b9cc9df](https://github.com/willnorris/imageproxy/commit/b9cc9df))
|
([b9cc9df](https://github.com/willnorris/imageproxy/commit/b9cc9df))
|
||||||
- added webp support (decode only)
|
- added webp support (decode only)
|
||||||
([3280445](https://github.com/willnorris/imageproxy/commit/3280445))
|
([3280445](https://github.com/willnorris/imageproxy/commit/3280445))
|
||||||
- added CORS support
|
- added CORS support
|
||||||
([#96](https://github.com/willnorris/imageproxy/pull/96),
|
([#96](https://github.com/willnorris/imageproxy/pull/96),
|
||||||
[romdim](https://github.com/romdim))
|
[romdim](https://github.com/romdim))
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- improved error messages for some authorization failures
|
|
||||||
|
- improved error messages for some authorization failures
|
||||||
([27d5378](https://github.com/willnorris/imageproxy/commit/27d5378))
|
([27d5378](https://github.com/willnorris/imageproxy/commit/27d5378))
|
||||||
- skip transformation when not needed
|
- skip transformation when not needed
|
||||||
([#64](https://github.com/willnorris/imageproxy/issues/64))
|
([#64](https://github.com/willnorris/imageproxy/issues/64))
|
||||||
- properly handled "cleaned" remote URLs
|
- properly handled "cleaned" remote URLs
|
||||||
([a1af9aa](https://github.com/willnorris/imageproxy/commit/a1af9aa),
|
([a1af9aa](https://github.com/willnorris/imageproxy/commit/a1af9aa),
|
||||||
[b61992e](https://github.com/willnorris/imageproxy/commit/b61992e))
|
[b61992e](https://github.com/willnorris/imageproxy/commit/b61992e))
|
||||||
|
|
||||||
## [0.5.1] (2015-12-07)
|
## [0.5.1] (2015-12-07)
|
||||||
|
|
||||||
[0.5.1]: https://github.com/willnorris/imageproxy/compare/v0.5.0...v0.5.1
|
[0.5.1]: https://github.com/willnorris/imageproxy/compare/v0.5.0...v0.5.1
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- fixed bug in gif resizing
|
|
||||||
|
- fixed bug in gif resizing
|
||||||
([gifresize@104a7cd](https://github.com/willnorris/gifresize/commit/104a7cd))
|
([gifresize@104a7cd](https://github.com/willnorris/gifresize/commit/104a7cd))
|
||||||
|
|
||||||
## [0.5.0] (2015-12-07)
|
## [0.5.0] (2015-12-07)
|
||||||
|
|
||||||
[0.5.0]: https://github.com/willnorris/imageproxy/compare/v0.4.0...v0.5.0
|
[0.5.0]: https://github.com/willnorris/imageproxy/compare/v0.4.0...v0.5.0
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
- added Dockerfile
|
|
||||||
|
- added Dockerfile
|
||||||
([#29](https://github.com/willnorris/imageproxy/pull/29),
|
([#29](https://github.com/willnorris/imageproxy/pull/29),
|
||||||
[sevki](https://github.com/sevki))
|
[sevki](https://github.com/sevki))
|
||||||
- allow scaling image beyond its original size with `-scaleUp` flag
|
- allow scaling image beyond its original size with `-scaleUp` flag
|
||||||
([#37](https://github.com/willnorris/imageproxy/pull/37),
|
([#37](https://github.com/willnorris/imageproxy/pull/37),
|
||||||
[runemadsen](https://github.com/runemadsen))
|
[runemadsen](https://github.com/runemadsen))
|
||||||
- add ability to restrict HTTP referrer
|
- add ability to restrict HTTP referrer
|
||||||
([9213c93](https://github.com/willnorris/imageproxy/commit/9213c93),
|
([9213c93](https://github.com/willnorris/imageproxy/commit/9213c93),
|
||||||
[connor4312](https://github.com/connor4312))
|
[connor4312](https://github.com/connor4312))
|
||||||
- preserve cache-control header from remote image
|
- preserve cache-control header from remote image
|
||||||
([#43](https://github.com/willnorris/imageproxy/pull/43),
|
([#43](https://github.com/willnorris/imageproxy/pull/43),
|
||||||
[runemadsen](https://github.com/runemadsen))
|
[runemadsen](https://github.com/runemadsen))
|
||||||
- add support for caching images on Amazon S3
|
- add support for caching images on Amazon S3
|
||||||
([ec96fcb](https://github.com/willnorris/imageproxy/commit/ec96fcb)
|
([ec96fcb](https://github.com/willnorris/imageproxy/commit/ec96fcb)
|
||||||
[victortrac](https://github.com/victortrac))
|
[victortrac](https://github.com/victortrac))
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
- change default cache to none, and add `-cache` flag for specifying caches.
|
|
||||||
|
- change default cache to none, and add `-cache` flag for specifying caches.
|
||||||
This deprecates the `-cacheDir` flag.
|
This deprecates the `-cacheDir` flag.
|
||||||
- on-disk cache now stores files in a two-level trie. For example, for a file
|
- on-disk cache now stores files in a two-level trie. For example, for a file
|
||||||
named "c0ffee", store file as "c0/ff/c0ffee".
|
named "c0ffee", store file as "c0/ff/c0ffee".
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
- skip resizing if requested dimensions larger than original
|
|
||||||
|
- skip resizing if requested dimensions larger than original
|
||||||
([#46](https://github.com/willnorris/imageproxy/pull/46),
|
([#46](https://github.com/willnorris/imageproxy/pull/46),
|
||||||
[orian](https://github.com/orian))
|
[orian](https://github.com/orian))
|
||||||
|
|
||||||
## [0.4.0] (2015-05-21)
|
## [0.4.0] (2015-05-21)
|
||||||
|
|
||||||
[0.4.0]: https://github.com/willnorris/imageproxy/compare/v0.3.0...v0.4.0
|
[0.4.0]: https://github.com/willnorris/imageproxy/compare/v0.3.0...v0.4.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- added support for animated gifs
|
|
||||||
|
- added support for animated gifs
|
||||||
([#23](https://github.com/willnorris/imageproxy/issues/23))
|
([#23](https://github.com/willnorris/imageproxy/issues/23))
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- non-200 responses from remote servers are proxied as-is
|
|
||||||
|
- non-200 responses from remote servers are proxied as-is
|
||||||
|
|
||||||
## [0.3.0] (2015-12-07)
|
## [0.3.0] (2015-12-07)
|
||||||
|
|
||||||
[0.3.0]: https://github.com/willnorris/imageproxy/compare/v0.2.3...v0.3.0
|
[0.3.0]: https://github.com/willnorris/imageproxy/compare/v0.2.3...v0.3.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- added support for signing requests using a sha-256 HMAC.
|
|
||||||
|
- added support for signing requests using a sha-256 HMAC.
|
||||||
([a9efefc](https://github.com/willnorris/imageproxy/commit/a9efefc))
|
([a9efefc](https://github.com/willnorris/imageproxy/commit/a9efefc))
|
||||||
- more complete logging of requests and whether response is from the cache
|
- more complete logging of requests and whether response is from the cache
|
||||||
([#17](https://github.com/willnorris/imageproxy/issues/17))
|
([#17](https://github.com/willnorris/imageproxy/issues/17))
|
||||||
- added support for a base URL for remote images. This allows shorter relative
|
- added support for a base URL for remote images. This allows shorter relative
|
||||||
URLs to be specified in requests.
|
URLs to be specified in requests.
|
||||||
([#15](https://github.com/willnorris/imageproxy/issues/15))
|
([#15](https://github.com/willnorris/imageproxy/issues/15))
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- be more precise in copying over all headers from remote image response
|
|
||||||
|
- be more precise in copying over all headers from remote image response
|
||||||
([1bf0515](https://github.com/willnorris/imageproxy/commit/1bf0515))
|
([1bf0515](https://github.com/willnorris/imageproxy/commit/1bf0515))
|
||||||
|
|
||||||
## [0.2.3] (2015-02-20)
|
## [0.2.3] (2015-02-20)
|
||||||
|
|
||||||
[0.2.3]: https://github.com/willnorris/imageproxy/compare/v0.2.2...v0.2.3
|
[0.2.3]: https://github.com/willnorris/imageproxy/compare/v0.2.2...v0.2.3
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- added quality option
|
|
||||||
|
- added quality option
|
||||||
([#13](https://github.com/willnorris/imageproxy/pull/13)
|
([#13](https://github.com/willnorris/imageproxy/pull/13)
|
||||||
[cubabit](https://github.com/cubabit))
|
[cubabit](https://github.com/cubabit))
|
||||||
|
|
||||||
## [0.2.2] (2014-12-08)
|
## [0.2.2] (2014-12-08)
|
||||||
|
|
||||||
[0.2.2]: https://github.com/willnorris/imageproxy/compare/v0.2.1...v0.2.2
|
[0.2.2]: https://github.com/willnorris/imageproxy/compare/v0.2.1...v0.2.2
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- added `cacheSize` flag to command line
|
|
||||||
|
- added `cacheSize` flag to command line
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- improved documentation and error messages
|
|
||||||
- negative width or height transformation values interpreted as 0
|
- improved documentation and error messages
|
||||||
|
- negative width or height transformation values interpreted as 0
|
||||||
|
|
||||||
## [0.2.1] (2014-08-13)
|
## [0.2.1] (2014-08-13)
|
||||||
|
|
||||||
[0.2.1]: https://github.com/willnorris/imageproxy/compare/v0.2.0...v0.2.1
|
[0.2.1]: https://github.com/willnorris/imageproxy/compare/v0.2.0...v0.2.1
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- restructured package so that the command line tools is now installed from
|
|
||||||
|
- restructured package so that the command line tools is now installed from
|
||||||
`willnorris.com/go/imageproxy/cmd/imageproxy`
|
`willnorris.com/go/imageproxy/cmd/imageproxy`
|
||||||
|
|
||||||
## [0.2.0] (2014-07-02)
|
## [0.2.0] (2014-07-02)
|
||||||
|
|
||||||
[0.2.0]: https://github.com/willnorris/imageproxy/compare/v0.1.0...v0.2.0
|
[0.2.0]: https://github.com/willnorris/imageproxy/compare/v0.1.0...v0.2.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- transformed images are cached in addition to the original image
|
|
||||||
|
- transformed images are cached in addition to the original image
|
||||||
([#1](https://github.com/willnorris/imageproxy/issues/1))
|
([#1](https://github.com/willnorris/imageproxy/issues/1))
|
||||||
- support etag and last-modified headers on incoming requests
|
- support etag and last-modified headers on incoming requests
|
||||||
([#3](https://github.com/willnorris/imageproxy/issues/3))
|
([#3](https://github.com/willnorris/imageproxy/issues/3))
|
||||||
- support wildcards in list of allowed hosts
|
- support wildcards in list of allowed hosts
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- options can be specified in any order
|
|
||||||
- images cannot be resized larger than their original dimensions
|
- options can be specified in any order
|
||||||
|
- images cannot be resized larger than their original dimensions
|
||||||
|
|
||||||
## [0.1.0] (2013-12-26)
|
## [0.1.0] (2013-12-26)
|
||||||
|
|
||||||
[0.1.0]: https://github.com/willnorris/imageproxy/compare/5d75e8a...v0.1.0
|
[0.1.0]: https://github.com/willnorris/imageproxy/compare/5d75e8a...v0.1.0
|
||||||
|
|
||||||
Initial release. Supported transformation options include:
|
Initial release. Supported transformation options include:
|
||||||
- width and height
|
|
||||||
- different crop modes
|
- width and height
|
||||||
- rotation (in 90 degree increments)
|
- different crop modes
|
||||||
- flip (horizontal or vertical)
|
- rotation (in 90 degree increments)
|
||||||
|
- flip (horizontal or vertical)
|
||||||
|
|
||||||
Images can be cached in-memory or on-disk.
|
Images can be cached in-memory or on-disk.
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ eventually relent, and
|
||||||
[#49](https://github.com/willnorris/imageproxy/issues/49) tracked adding
|
[#49](https://github.com/willnorris/imageproxy/issues/49) tracked adding
|
||||||
support for the most common backends.
|
support for the most common backends.
|
||||||
|
|
||||||
Unfortunately my concerns proved true, and build times are *significantly*
|
Unfortunately my concerns proved true, and build times are _significantly_
|
||||||
slower (TODO: add concrete numbers) now because of all the additional cloud
|
slower (TODO: add concrete numbers) now because of all the additional cloud
|
||||||
SDKs that get compiled in. I don't personally care too much about binary size,
|
SDKs that get compiled in. I don't personally care too much about binary size,
|
||||||
since I'm not running in a constrained environment, but these build times are
|
since I'm not running in a constrained environment, but these build times are
|
||||||
|
|
@ -40,11 +40,12 @@ back out.
|
||||||
### Plugin support in Go
|
### Plugin support in Go
|
||||||
|
|
||||||
TODO: talk about options like
|
TODO: talk about options like
|
||||||
- RPC (https://github.com/hashicorp/go-plugin)
|
|
||||||
- pkg/plugin (https://golang.org/pkg/plugin/)
|
- RPC (<https://github.com/hashicorp/go-plugin>)
|
||||||
- embedded interpreter (https://github.com/robertkrimen/otto)
|
- pkg/plugin (<https://golang.org/pkg/plugin/>)
|
||||||
- custom binaries (https://github.com/mholt/caddy,
|
- embedded interpreter (<https://github.com/robertkrimen/otto>)
|
||||||
https://caddy.community/t/59)
|
- custom binaries (<https://github.com/mholt/caddy>,
|
||||||
|
<https://caddy.community/t/59>)
|
||||||
|
|
||||||
Spoiler: I'm planning on following the Caddy approach and using custom
|
Spoiler: I'm planning on following the Caddy approach and using custom
|
||||||
binaries.
|
binaries.
|
||||||
|
|
@ -60,11 +61,12 @@ much about personally. Of course, users can also write their own plugins and
|
||||||
link them in without needing to contribute them to core if they don't want to.
|
link them in without needing to contribute them to core if they don't want to.
|
||||||
|
|
||||||
I anticipate providing two or three build configurations in core:
|
I anticipate providing two or three build configurations in core:
|
||||||
- **full** - include all the plugins that are part of core (except where they
|
|
||||||
|
- **full** - include all the plugins that are part of core (except where they
|
||||||
may conflict)
|
may conflict)
|
||||||
- **minimal** - some set of minimal features that only includes basic caching
|
- **minimal** - some set of minimal features that only includes basic caching
|
||||||
options, limited transformation options, etc
|
options, limited transformation options, etc
|
||||||
- **my personal config** - I'll also definitely have a build that I use
|
- **my personal config** - I'll also definitely have a build that I use
|
||||||
personally on my site. I may decide to just make that the "minimal" build
|
personally on my site. I may decide to just make that the "minimal" build
|
||||||
and perhaps call it something different, rather than have a third
|
and perhaps call it something different, rather than have a third
|
||||||
configuration.
|
configuration.
|
||||||
|
|
@ -119,13 +121,13 @@ options.
|
||||||
There have been a number of requests for imge format support that require cgo
|
There have been a number of requests for imge format support that require cgo
|
||||||
libraries:
|
libraries:
|
||||||
|
|
||||||
- **webp encoding** - needs cgo
|
- **webp encoding** - needs cgo
|
||||||
[#114](https://github.com/willnorris/imageproxy/issues/114)
|
[#114](https://github.com/willnorris/imageproxy/issues/114)
|
||||||
- **progressive jpegs** - probably needs cgo?
|
- **progressive jpegs** - probably needs cgo?
|
||||||
[#77](https://github.com/willnorris/imageproxy/issues/77)
|
[#77](https://github.com/willnorris/imageproxy/issues/77)
|
||||||
- **gif to mp4** - maybe doable in pure go, but probably belongs in a plugin
|
- **gif to mp4** - maybe doable in pure go, but probably belongs in a plugin
|
||||||
[#136](https://github.com/willnorris/imageproxy/issues/136)
|
[#136](https://github.com/willnorris/imageproxy/issues/136)
|
||||||
- **HEIF** - formate used by newer iPhones
|
- **HEIF** - formate used by newer iPhones
|
||||||
([HEIF](https://en.wikipedia.org/wiki/High_Efficiency_Image_File_Format))
|
([HEIF](https://en.wikipedia.org/wiki/High_Efficiency_Image_File_Format))
|
||||||
|
|
||||||
#### Option parsing
|
#### Option parsing
|
||||||
|
|
@ -151,7 +153,7 @@ module](https://nginx.org/en/docs/http/ngx_http_secure_link_module.html).
|
||||||
Plugins are loaded simply by importing their package. They should have an
|
Plugins are loaded simply by importing their package. They should have an
|
||||||
`init` func that calls `imageproxy.RegisterPlugin`:
|
`init` func that calls `imageproxy.RegisterPlugin`:
|
||||||
|
|
||||||
``` go
|
```go
|
||||||
type Plugin struct {
|
type Plugin struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -164,7 +166,7 @@ imageproxy by implementing multiple interfaces.
|
||||||
|
|
||||||
For example, two possible interfaces for security related plugins:
|
For example, two possible interfaces for security related plugins:
|
||||||
|
|
||||||
``` go
|
```go
|
||||||
// A RequestAuthorizer determines if a request is authorized to be processed.
|
// A RequestAuthorizer determines if a request is authorized to be processed.
|
||||||
// Requests are processed before the remote resource is retrieved.
|
// Requests are processed before the remote resource is retrieved.
|
||||||
type RequestAuthorizer interface {
|
type RequestAuthorizer interface {
|
||||||
|
|
@ -186,7 +188,7 @@ type ResponseAuthorizer interface {
|
||||||
|
|
||||||
A hypothetical interface for plugins that transform images:
|
A hypothetical interface for plugins that transform images:
|
||||||
|
|
||||||
``` go
|
```go
|
||||||
// An ImageTransformer transforms an image.
|
// An ImageTransformer transforms an image.
|
||||||
type ImageTransformer interface {
|
type ImageTransformer interface {
|
||||||
// TransformImage based on the provided options and return the result.
|
// TransformImage based on the provided options and return the result.
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,14 @@ Signatures can be calculated in two ways:
|
||||||
In both cases, the signature is calculated using HMAC-SHA256 and a secret key
|
In both cases, the signature is calculated using HMAC-SHA256 and a secret key
|
||||||
which is provided to imageproxy on startup. The message to be signed is the
|
which is provided to imageproxy on startup. The message to be signed is the
|
||||||
remote URL, with the transformation options optionally set as the URL fragment,
|
remote URL, with the transformation options optionally set as the URL fragment,
|
||||||
[as documented below](#Signing-options). The signature is url-safe base64
|
[as documented below](#signing-options). The signature is url-safe base64
|
||||||
encoded, and [provided as an option][s-option] in the imageproxy request.
|
encoded, and [provided as an option][s-option] in the imageproxy request.
|
||||||
|
|
||||||
imageproxy will accept signatures for URLs with or without options
|
imageproxy will accept signatures for URLs with or without options
|
||||||
transparently. It's up to the publisher of the signed URLs to decide which
|
transparently. It's up to the publisher of the signed URLs to decide which
|
||||||
method they use to generate the URL.
|
method they use to generate the URL.
|
||||||
|
|
||||||
[s-option]: https://godoc.org/willnorris.com/go/imageproxy#hdr-Signature
|
[s-option]: https://pkg.go.dev/willnorris.com/go/imageproxy#hdr-Signature-ParseOptions
|
||||||
|
|
||||||
## Signing options
|
## Signing options
|
||||||
|
|
||||||
|
|
@ -57,9 +57,8 @@ the signed value would be:
|
||||||
The `100` size option was put in its canonical form of `100x100`, and the
|
The `100` size option was put in its canonical form of `100x100`, and the
|
||||||
options are sorted, moving `q75` before `r90`.
|
options are sorted, moving `q75` before `r90`.
|
||||||
|
|
||||||
[ParseOptions]: https://godoc.org/willnorris.com/go/imageproxy#ParseOptions
|
[ParseOptions]: https://pkg.go.dev/willnorris.com/go/imageproxy#ParseOptions
|
||||||
[size option]: https://godoc.org/willnorris.com/go/imageproxy#hdr-Size_and_Cropping
|
[size option]: https://pkg.go.dev/willnorris.com/go/imageproxy#hdr-Size_and_Cropping-ParseOptions
|
||||||
|
|
||||||
|
|
||||||
## Signed options example
|
## Signed options example
|
||||||
|
|
||||||
|
|
@ -76,8 +75,6 @@ and our resulting signed key is `0sR2kjyfiF1RQRj4Jm2fFa3_6SDFqdAaDEmy1oD2U-4=`
|
||||||
The final url would be
|
The final url would be
|
||||||
`http://localhost:8080/400x400,q40,s0sR2kjyfiF1RQRj4Jm2fFa3_6SDFqdAaDEmy1oD2U-4=/https://octodex.github.com/images/codercat.jpg`
|
`http://localhost:8080/400x400,q40,s0sR2kjyfiF1RQRj4Jm2fFa3_6SDFqdAaDEmy1oD2U-4=/https://octodex.github.com/images/codercat.jpg`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Language Examples
|
## Language Examples
|
||||||
|
|
||||||
Here are examples of calculating signatures in a variety of languages. These
|
Here are examples of calculating signatures in a variety of languages. These
|
||||||
|
|
@ -90,6 +87,7 @@ See also the [imageproxy-sign tool](/cmd/imageproxy-sign).
|
||||||
### Go
|
### Go
|
||||||
|
|
||||||
main.go:
|
main.go:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
|
@ -180,38 +178,40 @@ url = sys.argv[2]
|
||||||
print base64.urlsafe_b64encode(hmac.new(key, msg=url, digestmod=hashlib.sha256).digest())
|
print base64.urlsafe_b64encode(hmac.new(key, msg=url, digestmod=hashlib.sha256).digest())
|
||||||
```
|
```
|
||||||
|
|
||||||
````shell
|
```shell
|
||||||
$ python sign.py "secretkey" "https://octodex.github.com/images/codercat.jpg"
|
$ python sign.py "secretkey" "https://octodex.github.com/images/codercat.jpg"
|
||||||
cw34eyalj8YvpLpETxSIxv2k8QkLel2UAR5Cku2FzGM=
|
cw34eyalj8YvpLpETxSIxv2k8QkLel2UAR5Cku2FzGM=
|
||||||
````
|
```
|
||||||
|
|
||||||
### JavaScript
|
### JavaScript
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const crypto = require('crypto');
|
const crypto = require("crypto");
|
||||||
const URLSafeBase64 = require('urlsafe-base64');
|
const URLSafeBase64 = require("urlsafe-base64");
|
||||||
|
|
||||||
let key = process.argv[2];
|
let key = process.argv[2];
|
||||||
let url = process.argv[3];
|
let url = process.argv[3];
|
||||||
console.log(URLSafeBase64.encode(crypto.createHmac('sha256', key).update(url).digest()));
|
console.log(
|
||||||
|
URLSafeBase64.encode(crypto.createHmac("sha256", key).update(url).digest()),
|
||||||
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
````shell
|
```shell
|
||||||
$ node sign.js "secretkey" "https://octodex.github.com/images/codercat.jpg"
|
$ node sign.js "secretkey" "https://octodex.github.com/images/codercat.jpg"
|
||||||
cw34eyalj8YvpLpETxSIxv2k8QkLel2UAR5Cku2FzGM=
|
cw34eyalj8YvpLpETxSIxv2k8QkLel2UAR5Cku2FzGM=
|
||||||
````
|
```
|
||||||
|
|
||||||
### PHP
|
### PHP
|
||||||
|
|
||||||
````php
|
```php
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$key = $argv[1];
|
$key = $argv[1];
|
||||||
$url = $argv[2];
|
$url = $argv[2];
|
||||||
echo strtr(base64_encode(hash_hmac('sha256', $url, $key, 1)), '/+' , '_-');
|
echo strtr(base64_encode(hash_hmac('sha256', $url, $key, 1)), '/+' , '_-');
|
||||||
````
|
```
|
||||||
|
|
||||||
````shell
|
```shell
|
||||||
$ php sign.php "secretkey" "https://octodex.github.com/images/codercat.jpg"
|
$ php sign.php "secretkey" "https://octodex.github.com/images/codercat.jpg"
|
||||||
cw34eyalj8YvpLpETxSIxv2k8QkLel2UAR5Cku2FzGM=
|
cw34eyalj8YvpLpETxSIxv2k8QkLel2UAR5Cku2FzGM=
|
||||||
````
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue