diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index e016eba..997dbae 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -208,7 +208,6 @@ jobs: direction: upload token: ${{ secrets.GITHUB_TOKEN }} release-dir: artifacts/ - prerelease: true publish-crate: needs: [build] diff --git a/README.md b/README.md index 7ce4a0f..ffee613 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/releases/0.5.7.md b/releases/0.5.7.md new file mode 100644 index 0000000..c737a19 --- /dev/null +++ b/releases/0.5.7.md @@ -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.