Loomio

Make Diaspora work with LibreJS

PH
Paul Hill Public Seen by 324

With LibreJS installed visiting diaspora does not present the user with much, the stream is missing and all the items on the black bar are missing, it can be fixed by following this guide (I think) http://www.gnu.org/software/librejs/free-your-javascript.html
http://www.gnu.org/software/librejs/

PH

Paul Hill started a proposal Mon 21 Apr 2014

Should Diaspora be compatible with LibreJS plugin? Closed Wed 28 May 2014

Currently when a user has LibreJS install much of the page on diaspora does not load, this can be fixed by following this guide: http://www.gnu.org/software/librejs/free-your-javascript.html

Agree - 18
Abstain - 18
Disagree - 18
Block - 18
20 people have voted (13%)
PH

Paul Hill
Agree
Mon 21 Apr 2014

SP

Sebas Pedersen
Agree
Mon 21 Apr 2014

JL

Jelle Langbroek
Abstain
Mon 21 Apr 2014

FL

Frode Lindeijer
Agree
Mon 21 Apr 2014

JR

Jason Robinson
Agree
Tue 22 Apr 2014

A

Adrenalin
Agree
Tue 22 Apr 2014

F

Flaburgan
Agree
Tue 22 Apr 2014

Let's show to everyone that our code is free as in freedom :)

T

theradialactive
Agree
Tue 22 Apr 2014

RF

Rasmus Fuhse
Agree
Wed 23 Apr 2014

CG

Christian Giménez
Agree
Thu 24 Apr 2014

DB

Dee Baumdeesaster
Abstain
Thu 24 Apr 2014

DU

[deactivated account]
Agree
Sat 3 May 2014

K

Kazhnuz
Agree
Sat 3 May 2014

I think being compatible with libreJS is somewhat important for a fully free social network, because it's indicating that our javascript is not a "javascript trap" nor nonfree javascript, but free code as in freedom :D

SM

Seth Martin
Agree
Sat 24 May 2014

C

CodeHero
Agree
Tue 27 May 2014

R

Ravenbird
Agree
Tue 27 May 2014

L

lebarjack
Agree
Tue 27 May 2014

V

Vostok
Agree
Tue 27 May 2014

DT

David Thompson
Agree
Tue 27 May 2014

RR

Rafael Raposo
Agree
Tue 27 May 2014

JL

Jelle Langbroek Mon 21 Apr 2014

Shouldn't this be discussed first? I have no idea what the pros and cons are, but the must be some.

PH

Paul Hill Mon 21 Apr 2014

Changed the close date by another month. Pros: causes issues for librejs users to go away, no reason the issue should be there AFAIK as all code is open. Cons: is it worth the effort? Are the number of users with the plugin negligible?

JR

Jason Robinson Tue 22 Apr 2014

Not sure if this really needs to be voted on - if someone does the implementation then I'm sure no one would object?

In fact, there is a pull here but it hasn't been finished yet :)

JH

Jonne Haß Tue 22 Apr 2014

Yep, no need to vote. Find a sane implementation that integrates well into rails asset pipeline and no one will object.

JR

Jason Robinson Thu 29 May 2014

Anyone: feel free to continue here: https://github.com/diaspora/diaspora/pull/4838

N

Nicolas Sat 13 Jun 2015

Any news on this?

JR

Jason Robinson Sun 14 Jun 2015

@nicolas8 seems support for LibreJS headers was merged in. No idea how it works myself, but if some parts of the JS are not LibreJS compliant, feel free to identify those and try to come up with a solution.

N

Nicolas Sun 14 Jun 2015

Thanks for the reply Jason! I'd love to help with code, but I'm not technically skilled in programming :(

Anyways, LibreJS still blocks content on Diaspora:

List of blocked JavaScript in https://diasporabr.com.br/stream

This script is detected as inline, nonfree, defining functions or 

methods, and the rest of the page as loading external scripts
if(Array.isArray === undefined) {
Array.isArray = function (arg) {
return Object.prototype.toString.call(arg) == '[object
Array]';
};
}
if ((window.history) && (window.history.pushState
=== undefined)) {
window.history.pushState = function() { };
}

NONTRIVIAL: creates script element dynamically.

