Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some more informational help regarding licensing #1250

Merged
merged 1 commit into from
Nov 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 71 additions & 1 deletion controllers/blockSPDX.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,75 @@
"CC-BY-NC-ND-3.0",
"CC-BY-NC-ND-4.0",
"CC0-1.0",
"WTFPL"
"WTFPL",

"AFL-1.1",
"AFL-1.2",
"AFL-2.0",
"AFL-2.1",
"AFL-3.0",
"AAL",
"EFL-1.0",
"EFL-2.0",
"Fair",
"HPND",
"LPL-1.0",
"LPL-1.02",
"PostgreSQL",
"NCSA",
"Xnet",

"APSL-1.0",
"APSL-1.1",
"APSL-1.2",
"APSL-2.0",
"CATOSL-1.1",
"CUA-OPL-1.0",
"EUDatagrid",
"Entessa",
"Frameworx-1.0",
"IPL-1.0",
"LPPL-1.3c",
"Motosoto",
"Multics",
"Naumen",
"NGPL",
"Nokia",
"OCLC-2.0",
"PHP-3.0",
"Python-2.0",
"CNRI-Python",
"RPSL-1.0",
"RSCPL",
"Sleepycat",
"SPL-1.0",
"Watcom-1.0",
"VSL-1.0",
"W3C",
"WXwindows",
"ZPL-2.0",

"Apache-1.1",
"Artistic-1.0",
"CPL-1.0",
"EPL-1.0",
"ECL-1.0",
"EFL-1.0",
"LPL-1.0",
"MPL-1.0",
"MPL-1.1",
"OSL-1.0",
"OSL-2.1",
"RPL-1.1",

"Intel",
"CVW",
"SISSL",

"Artistic-1.0-cl8",
"Artistic-1.0-Perl",
"BSD-2-Clause-Patent",
"GPL-2.0 WITH eCos-exception-2.0",
"GPL-2.0 WITH WxWindows-exception-3.1",
"MPL-2.0-no-copyleft-exception"
]
12 changes: 12 additions & 0 deletions controllers/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var async = require('async');
var _ = require('underscore');
var sanitizeHtml = require('sanitize-html');
var SPDX = require('spdx-license-ids');
var SPDXOSI = require('spdx-osi'); // NOTE: Sub-dep of `spdx-is-osi`

//--- Model inclusions
var Discussion = require('../models/discussion').Discussion;
Expand Down Expand Up @@ -43,6 +44,8 @@ var htmlWhitelistLink = require('../libs/htmlWhitelistLink.json');

var removeReasons = require('../views/includes/scriptModals.json').removeReasons;

var blockSPDX = require('./blockSPDX');

//---

