Improve template title
This commit is contained in:
parent
b7c421ff80
commit
8ed8a436e5
3 changed files with 8 additions and 4 deletions
8
app.py
8
app.py
|
@ -34,7 +34,7 @@ from flask import request
|
|||
from flask import session
|
||||
from flask import url_for
|
||||
from flask_wtf.csrf import CSRFProtect
|
||||
from html2text import html2text
|
||||
import html2text
|
||||
from itsdangerous import BadSignature
|
||||
from little_boxes import activitypub as ap
|
||||
from little_boxes.activitypub import ActivityType
|
||||
|
@ -123,6 +123,10 @@ else:
|
|||
|
||||
SIG_AUTH = HTTPSigAuth(KEY)
|
||||
|
||||
H2T = html2text.HTML2Text()
|
||||
H2T.ignore_links = True
|
||||
H2T.ignore_images = True
|
||||
|
||||
|
||||
def is_blacklisted(url: str) -> bool:
|
||||
return urlparse(url).netloc in BLACKLIST
|
||||
|
@ -340,7 +344,7 @@ def clean(html):
|
|||
|
||||
@app.template_filter()
|
||||
def html2plaintext(body):
|
||||
return html2text(body)
|
||||
return H2T.handle(body)
|
||||
|
||||
|
||||
@app.template_filter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue