From 8556cd29efe315deab1cc7d6db9c34e095c192bc Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Wed, 4 Jul 2018 21:08:45 +0200 Subject: [PATCH] Add avatar to the webfinger response --- app.py | 6 ++++++ config.py | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index f768ad5..ed8ca9c 100644 --- a/app.py +++ b/app.py @@ -46,6 +46,7 @@ from config import DB from config import DEBUG_MODE from config import DOMAIN from config import HEADERS +from config import ICON_URL from config import ID from config import JWT from config import KEY @@ -715,6 +716,11 @@ def wellknown_webfinger(): "rel": "http://webfinger.net/rel/profile-page", "type": "text/html", }, + { + "href": ICON_URL, + "rel": "http://webfinger.net/rel/avatar", + "type": mimetypes.guess_type(ICON_URL)[0], + }, ], } diff --git a/config.py b/config.py index 38cf802..5f2da9c 100644 --- a/config.py +++ b/config.py @@ -1,3 +1,4 @@ +import mimetypes import os import subprocess from datetime import datetime @@ -83,7 +84,7 @@ with open(os.path.join(SASS_DIR, f"{THEME_STYLE.value}.scss")) as f: theme_css += "\n" with open(os.path.join(SASS_DIR, "base_theme.scss")) as f: raw_css = theme_css + f.read() - CSS = sass.compile(string=raw_css, output_style='compressed') + CSS = sass.compile(string=raw_css, output_style="compressed") USER_AGENT = ( @@ -136,6 +137,10 @@ ME = { "summary": SUMMARY, "endpoints": {}, "url": ID, - "icon": {"mediaType": "image/png", "type": "Image", "url": ICON_URL}, + "icon": { + "mediaType": mimetypes.guess_type(ICON_URL)[0], + "type": "Image", + "url": ICON_URL, + }, "publicKey": KEY.to_dict(), }