Add release document for 0.5.7, add blurhash endpoint to readme

This commit is contained in:
asonix 2024-03-03 11:08:47 -06:00
parent feb8840761
commit 719626de07
3 changed files with 109 additions and 1 deletions

View file

@ -208,7 +208,6 @@ jobs:
direction: upload
token: ${{ secrets.GITHUB_TOKEN }}
release-dir: artifacts/
prerelease: true
publish-crate:
needs: [build]

View file

@ -380,6 +380,22 @@ pict-rs offers the following endpoints:
These proxied images are removed from pict-rs some time after their last access. This time
is configurable with `PICTRS__MEDIA__RETENTION__PROXY`. See (./pict-rs.toml)[./pict-rs.toml]
for more information.
- `GET /image/blurhash?alias={alias}` Create and store a blurhash for the provided alias
Available source arguments are
- `?alias={alias}` Serve a blurhash for an image identified by the provided alias
- `?proxy={url}` Serve a blurhash for the media hosted at `url`
This will download and store the original version of the specified media, as well as its
blurhash. Retention for proxied media is configurable with `PICTRS__MEDIA__RETENTION__PROXY`.
See (./pict-rs.toml)[./pict-rs.toml] for more information.
The returned JSON is structured like so:
```json
{
"msg": "ok",
"blurhash": "LGF5]+Yk^6#M@-5c,1J5@[or[Q6."
}
```
- `GET /image/process.{ext}?src={alias}&...` Get a file with transformations applied.
Available source arguments are
- `?src={alias}` This behavior is the same as in previous releases

93
releases/0.5.7.md Normal file
View file

@ -0,0 +1,93 @@
# pict-rs 0.5.7
## Overview
pict-rs 0.5.7 adds support for generating blurhashes from images and includes a couple unrelated
fixes and tweaks.
### Features
- [Blurhash Endpoint](#blurhash-endpoint)
### Changes
- [File Path Changes](#file-path-changes)
- [Performance Improvements](#performance-improvements)
### Fixes
- [More Consistent Errors](#more-consistent-errors)
- [APNG Detection](#apng-detection)
## Upgrade Notes
There is a small repo format migration between 0.5.6 and 0.5.7. For sled it's simply opening a new
tree, for postgres it involves adding a new column to the hashes table. These changes will
automatically apply when launching pict-rs 0.5.7. Upgrading should be as simple as pulling a new
version of pict-rs.
## Descriptions
### Blurhash Endpoint
A new endpoint at `/image/blurhash` has been added for generating blurhashes from uploaded media. A
blurhash is a short string that encodes a few notable color values from an image that can be
reconstructed into a blurred approximation of the original image. Notably, blurhashes are used by
Mastodon to act as placeholders for sensitive media. For more information about blurhashes, see
[blurha.sh](https://blurha.sh).
This endpoint is powered by my new blurhash encoding library,
[blurhash-update](https://crates.io/crates/blurhash-update).
On success, the blurhash endpoint returns the following JSON.
```json
{
"msg": "ok",
"blurhash": "LGF5]+Yk^6#M@-5c,1J5@[or[Q6."
}
```
pict-rs does not provide a blurhash decoding mechanism (it would defeat the purpose of blurhashes to
do so).
### File Path Changes
pict-rs has dropped its dependency on my `storage-path-generator` library in favor of using UUIDs to
create unique file paths for uploaded media. This means that newly uploaded media will be stored in
a different directory structure, and with different filenames. The purpose of this is to reduce
database use by removing the need to synchronize the current path state.
pict-rs 0.5.7 also adds file extensions back to file paths, since they are now somewhat-publicly
visible (when using the public_endpoint configuration with object storage).
Neither of these changes affect previously uploaded media.
### Performance Improvements
pict-rs 0.5.7 now buffers media in memory less frequently, opting to stream bytes directly from
sources to sinks. This should improve general memory use, as well as decrease time pict-rs would
spend waiting to aggregate bytes.
pict-rs also no longer requires bytes be present in contiguous buffers, avoiding large allocations
and reducing memcpys.
### More Consistent Errors
pict-rs 0.5 introduced machine-readable error codes that returned alongside error messages, but
there were a couple locations in pict-rs that failed to include them. pict-rs 0.5.7 resolves this,
ensuring all error paths properly return codes.
### APNG Detection
pict-rs 0.5.7 fixes the imagemagick delegate policy for ffmpeg, which allows for properly detecting
certain media, notably APNG files. pict-rs should once again be able to properly handle uploaded
APNGs.