Add avatar to the webfinger response

This commit is contained in:
Thomas Sileo 2018-07-04 21:08:45 +02:00
parent 0b8e0896c1
commit 8556cd29ef
2 changed files with 13 additions and 2 deletions

6
app.py
View file

@ -46,6 +46,7 @@ from config import DB
from config import DEBUG_MODE from config import DEBUG_MODE
from config import DOMAIN from config import DOMAIN
from config import HEADERS from config import HEADERS
from config import ICON_URL
from config import ID from config import ID
from config import JWT from config import JWT
from config import KEY from config import KEY
@ -715,6 +716,11 @@ def wellknown_webfinger():
"rel": "http://webfinger.net/rel/profile-page", "rel": "http://webfinger.net/rel/profile-page",
"type": "text/html", "type": "text/html",
}, },
{
"href": ICON_URL,
"rel": "http://webfinger.net/rel/avatar",
"type": mimetypes.guess_type(ICON_URL)[0],
},
], ],
} }

View file

@ -1,3 +1,4 @@
import mimetypes
import os import os
import subprocess import subprocess
from datetime import datetime 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" theme_css += "\n"
with open(os.path.join(SASS_DIR, "base_theme.scss")) as f: with open(os.path.join(SASS_DIR, "base_theme.scss")) as f:
raw_css = theme_css + f.read() 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 = ( USER_AGENT = (
@ -136,6 +137,10 @@ ME = {
"summary": SUMMARY, "summary": SUMMARY,
"endpoints": {}, "endpoints": {},
"url": ID, "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(), "publicKey": KEY.to_dict(),
} }