fix: Properly display ISC license in plain text and correctly parse requested license from URL.

Signed-off-by: Richie Bendall <richiebendall@gmail.com>
This commit is contained in:
Richie Bendall 2019-06-23 12:45:43 +12:00
parent fd54e7198d
commit 8a47aa09f8
No known key found for this signature in database
GPG key ID: 1C6A99DFA9D306FC
5 changed files with 55 additions and 53 deletions

View file

@ -1,27 +1,26 @@
<!DOCTYPE html>
<html id="home" lang="en">
<% include components/header %>
<body>
<article>
<%- gravatar %>
<h1>The ISC License (ISC)</h1>
<p>Copyright © <%- info %></p>
<article>
<%- gravatar %>
<h1>The ISC License (ISC)</h1>
<p>Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.</p>
<p>Copyright © <%- info %></p>
<p>THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</p>
</article>
<% include components/footer %>
<p>Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</p>
</article>
<% include components/footer %>
</body>
</html>

View file

@ -1,3 +1,3 @@
<footer>
<p><a target="_blank" rel="noopener" href="https://github.com/remy/mit-license">Fork this project to create your own MIT license that you can always link to.</a></p>
<p><a target="_blank" rel="noopener" href="https://github.com/remy/mit-license">Fork this project to create your own MIT license that you can always link to.</a></p>
</footer>

View file

@ -1,40 +1,38 @@
<head>
<title>MIT License</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="description"
content="The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology. As a permissive license, it puts only very limited restriction on reuse and has, therefore, an excellent license compatibility.">
<!--
Welcome fellow open source developer. This project is here for you to
link to if you're like me and keep forgetting to include the
MIT-license.txt file.
<title>MIT License</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="description" content="The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology. As a permissive license, it puts only very limited restriction on reuse and has, therefore, an excellent license compatibility.">
<!--
Welcome fellow open source developer. This project is here for you to
link to if you're like me and keep forgetting to include the
MIT-license.txt file.
Fork this project and send a pull request on:
Fork this project and send a pull request on:
https://github.com/remy/mit-license
https://github.com/remy/mit-license
By adding a new JSON file to the users directory, it will yield an
MIT License on a CNAME, for example:
By adding a new JSON file to the users directory, it will yield an
MIT License on a CNAME, for example:
{ "copyright": "Remy Sharp, https://remysharp.com" }
{ "copyright": "Remy Sharp, https://remysharp.com" }
Means visiting https://rem.mit-license.org/ shows "Remy Sharp" as the
copyright holder. Namespaces will be on a first come first serve basis,
and I'm open to folk joining the GitHub project.
Means visiting https://rem.mit-license.org/ shows "Remy Sharp" as the
copyright holder. Namespaces will be on a first come first serve basis,
and I'm open to folk joining the GitHub project.
For more options (including linking and license version targeting)
see the README in the github hosted project.
For more options see the README in the github hosted project.
Hope you find this useful too!
Hope you find this useful too!
- @rem
- @rem
-->
<!-- for HTML5 el styling -->
<script>
document.createElement('article');
document.createElement('footer');
</script>
<link rel="stylesheet" href="/themes/<%= theme %>.css">
-->
<!-- for HTML5 el styling -->
<script>
document.createElement('article');
document.createElement('footer');
</script>
<link rel="stylesheet" href="/themes/<%= theme %>.css">
</head>

View file

@ -5,14 +5,12 @@ module.exports = (req, res, next) => {
res.locals.options = parts.reduce(
(acc, curr) => {
if (!curr) {
return acc;
}
if (!curr) return acc;
let match = curr.match(/^@?(\d{4})$/) || [];
if (match.length) {
// pinned year
// Pinned year
if (curr.startsWith('@')) {
acc.pinnedYear = parseInt(curr.substr(1), 10);
} else {
@ -38,6 +36,13 @@ module.exports = (req, res, next) => {
return acc;
}
if (curr.startsWith('+')) {
acc.license = curr
.substr(1)
.toUpperCase();
return acc;
}
acc.sha = curr; // not actually supported now - 2019-06-19
return acc;
},

View file

@ -58,7 +58,7 @@ module.exports = (req, res) => {
const year = options.pinnedYear
? options.pinnedYear
: [options.startYear, options.endYear].filter(Boolean).join('-');
const license = (user.license || 'MIT').toUpperCase();
const license = (options.license || user.license || 'MIT').toUpperCase();
const format = options.format || user.format || 'html';
const args = {