//<![CDATA[
!window.jQuery && document.write(unescape('<script 

src="\/assets\/jquery-1db761a07a0a6fe3f80e026f788fef36.js"><\/script>'));

//]]>

This script is detected as inline, nonfree, defining functions or 

methods, and the rest of the page as loading external scripts

//<![CDATA[
jQuery.ajaxSetup({'cache': false});
//]]>

This script is detected as inline, nonfree, defining functions or 

methods, and the rest of the page as loading external scripts
Diaspora.I18n.load({"confirm_dialog":"Tem
certeza?","confirm_unload":"Por favor, confirme se deseja sair desta
página. Os dados que você informou não serão
salvos.","delete":"Apagar","ignore":"Ignorar","report":{"prompt":"Por
favor entre um motivo:","prompt_default":"conteúdo
ofensivo","name":"Relatar","status":{"created":"O relato foi criado com
sucesso","exists":"O relato já existe"}},"ignore_user":"Ignorar este
usuário?","ignore_failed":"Não foi possível ignorar este
usuário","hide_post":"esconder esta
publicação?","hide_post_failed":"Incapaz de esconder esta
publicação","remove_post":"Remover esta publicação?","unblock_failed":"O
desbloqueio deste usuário
falhou","and":"e","comma":",","edit":"Editar","no_results":"Nenhum
Resultado
Encontrado","timeago":{"prefixAgo":"","prefixFromNow":"","suffixAgo":"atrás","suffixFromNow":"a

partir de agora","seconds":"menos de um minuto","minute":"cerca de um
minuto","minutes":"%d minutos","hour":"cerca de uma hora","hours":"cerca
de %d ho…

This script is detected as inline, nonfree, defining functions or 

methods, and the rest of the page as loading external scripts

//<![CDATA[

window.gon={};gon.user={"id":22077,"guid":"54d640007fd5013287d0005056ba3b3d","name":"xxxredactedxxx","diaspora_id":"xxxredactedxxx","avatar":{"small":"https://diasporabr.com.br/uploads/images/xxxxredactedzzzz","medium":"https://diasporabr.com.br/uploads/images/thumb_medium_49186285e7800e40b8b8.jpg","large":"https://diasporabr.com.br/uploads/images/thumb_large_49186285e7800e40b8b8.jpg"},"notifications_count":10,"unread_messages_count":0,"admin":false,"aspects":[{"id":23225,"name":"Amigos","selected":true},{"id":23232,"name":"Serviços","selected":true},{"id":24395,"name":"Não

conhecidos","selected":true},{"id":23224,"name":"Família","selected":true},{"id":23226,"name":"Trabalho","selected":true},{"id":23227,"name":"Conhecidos","selected":true}],"services":[],"following_count":127,"configured_services":[]};gon.preloads={};

//]]>

NONTRIVIAL: an open method similar to xhr.open is used

    var _paq = _paq || [];





    _paq.push(["trackPageView"]);
    _paq.push(["enableLinkTracking"]);

    (function() {
        var u=(("https:" == document.location.protocol) ? "https" : 

"http") + "://pod1.diasporabr.com.br/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "2"]);
var d=document, g=d.createElement("script"),
s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js";
s.parentNode.insertBefore(g,s);
})();

This script is detected as inline, nonfree, defining functions or 

methods, and the rest of the page as loading external scripts
[{"attribute":"onclick","value":"$.facebox.close();"}]

    NONTRIVIAL: square bracket suffix method call detected

[{"attribute":"href","value":"(function(){f='https://diasporabr.com.br/bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&notes='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=1&';a=function(){if(!window.open(f+'noui=1&jump=doclose','diasporav1','location=yes,links=no,scrollbars=yes,toolbar=no,width=620,height=400'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"}]

NONTRIVIAL: eval has been found in code

https://diasporabr.com.br/assets/jquery_ujs-5be99745d2e19d4e06fd99998b1cb99b.js

error parsing: 7c99c132628414dd0a847377e8ce1940b3735744

https://diasporabr.com.br/assets/main-095e253fdb3755aa4844c4bb42e82ba0.js

NONTRIVIAL: an open method similar to xhr.open is used

https://diasporabr.com.br/assets/jsxc-e660beffa5fa259ea8f528e10ad756d7.js

This script is detected as nonfree, external, and as defining 

functions or methods

https://diasporabr.com.br/assets/templates-994dd5d1b8d11efc0df6804f529633ee.js

JR

Jason Robinson Sun 14 Jun 2015

You could raise specific issues on Github regarding individual JS parts.

Maybe something like "Fix JS to comply with LibreJS" and list individual items as tasks in that issue, using the github tasks syntax.

I realize you opened an issue already but general issues like "fix all the things" don't help developers to track what needs closing. An issue needs to have a clear goal, so a clear list of JS that needs to be refactored would help developers attack those parts of the code. By coordinating this work via an issue you can help without coding :)

N

Nicolas Sun 14 Jun 2015

Thanks! Will do :)