From 6f8e03e5065b0ad0678758e6e25ffc4db9ca2978 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Fri, 16 Apr 2021 16:31:54 +1200 Subject: [PATCH] Add JavaScript licenses page --- api/pages.js | 5 +++++ pug/includes/layout.pug | 2 +- pug/js-licenses.pug | 22 ++++++++++++++++++++++ sass/includes/base.sass | 13 +++++++++++++ sass/includes/js-licenses-page.sass | 3 +++ sass/main.sass | 1 + server.js | 1 + 7 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 pug/js-licenses.pug create mode 100644 sass/includes/js-licenses-page.sass diff --git a/api/pages.js b/api/pages.js index 191fa40..88e8635 100644 --- a/api/pages.js +++ b/api/pages.js @@ -7,5 +7,10 @@ module.exports = [ const mobile = userAgent.toLowerCase().includes("mobile") return render(200, "pug/home.pug", {mobile}) } + }, + { + route: "/js-licenses", methods: ["GET"], code: async () => { + return render(200, "pug/js-licenses.pug") + } } ] diff --git a/pug/includes/layout.pug b/pug/includes/layout.pug index 0c93f2a..a7e0eb6 100644 --- a/pug/includes/layout.pug +++ b/pug/includes/layout.pug @@ -43,4 +43,4 @@ html h3.footer__colhead About ul.footer__list li: a(href="/privacy") Privacy policy - // li: a(href="/js-licenses") JavaScript licenses + li: a(href="/js-licenses" data-jslicense=1) JavaScript licenses diff --git a/pug/js-licenses.pug b/pug/js-licenses.pug new file mode 100644 index 0000000..ea408a6 --- /dev/null +++ b/pug/js-licenses.pug @@ -0,0 +1,22 @@ +extends includes/layout.pug + +block head + title JavaScript license information + +block content + main.js-licenses-page + h1 JavaScript license information + table#jslicense-labels1 + thead + tr + th(scope="col") File + th(scope="col") License + th(scope="col") Source + tbody + each path of static.keys() + if path.match(/^html\/static\/js\/.*\.js$/) + - const file = path.replace(/^html/, "") + tr + td: a(href=file)= file + td: a(href="http://www.gnu.org/licenses/agpl-3.0.html") GNU-AGPL-3.0-or-later + td: a(href=file)= file diff --git a/sass/includes/base.sass b/sass/includes/base.sass index 537a32a..e1c7499 100644 --- a/sass/includes/base.sass +++ b/sass/includes/base.sass @@ -66,3 +66,16 @@ details &[open] summary margin-bottom: 16px + +table + background-color: c.$bg-darker + +table, td, th + border: 1px solid c.$edge-grey + border-collapse: collapse + +td, th + padding: 4px 8px + +thead, tr:nth-child(even) + background-color: c.$bg-darkest diff --git a/sass/includes/js-licenses-page.sass b/sass/includes/js-licenses-page.sass new file mode 100644 index 0000000..91fea5d --- /dev/null +++ b/sass/includes/js-licenses-page.sass @@ -0,0 +1,3 @@ +.js-licenses-page + max-width: 600px + margin: 0 auto diff --git a/sass/main.sass b/sass/main.sass index 3dec120..8f57ced 100644 --- a/sass/main.sass +++ b/sass/main.sass @@ -9,6 +9,7 @@ @use "includes/settings-page.sass" @use "includes/cant-think-page.sass" @use "includes/privacy-page.sass" +@use "includes/js-licenses-page.sass" @use "includes/forms.sass" @use "includes/nav.sass" @use "includes/footer.sass" diff --git a/server.js b/server.js index b3b0b91..3ce5d04 100644 --- a/server.js +++ b/server.js @@ -18,6 +18,7 @@ const {setInstance} = require("pinski/plugins") server.addPugDir("pug", ["pug/includes"]) server.addRoute("/cant-think", "pug/cant-think.pug", "pug") server.addRoute("/privacy", "pug/privacy.pug", "pug") + server.addRoute("/js-licenses", "pug/js-licenses.pug", "pug") server.addStaticHashTableDir("html/static/js") server.addStaticHashTableDir("html/static/js/elemjs")