logo

queer.hacktivis.me-meta

Unnamed repository; edit this file 'description' to name the repository.
commit: 571273cffc7d621e75515870b9dabe913e1f63db
parent: 6c0df1fc84defdf5768f330cab4eb17a9365395e
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun, 24 Mar 2019 16:02:33 +0100

about.js: Add support for federation_metadata.mrf_keyword

Diffstat:

Mabout.js24++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/about.js b/about.js @@ -6,20 +6,16 @@ request.onload = function() { res = JSON.parse(request.response); federation_metadata = res.metadata.federation; + federation_html = ""; if(federation_metadata.mrf_policies) { - federation_html = "<li>MRF Policies: <code>"; + federation_html += "<li>MRF Policies: <code>"; federation_html += federation_metadata.mrf_policies.join(", "); federation_html += "</code></li>"; } - if(federation_metadata.mrf_simple) { - federation_html += "<li>MRF Simple:<ul>"; - for(const [key, values] of Object.entries(federation_metadata.mrf_simple)) { - federation_html += "<li><code>"+key+"</code>: <code>"+values.join(", ")+"</code></li>" - }; - federation_html += "</ul></li>"; - } + if(federation_metadata.mrf_simple) { render_mrf_settings("MRF Simple", federation_metadata.mrf_simple); } + if(federation_metadata.mrf_keyword) { render_mrf_settings("MRF Keywords", federation_metadata.mrf_keyword); } if(federation_metadata.quarantined_instances) { federation_html += "<li>Quarantined: <code>"; @@ -30,6 +26,18 @@ request.onload = function() federation_list.innerHTML = federation_html; }; +var render_mrf_settings = new function(name, settings) { + html = "<li>"+name+":<ul>"; + + for(const [key, values] of Object.entries(settings)) { + html += "<li><code>"+key+"</code>: <code>"+values.join(", ")+"</code></li>" + } + + html += "</ul></li>"; + + return html; +}; + mrf_noscript.hidden = true; request.open('GET', "https://queer.hacktivis.me/nodeinfo/2.0.json", true);