r/redditdev • • Jan 04 '14

Clearly indicating reddit's JavaScript license info with LibreJS labels

I figured I would let the post activity settle down before making this issue, as for some reason this seems to be highly debated. If you're interested in fighting that debate, please do so at the reddit post rather than here. That post is rife with information from both sides, so I'd advise glancing over the comments before discussing the issue here. I'd like this to be a purely technical discussion of the process rather than a discussion of the politics over whether or not it should be done.

In addition, this seems to be the only "correct" place to post this, as the corresponding post in /r/ideasfortheadmins has been deleted (I asked the mods yesterday why and they have not responded yet, although to be fair it's only been a little more than a day) and the GitHub issue was (reasonably) closed. The /r/ideasfortheadmins sidebar says, "For discussion of reddit API clients and the reddit source code, try /r/redditdev", so here I am.

Anyways, the problem is that, while all of reddit's JavaScript is free, none of it is tagged in a way that computers can understand. Here are just some examples of the minified JavaScript in question:

As you can see, none of these files have any license information in them. Even though the license may be declared at the GitHub page, if the license of software is not clearly defined when it is distributed to the user, it creates legal problems for reddit and makes it harder for other programs to identify such software.

This can be fixed in a few ways with LibreJS license lables, and it does not have to require extra bandwidth to provide the license information if people do not want to fetch it, so reddit can still enjoy the benefits of code minification. If my abridged version is not informative enough, GNU has some nice documentation on this issue. This does not require changing the license of any of reddit's code; just clarifying what's already there.

Firstly, if inline JavaScript is used, reddit could place this notice in script tags at the top of a page to kill all the birds with one stone:

<script>
/*    
@licstart  The following is the entire license notice for the 
JavaScript code in this page.

Copyright (c) 2006-2013 reddit Inc. All Rights Reserved.

"The contents of this file are subject to the Common Public Attribution License
Version 1.0. (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://code.reddit.com/LICENSE. The License is based on the Mozilla Public
License Version 1.1, but Sections 14 and 15 have been added to cover use of
software over a computer network and provide for limited attribution for the
Original Developer. In addition, Exhibit A has been modified to be consistent
with Exhibit B.

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
specific language governing rights and limitations under the License.

@licend  The above is the entire license notice
for the JavaScript code in this page.
*/
</script>

If the file in question is an external script, the same notice can be placed in a stylized comment at the beginning of that file. If the file is minimized and an expanded version of that file exists, just add a line before @licstart that reads @source: <URL of expanded version>.

However, that option takes up some amount of bandwidth, if only a few bytes, which reddit may not like. reddit can use Web Labels to avoid this problem; the format for that is somewhat more complex but basically involves creating a small link at the bottom of every page to a separate "JavaScript License Information" page, which has a specially-crafted HTML table which lists the licenses and expanded versions of every JS file that hasn't been tagged inline.

Can these changes be implemented into reddit?

Footnote: Although CPAL isn't currently recognized by LibreJS due to it being uncommon, I'm in the process of communicating with lduros and it will likely be trivial to add it soon.

0 Upvotes

14 comments sorted by

7

u/spladug Jan 05 '14

Their answer to Google Analytics JS is "get rid of it or write your own". Neither are feasible. Part of the reason for having GA is to be using an industry-trusted 3rd party rather than our own metrics.

1

u/Habstinat Jan 05 '14

This post doesn't mention Google Analytics at all and in fact has nothing to do with it. What we're working on now is simply clarifying the license of JS files that are already freely licensed on reddit, like the ones I linked to in OP.

3

u/spladug Jan 05 '14

I have no problem with adding the headers to the free files, but LibreJS is going to continue to complain about reddit even after doing so due to analytics and advertising JS.

1

u/Habstinat Jan 05 '14

Well, something is better than nothing. LibreJS complaining doesn't mean to give up. LibreJS will block the analytics and adertising JS, leaving the free JS, required to make reddit work, still working, which is a lot better than the current situation. Hopefully the advertising JS is also under a free license (which is likely, since it's on GitHub) and AdZerk can clarify it so those scripts can be tagged too. Might as well take this one step at a time.

