Commit ac39e920 authored by Benjamin Neff's avatar Benjamin Neff

Add camo to NodeInfo

closes #7617
parent e4b0b569
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
* Ask for confirmation when leaving a submittable comment field [#7530](https://github.com/diaspora/diaspora/pull/7530) * Ask for confirmation when leaving a submittable comment field [#7530](https://github.com/diaspora/diaspora/pull/7530)
* Show users vote in polls [#7550](https://github.com/diaspora/diaspora/pull/7550) * Show users vote in polls [#7550](https://github.com/diaspora/diaspora/pull/7550)
* Add explanation of ignore function to in-app help section [#7585](https://github.com/diaspora/diaspora/pull/7585) * Add explanation of ignore function to in-app help section [#7585](https://github.com/diaspora/diaspora/pull/7585)
* Add camo information to NodeInfo [#7617](https://github.com/diaspora/diaspora/pull/7617)
# 0.7.0.1 # 0.7.0.1
......
...@@ -24,6 +24,7 @@ class NodeInfoPresenter ...@@ -24,6 +24,7 @@ class NodeInfoPresenter
doc.open_registrations = open_registrations? doc.open_registrations = open_registrations?
doc.metadata["nodeName"] = name doc.metadata["nodeName"] = name
doc.metadata["xmppChat"] = chat_enabled? doc.metadata["xmppChat"] = chat_enabled?
doc.metadata["camo"] = camo_config
doc.metadata["adminAccount"] = admin_account doc.metadata["adminAccount"] = admin_account
end end
...@@ -73,6 +74,14 @@ class NodeInfoPresenter ...@@ -73,6 +74,14 @@ class NodeInfoPresenter
AppConfig.chat.enabled? AppConfig.chat.enabled?
end end
def camo_config
{
markdown: AppConfig.privacy.camo.proxy_markdown_images?,
opengraph: AppConfig.privacy.camo.proxy_opengraph_thumbnails?,
remotePods: AppConfig.privacy.camo.proxy_remote_pod_images?
}
end
def admin_account def admin_account
AppConfig.admins.account if AppConfig.admins.account? AppConfig.admins.account if AppConfig.admins.account?
end end
......
...@@ -39,7 +39,12 @@ describe NodeInfoPresenter do ...@@ -39,7 +39,12 @@ describe NodeInfoPresenter do
}, },
"metadata" => { "metadata" => {
"nodeName" => AppConfig.settings.pod_name, "nodeName" => AppConfig.settings.pod_name,
"xmppChat" => AppConfig.chat.enabled? "xmppChat" => AppConfig.chat.enabled?,
"camo" => {
"markdown" => AppConfig.privacy.camo.proxy_markdown_images?,
"opengraph" => AppConfig.privacy.camo.proxy_opengraph_thumbnails?,
"remotePods" => AppConfig.privacy.camo.proxy_remote_pod_images?
}
} }
) )
end end
...@@ -131,6 +136,22 @@ describe NodeInfoPresenter do ...@@ -131,6 +136,22 @@ describe NodeInfoPresenter do
end end
end end
context "when camo is enabled" do
before do
AppConfig.privacy.camo.proxy_markdown_images = true
AppConfig.privacy.camo.proxy_opengraph_thumbnails = true
AppConfig.privacy.camo.proxy_remote_pod_images = true
end
it "should list enabled camo options in the metadata as true" do
expect(hash).to include "metadata" => include("camo" => {
"markdown" => true,
"opengraph" => true,
"remotePods" => true
})
end
end
context "when admin account is set" do context "when admin account is set" do
before do before do
AppConfig.admins.account = "podmin" AppConfig.admins.account = "podmin"
...@@ -160,7 +181,12 @@ describe NodeInfoPresenter do ...@@ -160,7 +181,12 @@ describe NodeInfoPresenter do
}, },
"metadata" => { "metadata" => {
"nodeName" => AppConfig.settings.pod_name, "nodeName" => AppConfig.settings.pod_name,
"xmppChat" => AppConfig.chat.enabled? "xmppChat" => AppConfig.chat.enabled?,
"camo" => {
"markdown" => AppConfig.privacy.camo.proxy_markdown_images?,
"opengraph" => AppConfig.privacy.camo.proxy_opengraph_thumbnails?,
"remotePods" => AppConfig.privacy.camo.proxy_remote_pod_images?
}
} }
) )
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment