A Mastodonwide Recognized Avatar API
This API provides you with avatar link or proxied avatar file through fediverse account name (@username@localpart).
https://mravatar.dragoncloud.win/avatar/@[email protected]
https://mravatar.dragoncloud.win/avatar/[email protected]
GET
request https://mravatar.dragoncloud.win/avatar/@[email protected] or https://mravatar.dragoncloud.win/avatar/[email protected]
proxied
true
Enable proxying from Mravatarfalse
(default) Retrieve302
redirect
no-cache
true
Force request latest avartarfalse
Use Mravatar cache (if exists). Cache is refreshed every 3h.
default
<url-encoded-img-url>
Set fallback image url. (Defaults to https://cdn.jsdelivr.net/gh/mastodon/mastodon@latest/public/avatars/original/missing.png)
Example: https://mravatar.dragoncloud.win/avatar/[email protected]?no-cache=true&proxied=true&default=https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2F4%2F48%2FMastodon_Logotype_%2528Simple%2529.svg
Mravatar requires Python3.7+
, which means you'll have to compile Python3.7 yourself if you are on CentOS 7
Make sure you have python3
, pip3
, python3-devel
and virtualenv
installed.
You also need uWSGI
for the backend server. Feel free to use other backends.
Create a new user. Clone this repo. Setup virtualenv. Copy dist files. Start your server. Enjoy!
pip3 install virtualenv
useradd mravatar
sudo su - mravatar
git clone https://github.com/HolgerHuo/mravatar.git mravatar
cd mravatar
virtualenv mravatar
source mravatar/bin/activate
pip3 install -r requirement.txt
exit
cp /home/mravatar/mravatar/dist/mravatar.service /etc/systemd/system/mravatar.service
cp /home/mravatar/mravatar/dist/mravatar.conf /etc/nginx/conf.d/mravatar.conf
systemctl enable --now mravatar
systemctl reload nginx
GNU Affero General Public License v3.0
©️ Holger Huo, Mastodon