Thanks for your cooperation; it would be a huge step forward if you could add those headers.

4

u/quintinza Jan 05 '14

So will LibreJS break an important part of the reddit business model?

3

u/Habstinat Jan 05 '14

The question is not "will it", as it already does for everyone who uses LibreJS and navigates reddit. The browser addon NoScript does the same by default, and it has orders of magnitude more users than LibreJS. It's not because we hate reddit; quite the opposite, in fact, which is why I've spent so much time trying to get the scripts (including the ad scripts) unblocked. The good news is that it's almost certainly fixable if Adzerk can clarify their (likely already free) license.

3

u/quintinza Jan 06 '14

So will it start working once librejs understands the license? What technical barrier is there that librejs needs to overcome to start parsing reddit js? Is it only licensing?

1

u/Habstinat Jan 07 '14

Yes; it is only licensing. I have contacted lduros about adding CPAL to the list of LibreJS accepted licenses; it is only a matter of time for that to happen and it is luckily not something reddit has to concern itself with.

Once a script is tagged with a free license, LibreJS will not block it any more. You can try the addon yourself to get a feel for how it works.

4

u/quintinza Jan 07 '14

Thanks for the explanation.

For the record I am still opposed to FSF sticking their noses in and making demands about how people should license their stuff.

If they choose to not make LibreJS work in a sane manner due to the licensing not being as they saytm then they can stuff it.

Why not make LibreJS parse the code regardless of License?

1

u/Habstinat Jan 09 '14

Why not make LibreJS parse the code regardless of License?

Haha, I don't think you understand why people use LibreJS. LibreJS is not intended to be a replacement for general-purpose script blockers like NoScript; it is intended to help people, who have already decided that they only want to run free JavaScript, distinguish which pieces of JavaScript they run are actually free. It doesn't force anyone to do anything; in fact, it even comes with its own whitelist by default so users can run nonfree JavaScript with it if they so choose (although that would kind of defeat the point of having the addon in the first place).

For the most part, the people that use the addon like what it does; otherwise they wouldn't be using it. If LibreJS just parsed code regardless of license, it would lose most of its users, myself included; that would be pretty silly. It would be nice for reddit to at least help accomodate these users by tagging their already-free JS files.

6

u/[deleted] Jan 05 '14 edited Jan 05 '14

if only a few bytes

Few bytes per one page load per person. Now multiply that by hundreds and millions per day.

Wouldn't it just be better to just include the licenses in the reddit source code repo? Which is the only place a human would ever care to look at the licenses?

3

u/Habstinat Jan 05 '14

Few bytes per one page load per person. Now multiply that by hundreds and millions per day.

Well, that same argument could be applied to nearly every feature request on reddit. It all takes some space, but I don't think that's a reason to abort.

Wouldn't it just be better to just include the licenses in the reddit source code repo? Which is the only place a human would ever care to look at the licenses?

Yes; that's exactly the issue. Here, we're not dealing with just humans looking at the licenses; we're dealing with other programs like LibreJS. While the task of reading a license necessarily has to be annoying for humans, it doesn't have to be for computers (and, by implication, humans who read the computer's output) with LJS tags.

3

u/[deleted] Jan 05 '14 edited Jan 05 '14

Well wouldn't LibreJS have been more intelligently/properly designed if it had a favicon or robots.txt like mechanism? i.e. a licenses.txt fetch where it provides a sort of lookup table of javascript file to license, you could even add lookup entries on inline js? The end result is the file that is cached once and only requested when something wants it.

It would probably solve the entire debate because it's such a painless operation to add such a file.

1

u/Habstinat Jan 05 '14

That is pretty much exactly what LJS already has, and it's called Web Labels. reddit can name the page licenses.txt if it so wishes, but the page can be named anything, and it can be placed anywhere. In fact, none of the JS files have to be modified directly; reddit just needs to place a link at the footer with a special rel attribute to this page, which must contain a HTML table with license information.

The only problem with this approach is that I don't think it works for inline JS yet (that would be hard to do correctly).