Whitelist link previews client side

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
Andrea Maria Piana 2020-12-24 15:33:30 +01:00
parent d8f1944b27
commit 33e58dbca9
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
3 changed files with 7 additions and 2 deletions

View File

@ -2474,7 +2474,9 @@
:link-preview/whitelist
:<- [:multiaccount]
(fn [multiaccount]
(get multiaccount :link-previews-whitelist)))
(filter (fn [{:keys [address]}]
(config/link-preview-enabled-site? address))
(get multiaccount :link-previews-whitelist))))
(re-frame/reg-sub
:link-preview/cache

View File

@ -22,7 +22,8 @@
[::link-preview/enable title ((complement boolean) enabled?)])})))
(views/defview link-previews-settings []
(views/letsubs [{:keys [link-previews-whitelist link-previews-enabled-sites]} [:multiaccount]]
(views/letsubs [link-previews-whitelist [:link-preview/whitelist]
link-previews-enabled-sites [:link-preview/enabled-sites]]
[react/view {:flex 1}
[topbar/topbar {:title (i18n/label :t/chat-link-previews)}]
[react/image {:source (resources/get-theme-image :unfurl)

View File

@ -141,3 +141,5 @@
[id network])
default-networks)))
(def link-preview-enabled-site?
#{"youtube.com" "youtu.be"})