1
0
mirror of https://github.com/Luzifer/preserve.git synced 2024-09-07 18:59:08 +00:00
Little HTTP server to preserve the presence of URLs
Go to file
2024-04-19 19:48:33 +02:00
.github/workflows [CI] Replace deprecated CI tooling 2023-12-29 18:11:09 +01:00
ci [CI] Replace deprecated CI tooling 2023-12-29 18:11:09 +01:00
pkg/storage Modernize code, update dependencies 2023-12-29 17:58:30 +01:00
.gitignore Initial version 2020-06-14 02:09:06 +02:00
.golangci.yml Modernize code, update dependencies 2023-12-29 17:58:30 +01:00
cache.go Modernize code, update dependencies 2023-12-29 17:58:30 +01:00
Dockerfile [CI] Replace deprecated CI tooling 2023-12-29 18:11:09 +01:00
go.mod Update dependencies 2024-04-19 19:47:14 +02:00
go.sum Update dependencies 2024-04-19 19:47:14 +02:00
History.md prepare release v0.3.5 2024-04-19 19:48:33 +02:00
LICENSE Initial version 2020-06-14 02:09:06 +02:00
main.go Fix: Error wrapping broke error check 2023-12-29 18:51:52 +01:00
Makefile [CI] Replace deprecated CI tooling 2023-12-29 18:11:09 +01:00
README.md Add base64 description to README 2021-11-05 16:19:51 +01:00

Go Report Card

Luzifer / preserve

preserve is a little HTTP server to preserve the presence of URLs.

Ever relied on an HTTP resource to be available and it vanished? Happened too often to me so I wrote a little tool to prevent URLs from vanishing: preserve.

Usage

After you've started preserve it will by default listen on port 3000 and you can start using it by prefixing the URL of the resource:

Lets say you want to ensure the image https://example.com/image.png does not vanish:

  • http://localhost:3000/https://example.com/image.png will fetch the resource once and then deliver it from the local cache
  • http://localhost:3000/latest/https://example.com/image.png will fetch the resource with every request until it gets unavailable and then serve it from local cache

This also works with parameters:

http://localhost:3000/https://pbs.twimg.com/media/somemediaid?format=jpg&name=4096x4096

If you do have some service (like Discord) screwing up these URLs you can apply base64 URL-Encoding to them (do NOT omit the padding):

http://localhost:3000/b64:aHR0cHM6Ly9wYnMudHdpbWcuY29tL21lZGlhL3NvbWVtZWRpYWlkP2Zvcm1hdD1qcGcmbmFtZT00MDk2eDQwOTY=

Select Storage Provider

Local files

preserve \
  --listen=:3000 \
  --storage-provider=local \
  --storage-dir=/var/lib/preserve

Google Cloud Storage

preserve \
  --listen=:3000 \
  --storage-provider=gcs \
  --bucket-uri=gs://mybucket/prefix