1
0
Fork
You've already forked mediaproxyoma
0
alternative media proxy backend for pleroma/akkoma
  • Go 73%
  • Shell 20%
  • Dockerfile 7%
Find a file
2026年03月12日 04:18:36 +07:00
installation/init.d installation/init.d: make it work properly 2026年03月02日 22:23:42 +07:00
docker-compose.yml yea. 2026年02月22日 02:35:49 +07:00
Dockerfile Dockerfile: great ass typo 2026年02月03日 01:45:37 +07:00
endpoint_manipulate.go sigverifier, then rename... 2026年02月22日 02:12:36 +07:00
getUrl.go sigverifier, then rename... 2026年02月22日 02:12:36 +07:00
go.mod proxy: expose source code link 2026年02月03日 01:43:58 +07:00
headers.go yea. 2026年02月22日 02:35:49 +07:00
LICENSE . 2026年02月01日 22:33:05 +07:00
main.go http: add support for name param for link_name on pleroma 2026年03月07日 00:01:02 +07:00
proxy.go use thumbnail for preview & resize it max to 1080p. 2026年03月12日 04:18:36 +07:00
README.md update readme 2026年02月22日 02:56:54 +07:00
sigverifier.go sigverifier, then rename... 2026年02月22日 02:12:36 +07:00

mediaproxyoma

what is dis: alternative media proxy backend for pleroma/akkoma

why?

you might want to separate the process of processing proxy and thumbnail processing right at the same time in order to reduce load and avoiding crashes due to one of the part is broken (which is rare).

however, the real reason here though is: apparently we have rather some problems with the existing mediaproxy (slow fetching, streaming & thumbnail processing), so we use libvips for image preview processing, and it's using webp for thumbnail preview by default to save more bandwidth to users.

while libvips itself has been used in pleroma backend, some backend/fork like akkoma is still relying on a command line convert imagemagick command.

on top of that, we also have:

  • a really quick GIF->Animated WEBP processing (for preview only, the real thing remains unaltered)
  • a really quick video thumbnail processing

running

requirements: you need a working go-bwhero backend, and a golang compiler.

go build -o mediaproxyoma .

set the two following variable names

  • BWHERO_HOST for bandwidth hero server address (example: "http://localhost:8080/")
  • LISTEN for listen address (syntax: ":")

running:

env BWHERO_HOST=http://localhost:8080/ LISTEN=0.0.0.0:8888 ./mediaproxyoma

optional to set: USER_AGENT

or, spin the entire thing alongside go-bwhero via docker compose:

docker compose up

it will be on localhost:8080.

then, configure your reverse proxy to forward any request going to /proxy/* to be forwarded to http://localhost:8080/ instead.

optional, but IMPORTANT for production

by default, mediaproxyoma:

  • has a default user agent linking to itself
  • didn't check for signature

this is good for testing, but NOT for production server.

so, if you're planning to use this in production, you must configure the following environment variables:

  • USER_AGENT
  • PLEROMA_SECRET_KEY_BASE

you can obtain PLEROMA_SECRET_KEY_BASE in your prod.secret.exs config:

import Config
config :pleroma, Pleroma.Web.Endpoint,
 url: [host: "fedinet.waltuh.cyou", scheme: "https", port: 443],
 http: [ip: {127.0.0.1}, port: 4000],
 secret_key_base: "/xxxxxxxx/xxxxxxx",
 # ^ TAKE THIS
 live_view: [signing_salt: "XXXXXX"],
 signing_salt: "XXXXXX"

then set it in environment variable:

env \
 USER_AGENT="mediaproxyoma at fedinet.example.com; admin contact: mailto:admin@example.com" \
 PLEROMA_SECRET_KEY_BASE="/xxxxxxxx/xxxxxxx" \
 ./mediaproxyoma

notice: you MUST KEEP THE SECRET KEY BASE SECRET.

misc if you wanna deal with old media

we have the following optional environment variables:

  • OLD_MEDIA_HOST
  • OLD_MEDIA_PATHPREFIX
  • NEW_MEDIA_HOST
  • NEW_MEDIA_SCHEME
  • NEW_MEDIA_PATHPREFIX

say, you just have yourself migrated your media URL (and also it's files) from https://eu2.somestorage.com/xxx:fedi/ to https://media.waltuh.cyou/media/, where that new URL is actually reverse proxying on a varnish backend at http://127.0.0.1:6081 in the same machine/network as where your mediaproxyoma is running.

so, you need to run mediaproxyoma like this:

env \
 BWHERO_HOST=http://127.0.0.1:8111 \
 LISTEN=0.0.0.0:8080 \
 OLD_MEDIA_HOST=eu2.somestorage.com \
 OLD_MEDIA_PATHPREFIX=/xxx:fedi/ \
 NEW_MEDIA_HOST=127.0.0.1:6081 \
 NEW_MEDIA_SCHEME=http \
 NEW_MEDIA_PATHPREFIX=/media/ \
 ./mediaproxyoma

The following example will make mediaproxyoma proxy anything that goes to https://eu2.somestorage.com/xxx:fedi/<filename> going to http://127.0.0.1:6081/media/<filename> instead. It's useful for say, making full use of varnish cache.

other probably useful environment variable

changing Allowed Origin for CORS: ALLOW_ORIGIN (default is *)