// Let controllers know this is a `new` route
Expand Down Expand Up @@ -400,6 +403,15 @@ exports.view = function (aReq, aRes, aNext) {
script.scriptPermalinkMetaPageUrl = 'https://' + aReq.get('host') +
script.scriptMetaPageUrl;

script.scriptAcceptableOSILicense = [];
SPDXOSI.forEach(function (aElement, aIndex, aArray) {
if (blockSPDX.indexOf(aElement) === -1) {
script.scriptAcceptableOSILicense.push({
shortIdSPDX: aElement
});
}
});

// Page metadata
pageMetadata(options, ['About', script.name, (script.isLib ? 'Libraries' : 'Userscripts')],
script.description);
Expand Down
6 changes: 6 additions & 0 deletions public/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -461,3 +461,9 @@ ul.flaggedList {
pointer-events: auto;
z-index: 15;
}

.scrollable-menu {
height: auto;
max-height: 200px;
overflow-x: hidden;
}
Binary file added public/images/license/osi16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/license/spdx16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions views/includes/scriptAuthorToolsPanel.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@
</span>
</div>
</div>
<div class="input-group">
<div class="input-group-btn">
<button class="btn btn-info" id="license-raw" data-clipboard-text="// @license MIT" title="Copy key and raw SPDX to clipboard"><i class="octicon octicon-clippy"></i> // @license</button>
</div>
<input id="spdx-short-id" type="text" class="form-control" aria-label="..." value="MIT" readonly="readonly">
<span class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><img src="/images/license/osi16.png"> <span class="caret"></span> <span class="sr-only">Toggle Dropdown</span> </button>
<ul class="dropdown-menu scrollable-menu dropdown-menu-right" id="osi-spdx">
{{#script.scriptAcceptableOSILicense}}<li><a href="#">{{shortIdSPDX}}</a></li>{{/script.scriptAcceptableOSILicense}}
</ul>
</span>
<span class="input-group-btn">
<a class="btn btn-info"
title="How do I use this?"
href="/user/add/scripts#user-block-license">
<i class="fa fa-exclamation-triangle"></i>
</a>
</span>
</div>
<h4>Installs per Version <small>effective <time title='Tue Sep 2 2014'>Sep '14</time></small></h4>
<p><code>{{script.meta.version}}{{^script.meta.version}}Current{{/script.meta.version}}</code> <span class="label label-default">{{script.installsSinceUpdate}} installs</span></p>
{{/script.isLib}}
Expand Down
1 change: 1 addition & 0 deletions views/includes/scripts/clipboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
var allowedIds = [
'#groupid-raw',
'#groupid-urn',
'#license-raw',
'#require-min',
'#require-raw',
'#scriptid-raw',
Expand Down
50 changes: 50 additions & 0 deletions views/includes/scripts/selectSPDX.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<script type="text/javascript">
(function () {

{{> includes/scripts/polyfillElementClosest.js }}

function onClick(aEv) {
aEv.preventDefault();

var containerNode = aEv.target.closest('li');
var listOSISPDX = document.querySelectorAll('#osi-spdx li');
var inputSPDX = document.querySelector('#spdx-short-id');
var copyLicenseSPDXbutton = document.querySelector('#license-raw');
var i = null;
var thisOSISPDX = null;

if (containerNode && listOSISPDX && inputSPDX && copyLicenseSPDXbutton) {
inputSPDX.value = aEv.target.textContent;
copyLicenseSPDXbutton.setAttribute(
'data-clipboard-text',
'// @license ' + aEv.target.textContent
);

for (i = 0; thisOSISPDX = listOSISPDX[i++];) {
if (thisOSISPDX.classList.contains('active')) {
thisOSISPDX.classList.remove('active');
}
}

containerNode.classList.add('active');
}
}

function onDOMContentLoaded(aEv) {
var listOSISPDX = document.querySelectorAll('#osi-spdx li');
var thisOSISPDX = null;
var i = null;

for (i = 0; thisOSISPDX = listOSISPDX[i++];) {
thisOSISPDX.addEventListener('click', onClick);
if (thisOSISPDX.textContent === 'MIT') {
// NOTE: Site default
thisOSISPDX.classList.add('active');
}
}
}

document.addEventListener('DOMContentLoaded', onDOMContentLoaded);

})();
</script>
2 changes: 1 addition & 1 deletion views/pages/newScriptPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ <h5 class="panel-title">
</h5>
</div>
<div id="collapse-license" class="panel-collapse collapse in">
<div class="panel-body"><p>Specially formatted on the script page. All values shown in reverse order. If absent <a href="https://spdx.org/licenses/MIT.html"><code>MIT</code></a> <a href="https://opensource.org/licenses/MIT">License <em>(Expat)</em></a> is implied. See <a href="/about/Terms-of-Service#licensing">licensing terms</a> for specifics.</p><p><strong><code>License Type</code> component is required</strong> using at least one <a href="https://opensource.org/licenses/category">OSI approved</a> <a href="https://spdx.org/licenses/">SPDX short identifier</a> and must be the primary, last, <code>@license</code> key. Single short ids are accepted only per license key. e.g. No conjunctions like <code>AND</code> or <code>OR</code>. These are handled by multiple <code>@license</code> keys.</p><p><strong><code>; License Homepage</code> component is currently optional</strong></p><p>Single Licensed Example <em>(No specific document license web reference)</em>:<pre class="small"><code>// ==UserScript==</code><br /><code>// ...</code><br /><code>// @license MIT</code><br /><code>// ...</code><br /><code>// ==/UserScript==</code></pre></p><p>Dual Licensed Example <em>(Specific document license web references)</em>:<pre class="small"><code>// ==UserScript==</code><br /><code>// ...</code><br /><code>// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode</code><br /><code>// @license GPL-3.0+; http://www.gnu.org/licenses/gpl-3.0.txt</code><br /><code>// ...</code><br /><code>// ==/UserScript==</code></pre></p></div>
<div class="panel-body"><p>Specially formatted on the script page. All values shown in reverse order. If absent <a href="https://spdx.org/licenses/MIT.html"><code>MIT</code></a> <a href="https://opensource.org/licenses/MIT">License <em>(Expat)</em></a> is implied. See <a href="/about/Terms-of-Service#licensing">licensing terms</a> for specifics.</p><p><strong><code>License Type</code> component is required</strong> using at least one <a href="https://opensource.org/licenses/category">OSI approved</a> <a href="https://spdx.org/licenses/">SPDX short identifier</a> and must be the primary, last, <code>@license</code> key. Single short ids are accepted only per license key. e.g. No conjunctions like <code>AND</code> or <code>OR</code>. These are handled by multiple <code>@license</code> keys.</p><p><strong><code>; License Homepage</code> component is currently optional</strong></p><p>Single Licensed Example <em>(No specific document license web reference)</em>:<pre class="small"><code>// ==UserScript==</code><br /><code>// ...</code><br /><code>// @license MIT</code><br /><code>// ...</code><br /><code>// ==/UserScript==</code></pre></p><p>Dual Licensed Example <em>(Specific document license web references)</em>:<pre class="small"><code>// ==UserScript==</code><br /><code>// ...</code><br /><code>// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode</code><br /><code>// @license GPL-3.0+; http://www.gnu.org/licenses/gpl-3.0.txt</code><br /><code>// ...</code><br /><code>// ==/UserScript==</code></pre></p><p>When in doubt it may be a wise choice to go with the site default of <code>MIT</code> or some other popular license such as <code>GPL-3.0</code>. If you don't understand a less popular license then please don't use it when authoring or consult your legal counsel. Licensing is both protective and permissive for both parties. Figure out what balance you need and make your decision.</p></div>
</div>
</div>
<div class="panel panel-default">
Expand Down
3 changes: 3 additions & 0 deletions views/pages/scriptPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,8 @@ <h4>Userscripts Using This Library</h4>
{{> includes/footer.html }}
{{> includes/scripts/lazyIconScript.html }}
{{> includes/scripts/clipboard.html }}
{{#authorTools}}
{{ > includes/scripts/selectSPDX.html}}
{{/authorTools}}
</body>
</html>