Don't linkify image links for outgoing html
This commit is contained in:
parent
206f5494c8
commit
d2938f8730
8
TODO.md
8
TODO.md
|
@ -1,5 +1,4 @@
|
||||||
- Refactoring
|
- Refactoring
|
||||||
- Use HInterfaceBox for EditAccount Profile and Encryption
|
|
||||||
- Banners
|
- Banners
|
||||||
|
|
||||||
- Theming
|
- Theming
|
||||||
|
@ -21,10 +20,8 @@
|
||||||
- Run import in thread and AsyncClient.olm functions, they block async loop
|
- Run import in thread and AsyncClient.olm functions, they block async loop
|
||||||
- Handle import keys errors
|
- Handle import keys errors
|
||||||
|
|
||||||
- Don't linkify images for outgoing html
|
|
||||||
- Keyboard flicking against top/bottom edge
|
|
||||||
- Don't strip user spacing in html
|
- Don't strip user spacing in html
|
||||||
|
- Keyboard flicking against top/bottom edge
|
||||||
- Do something when access token is invalid
|
- Do something when access token is invalid
|
||||||
- Message position after daybreak delegate (fixed by commit 57b1313 ?)
|
- Message position after daybreak delegate (fixed by commit 57b1313 ?)
|
||||||
- [hr not working](https://bugreports.qt.io/browse/QTBUG-74342)
|
- [hr not working](https://bugreports.qt.io/browse/QTBUG-74342)
|
||||||
|
@ -33,6 +30,7 @@
|
||||||
- UI
|
- UI
|
||||||
- Make HListView scrollbars visible
|
- Make HListView scrollbars visible
|
||||||
- Remove first html lists left margin
|
- Remove first html lists left margin
|
||||||
|
- Adapt UI for small heights
|
||||||
|
|
||||||
- Popup:
|
- Popup:
|
||||||
- label size
|
- label size
|
||||||
|
@ -77,7 +75,6 @@
|
||||||
- Conversation breaks: show time of first new msg after break instead of big
|
- Conversation breaks: show time of first new msg after break instead of big
|
||||||
blank space
|
blank space
|
||||||
- Replies
|
- Replies
|
||||||
- `pyotherside.atexit()`
|
|
||||||
- Sidepane
|
- Sidepane
|
||||||
- Header back button when reduced
|
- Header back button when reduced
|
||||||
- Better look for arrows and option button when collapsed
|
- Better look for arrows and option button when collapsed
|
||||||
|
@ -129,6 +126,7 @@
|
||||||
- Links preview
|
- Links preview
|
||||||
|
|
||||||
- Client improvements
|
- Client improvements
|
||||||
|
- `pyotherside.atexit()`
|
||||||
- Logout previous session if adding an account that's already connected
|
- Logout previous session if adding an account that's already connected
|
||||||
- Image provider: on failed conversion, way to show a "broken image" thumb?
|
- Image provider: on failed conversion, way to show a "broken image" thumb?
|
||||||
- Config file format
|
- Config file format
|
||||||
|
|
|
@ -51,16 +51,20 @@ class HtmlFilter:
|
||||||
def filter_inline(self, html: str, outgoing: bool = False) -> str:
|
def filter_inline(self, html: str, outgoing: bool = False) -> str:
|
||||||
text = self._inline_sanitizer.sanitize(html).strip("\n")
|
text = self._inline_sanitizer.sanitize(html).strip("\n")
|
||||||
|
|
||||||
if not outgoing:
|
if outgoing:
|
||||||
text = re.sub(
|
return text
|
||||||
r"(^\s*>.*)", r'<span class="greentext">\1</span>', text,
|
|
||||||
)
|
|
||||||
|
|
||||||
return text
|
return re.sub(
|
||||||
|
r"(^\s*>.*)", r'<span class="greentext">\1</span>', text,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def filter(self, html: str, outgoing: bool = False) -> str:
|
def filter(self, html: str, outgoing: bool = False) -> str:
|
||||||
html = self._sanitizer.sanitize(html)
|
html = self._sanitizer.sanitize(html)
|
||||||
|
|
||||||
|
if outgoing:
|
||||||
|
return html
|
||||||
|
|
||||||
tree = etree.fromstring(html, parser=etree.HTMLParser())
|
tree = etree.fromstring(html, parser=etree.HTMLParser())
|
||||||
|
|
||||||
if tree is None:
|
if tree is None:
|
||||||
|
@ -77,14 +81,11 @@ class HtmlFilter:
|
||||||
|
|
||||||
text = str(result, "utf-8").strip("\n")
|
text = str(result, "utf-8").strip("\n")
|
||||||
|
|
||||||
if not outgoing:
|
return re.sub(
|
||||||
text = re.sub(
|
r"<(p|br/?)>(\s*>.*)(!?</?(?:br|p)/?>)",
|
||||||
r"<(p|br/?)>(\s*>.*)(!?</?(?:br|p)/?>)",
|
r'<\1><span class="greentext">\2</span>\3',
|
||||||
r'<\1><span class="greentext">\2</span>\3',
|
text,
|
||||||
text,
|
)
|
||||||
)
|
|
||||||
|
|
||||||
return text
|
|
||||||
|
|
||||||
|
|
||||||
def sanitize_settings(self, inline: bool = False) -> dict:
|
def sanitize_settings(self, inline: bool = False) -> dict:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user