diff --git a/README.md b/README.md index 18d4e7ba..d1fd7d48 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,12 @@ I always forget to add an MIT-license.txt file to my projects, so I wanted to link to a single resource that would always be up to date and would always have my details online. -Why keep this to myself, there's two ways to create your *own* MIT license page: +Why keep this to myself, there's two ways to create your _own_ MIT license page: -1. Make a request to the API (details below) -2. Fork this project and send a pull request +1. Make a request to the API (details below) +2. Fork this project and send a pull request -Now I can always include http://rem.mit-license.org in all my projects which links `rem` (the cname) against my copyright holder name `Remy Sharp` - all stored in the `users` directory. +Now I can always include in all my projects which links `rem` (the cname) against my copyright holder name `Remy Sharp` - all stored in the `users` directory. ## Requesting your own MIT license page @@ -19,7 +19,7 @@ curl -d'{ "copyright": "Remy Sharp" }' https://rem.mit-license.org If the `rem` user isn't taken already, then this will create the new user file on the fly and the url will be immediately available. -You can send a full JSON file to the API, not *just* the copyright, so this works too: +You can send a full JSON file to the API, not _just_ the copyright, so this works too: ```bash curl -d'{ "copyright": "Remy Sharp", "url": "http://remysharp.com", "email": "me@mysite.com", "format": "txt" }' https://rem.mit-license.org @@ -35,13 +35,13 @@ The `users` directory contains a list of files, each representing a host on mit- Available fields: -* copyright (required) -* url -* email -* format -* gravatar -* version -* theme +- copyright (required) +- url +- email +- format +- gravatar +- version +- theme ### copyright @@ -53,7 +53,21 @@ Create a new file and give it the name of the CNAME you want (in my case it's `r } ``` -Means I can now link to: http://rem.mit-license.org and it will show my license name (note that the date will always show the current year). +Means I can now link to: and it will show my license name (note that the date will always show the current year). + +You can also use an array to hold multiple copyright holders: + +```json +{ + "copyright": ["Remy Sharp (http://remysharp.com)", "Richie Bendall (https://richienb.github.io)"] +} +``` + +Which will be formatted as: + +``` +Remy Sharp (http://remysharp.com) and Richie Bendall (https://richienb.github.io) +``` ### url @@ -113,7 +127,7 @@ Though I don't expect the license text to change ever, this is just some extra a Targeting requires the [sha from the license commit](https://github.com/remy/mit-license/commits/master/LICENSE.html). This can be specified on the URL (in your permalink) or in the JSON file. -For example: http://rem.mit-license.org/a526bf7ad1 (make sure to view-source) shows an older version of the LICENSE.html file (compared to the [latest version](http://rem.mit-license.org) - the older version didn't have the new themes). +For example: (make sure to view-source) shows an older version of the LICENSE.html file (compared to the [latest version](http://rem.mit-license.org) - the older version didn't have the new themes). This can also be targeted in my JSON file: @@ -143,69 +157,69 @@ To use a theme, add the `theme` property to your `user.json` file, for example: Current available themes: -* default - [preview](http://mit-license.org) (by - [@remy](https://github.com/remy), - [@raphaelbastide](https://github.com/raphaelbastide) & - [@evertton](https://github.com/evertton)) -* flesch - [preview](http://jsbin.com/ufefid/3) (by - [@flesch](https://github.com/flesch)) -* eula-modern - [preview](http://jsbin.com/ExiVida/1/) (by [@sauerlo](https://github.com/lsauer)) -* afterdark - [preview](http://jsbin.com/ivufon/4) (by [@rmartindotco](https://github.com/rmartindotco)) -* orange - [preview](http://jsbin.com/uzubos/2) (by [@kirbylover4000](https://github.com/kirbylover4000)) -* plaintext - [preview](http://jsbin.com/uzubos/4) (by [@barberboy](https://github.com/barberboy)) -* double-windsor - [preview](http://jsbin.com/uzubos/5/) (by [@desandro](https://github.com)) -* cherry - [preview](http://jsbin.com/ufefid/5/) (by [@mustafa-x](https://github.com/mustafa-x)) -* white cherry - [preview](http://jsbin.com/uzezas/2/) (by [@mustafa-x](https://github.com/mustafa-x)) -* blackwood - [preview](http://jsbin.com/uzezas/) (by [@mustafa-x](https://github.com/mustafa-x)) -* hipster-gray - [preview](http://jsbin.com/ivufon/10) (by [@noformnocontent](https://github.com/noformnocontent)) -* xtansia - [preview](http://jsbin.com/ereren/1/) (by [@tomass1996](https://github.com/tomass1996)) -* magic-mint - [preview](http://jsbin.com/obibot/1/) (by [@ekhager](https://github.com/ekhager)) -* default-dark - [preview](http://jsbin.com/uhagaw/10) (by - [@remy](https://github.com/remy), - [@raphaelbastide](https://github.com/raphaelbastide) & - [@evertton](https://github.com/evertton)) -* black-beauty - [preview](http://jsbin.com/dovivu) (by [@evertton](https://github.com/evertton)) -* silver-style - [preview](http://jsbin.com/erezijI/2) (by [@dev-dipesh](https://github.com/Dev-Dipesh)) -* friendly - [preview](http://jsbin.com/hilula) (by [@evertton](https://github.com/evertton)) -* opensans - [preview](http://jsbin.com/UfepUvah) (by [@pburtchaell](https://github.com/pburtchaell)) -* solarized - [preview](http://jsbin.com/yimax/1) (by [@anmoljagetia](https://github.com/anmoljagetia)) -* willpower - [preview](http://jsbin.com/piheyicoyi/1) (by [@willpowerart](https://github.com/willpowerart)) -* rokkitt - [preview](http://jsbin.com/zudayiqeco/1) (by [@luizpicolo](https://github.com/luizpicolo)) -* mitserrat - [preview](http://jsbin.com/xeqekutuwe/1) (by [@WouterJanson](https://github.com/WouterJanson)) -* material - [preview](http://ahaasler.github.io/mit-license-material-theme/) (by [@ahaasler](https://github.com/ahaasler)). *Available colours: blue gray (default), red, pink, purple, deep purple, indigo, blue, light blue, cyan, teal, green, light green, lime, yellow, amber, orange, deep orange, brown and grey. To use a specific colour, add it as a dash-separated suffix on the theme name, such as `material-deep-orange`.* -* hmt-blue - [preview](https://jsbin.com/naqorar/) (by [@J2TeaM](https://github.com/J2TeaM)) -* dusk - [preview](https://output.jsbin.com/giqivoh) (by [@georapbox](https://github.com/georapbox)) -* 8bits - [preview](https://matricali.github.io/mit-license-8bits-theme/) (by [@matricali](https://github.com/matricali)). *Available colours: monochrome, monochrome-white, monochrome-blue-white, monochrome-green, monochrome-amber. To use a specific colour, add it as a dash-separated suffix on the theme name, such as `8bits-monochrome`.* -* hacker - [preview](https://tommy.mit-license.org/) (by [@TommyPujol06](https://github.com/TommyPujol06)) +- default - [preview](http://mit-license.org) (by + [@remy](https://github.com/remy), + [@raphaelbastide](https://github.com/raphaelbastide) & + [@evertton](https://github.com/evertton)) +- flesch - [preview](http://jsbin.com/ufefid/3) (by + [@flesch](https://github.com/flesch)) +- eula-modern - [preview](http://jsbin.com/ExiVida/1/) (by [@sauerlo](https://github.com/lsauer)) +- afterdark - [preview](http://jsbin.com/ivufon/4) (by [@rmartindotco](https://github.com/rmartindotco)) +- orange - [preview](http://jsbin.com/uzubos/2) (by [@kirbylover4000](https://github.com/kirbylover4000)) +- plaintext - [preview](http://jsbin.com/uzubos/4) (by [@barberboy](https://github.com/barberboy)) +- double-windsor - [preview](http://jsbin.com/uzubos/5/) (by [@desandro](https://github.com)) +- cherry - [preview](http://jsbin.com/ufefid/5/) (by [@mustafa-x](https://github.com/mustafa-x)) +- white cherry - [preview](http://jsbin.com/uzezas/2/) (by [@mustafa-x](https://github.com/mustafa-x)) +- blackwood - [preview](http://jsbin.com/uzezas/) (by [@mustafa-x](https://github.com/mustafa-x)) +- hipster-gray - [preview](http://jsbin.com/ivufon/10) (by [@noformnocontent](https://github.com/noformnocontent)) +- xtansia - [preview](http://jsbin.com/ereren/1/) (by [@tomass1996](https://github.com/tomass1996)) +- magic-mint - [preview](http://jsbin.com/obibot/1/) (by [@ekhager](https://github.com/ekhager)) +- default-dark - [preview](http://jsbin.com/uhagaw/10) (by + [@remy](https://github.com/remy), + [@raphaelbastide](https://github.com/raphaelbastide) & + [@evertton](https://github.com/evertton)) +- black-beauty - [preview](http://jsbin.com/dovivu) (by [@evertton](https://github.com/evertton)) +- silver-style - [preview](http://jsbin.com/erezijI/2) (by [@dev-dipesh](https://github.com/Dev-Dipesh)) +- friendly - [preview](http://jsbin.com/hilula) (by [@evertton](https://github.com/evertton)) +- opensans - [preview](http://jsbin.com/UfepUvah) (by [@pburtchaell](https://github.com/pburtchaell)) +- solarized - [preview](http://jsbin.com/yimax/1) (by [@anmoljagetia](https://github.com/anmoljagetia)) +- willpower - [preview](http://jsbin.com/piheyicoyi/1) (by [@willpowerart](https://github.com/willpowerart)) +- rokkitt - [preview](http://jsbin.com/zudayiqeco/1) (by [@luizpicolo](https://github.com/luizpicolo)) +- mitserrat - [preview](http://jsbin.com/xeqekutuwe/1) (by [@WouterJanson](https://github.com/WouterJanson)) +- material - [preview](http://ahaasler.github.io/mit-license-material-theme/) (by [@ahaasler](https://github.com/ahaasler)). _Available colours: blue gray (default), red, pink, purple, deep purple, indigo, blue, light blue, cyan, teal, green, light green, lime, yellow, amber, orange, deep orange, brown and grey. To use a specific colour, add it as a dash-separated suffix on the theme name, such as `material-deep-orange`._ +- hmt-blue - [preview](https://jsbin.com/naqorar/) (by [@J2TeaM](https://github.com/J2TeaM)) +- dusk - [preview](https://output.jsbin.com/giqivoh) (by [@georapbox](https://github.com/georapbox)) +- 8bits - [preview](https://matricali.github.io/mit-license-8bits-theme/) (by [@matricali](https://github.com/matricali)). _Available colours: monochrome, monochrome-white, monochrome-blue-white, monochrome-green, monochrome-amber. To use a specific colour, add it as a dash-separated suffix on the theme name, such as `8bits-monochrome`._ +- hacker - [preview](https://tommy.mit-license.org/) (by [@TommyPujol06](https://github.com/TommyPujol06)) ## Formats & URLs The following types of requests can be made to this project: -* [http://rem.mit-license.org/](http://rem.mit-license.org/) HTML, or the default format specified in -the json file (currently none specified on `rem`) -* [http://rem.mit-license.org/license.html](http://rem.mit-license.org/license.html) HTML -* [http://rem.mit-license.org/license.txt](http://rem.mit-license.org/license.txt) Text -* [http://rem.mit-license.org/a526bf7ad1](http://rem.mit-license.org/a526bf7ad1) a526bf7ad1 version, HTML, or the -default format specified in the json file (again, none specified for -`rem` so defaults to HTML) -* [http://rem.mit-license.org/a526bf7ad1/license.html](http://rem.mit-license.org/a526bf7ad1/license.html) a526bf7ad1 version, -HTML -* [http://rem.mit-license.org/a526bf7ad1/license.txt](http://rem.mit-license.org/a526bf7ad1/license.txt) a526bf7ad1 version, -text +- HTML, or the default format specified in + the json file (currently none specified on `rem`) +- HTML +- Text +- a526bf7ad1 version, HTML, or the + default format specified in the json file (again, none specified for + `rem` so defaults to HTML) +- a526bf7ad1 version, + HTML +- a526bf7ad1 version, + text The url also supports including a start year: -* [http://rem.mit-license.org/2009/](http://rem.mit-license.org/2009/) will - show a license year range of 2009-2016 (2016 being the current year) -* [http://rem.mit-license.org/2009-2010](http://rem.mit-license.org/2009-2010/) - allows me to force the year range -* [http://rem.mit-license.org/a526bf7ad1/2009-2010/license.txt](http://rem.mit-license.org/a526bf7ad1/2009-2010/license.txt) a526bf7ad1 version, with year range of 2009-2010 in plain text +- will + show a license year range of 2009-2016 (2016 being the current year) +- [http://rem.mit-license.org/2009-2010](http://rem.mit-license.org/2009-2010/) + allows me to force the year range +- a526bf7ad1 version, with year range of 2009-2010 in plain text Finally, the url also supports pinning the year -* [http://rem.mit-license.org/@2009](http://rem.mit-license.org/@2009) - this is useful for when your software copyright should expire ([as discussed here](https://github.com/remy/mit-license/issues/771)) +- + this is useful for when your software copyright should expire ([as discussed here](https://github.com/remy/mit-license/issues/771)) ## Ways to contribute @@ -213,11 +227,11 @@ Aside from code contributions that make the project better, there are a few othe Development contributions from: -* [remy](https://github.com/remy) -* [batuhanicoz](https://github.com/batuhanicoz) -* [georgebashi](https://github.com/georgebashi) -* [mathiasbynens](https://github.com/mathiasbynens) -* [evertton](https://github.com/evertton) +- [remy](https://github.com/remy) +- [batuhanicoz](https://github.com/batuhanicoz) +- [georgebashi](https://github.com/georgebashi) +- [mathiasbynens](https://github.com/mathiasbynens) +- [evertton](https://github.com/evertton) **SSL and wildcard DNS is supported by [CloudFlare](https://www.cloudflare.com) - thank you 🙏💙** @@ -229,19 +243,19 @@ Of course I'll do my best to continue running the domain and hosting, but this i Domain contributions: -* [remy](https://github.com/remy) - 2011-2012 -* [barberboy](https://github.com/barberboy) - 2012-2013 -* [paulirish](https://github.com/paulirish) - 2013-2014 -* [batuhanicoz](https://github.com/batuhanicoz) - 2014-2015 -* [buritica](https://github.com/buritica) - 2015-2016 -* [adamstrawson](https://github.com/adamstrawson) - 2016-2018 (2 years) -* [keithamus](https://github.com/keithamus) - 2018-2026 (8 years) -* [pmuellr](https://github.com/pmuellr) - 2026-2027 -* [danielknell](https://github.com/danielknell) - 2027-2029 (2 years) -* [barberboy](https://github.com/barberboy) - 2029-2030 -* [mostly-magic](https://github.com/mostly-magic) - 2030-2032 +- [remy](https://github.com/remy) - 2011-2012 +- [barberboy](https://github.com/barberboy) - 2012-2013 +- [paulirish](https://github.com/paulirish) - 2013-2014 +- [batuhanicoz](https://github.com/batuhanicoz) - 2014-2015 +- [buritica](https://github.com/buritica) - 2015-2016 +- [adamstrawson](https://github.com/adamstrawson) - 2016-2018 (2 years) +- [keithamus](https://github.com/keithamus) - 2018-2026 (8 years) +- [pmuellr](https://github.com/pmuellr) - 2026-2027 +- [danielknell](https://github.com/danielknell) - 2027-2029 (2 years) +- [barberboy](https://github.com/barberboy) - 2029-2030 +- [mostly-magic](https://github.com/mostly-magic) - 2030-2032 -*Please note that the whois says 2021 as you can only have 10 active registered years with ICANN - but the domain is set to auto-renew, so it's all good :)* +_Please note that the whois says 2021 as you can only have 10 active registered years with ICANN - but the domain is set to auto-renew, so it's all good :)_ ### 2. Hosting @@ -249,32 +263,32 @@ For the first 5 years mit-license.org was hosted on my own dedicated server, but Hosting contributions: -* [remy](https://github.com/remy) - 2011-2016 Apr... -* [therebelrobot](https://github.com/therebelrobot) 1 month -* [mkody](https://github.com/mkody) 2 months -* [dan9186](https://github.com/dan9186) 1 year -* Kristin Anthony 1 year -* [zhengyi-yang](https://github.com/zhengyi-yang) 5 months -* [catodd](https://github.com/catodd) 2 months -* [lrz0](https://github.com/lrz0) 1 month -* [matricali](https://github.com/matricali) 3 months -* [youchenlee](https://github.com/youchenlee) 12 months -* [ramsey](https://github.com/ramsey) 12 months -* [rmm5t](https://github.com/rmm5t) 1 month -* [wrainaud](https://github.com/wrainaud) 3 months -* [romkey](https://github.com/romkey) 12 months -* [kylewelsby](https://github.com/kylewelsby) 6 months -* [wiesner](https://github.com/wiesner) 1 month -* [rajinwonderland](https://github.com/rajinwonderland) 3 months -* [miszo](https://github.com/miszo) 1 month -* [you?](https://www.paypal.me/rem) +- [remy](https://github.com/remy) - 2011-2016 Apr... +- [therebelrobot](https://github.com/therebelrobot) 1 month +- [mkody](https://github.com/mkody) 2 months +- [dan9186](https://github.com/dan9186) 1 year +- Kristin Anthony 1 year +- [zhengyi-yang](https://github.com/zhengyi-yang) 5 months +- [catodd](https://github.com/catodd) 2 months +- [lrz0](https://github.com/lrz0) 1 month +- [matricali](https://github.com/matricali) 3 months +- [youchenlee](https://github.com/youchenlee) 12 months +- [ramsey](https://github.com/ramsey) 12 months +- [rmm5t](https://github.com/rmm5t) 1 month +- [wrainaud](https://github.com/wrainaud) 3 months +- [romkey](https://github.com/romkey) 12 months +- [kylewelsby](https://github.com/kylewelsby) 6 months +- [wiesner](https://github.com/wiesner) 1 month +- [rajinwonderland](https://github.com/rajinwonderland) 3 months +- [miszo](https://github.com/miszo) 1 month +- [you?](https://www.paypal.me/rem) ### 3. A lick of paint -I'm a developer, I seem only capable of *grey*! If you're a designer and want to contribute a decent lick of paint on the project that would be super. Just create a new theme and send me a pull request. +I'm a developer, I seem only capable of _grey_! If you're a designer and want to contribute a decent lick of paint on the project that would be super. Just create a new theme and send me a pull request. ## License And of course: -MIT: http://rem.mit-license.org +MIT: diff --git a/package.json b/package.json index c009f664..1fdd0ab9 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "dayjs": "^1.8.14", "express": "^4.17.1", "express-res-html": "^0.2.3", + "humanize-list": "^1.0.1", "md5": "^2.2.1", "mustache": "^3.0.1", "mustache-express": "^1.2.8" diff --git a/server.js b/server.js index 02d798c6..63671470 100644 --- a/server.js +++ b/server.js @@ -6,6 +6,7 @@ const mustache = require('mustache') const compression = require('compression') const dayjs = require('dayjs') const md5 = require('md5') +const humanizeList = require('humanize-list') // Read License file const template = fs.readFileSync('LICENSE.html', "utf8") @@ -46,7 +47,7 @@ app.get('*', (req, res) => { } else { // No error const user = JSON.parse(data) - info = `${year} ${user.copyright}` + info = `${year} ${typeof user.copyright === "string" ? user.copyright : humanizeList(user.copyright)}` theme = user.theme || "default" gravatar = user.gravatar ? `Profile image` : `` } diff --git a/yarn.lock b/yarn.lock index 06ae70e7..40b83784 100644 Binary files a/yarn.lock and b/yarn.lock differ