Initial commit
authorNick Downing <nick@ndcode.org>
Sun, 25 Nov 2018 01:46:50 +0000 (12:46 +1100)
committerNick Downing <nick@ndcode.org>
Sun, 25 Nov 2018 01:46:50 +0000 (12:46 +1100)
23 files changed:
.gitignore [new file with mode: 0644]
_config/email.json [new file with mode: 0644]
_config/globals.json [new file with mode: 0644]
_config/server.jst [new file with mode: 0644]
_config/site.jst [new file with mode: 0644]
_favicon/.favicons.html [new file with mode: 0644]
_favicon/favicons.html [new file with mode: 0644]
_favicon/favicons.zip [new file with mode: 0644]
_ssl/ca.conf [new file with mode: 0644]
_ssl/ca_cert.pem [new file with mode: 0644]
_ssl/ca_cert.srl [new file with mode: 0644]
_ssl/ca_key.pem [new file with mode: 0644]
_ssl/localhost.conf [new file with mode: 0644]
_ssl/localhost_cert.pem [new file with mode: 0644]
_ssl/localhost_cert_bundle.pem [new file with mode: 0644]
_ssl/localhost_csr.pem [new file with mode: 0644]
_ssl/localhost_ext.conf [new file with mode: 0644]
_ssl/localhost_key.pem [new file with mode: 0644]
_ssl/n.sh [new file with mode: 0755]
calculatebutton.html.jst [new file with mode: 0644]
circle.html [new file with mode: 0644]
index.html [new file with mode: 0644]
package.json [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..c872802
--- /dev/null
@@ -0,0 +1,5 @@
+.*.jst
+/node_modules
+/package-lock.json
+/yarn.lock
+/yarn-error.log
diff --git a/_config/email.json b/_config/email.json
new file mode 100644 (file)
index 0000000..f030011
--- /dev/null
@@ -0,0 +1,6 @@
+{
+  "user": "contact@businessdataflow.com.au",
+  "password": "XXXContact12",
+  "host": "mail.ndcode.org",
+  "tls": {"ciphers": "SSLv3"}
+}
diff --git a/_config/globals.json b/_config/globals.json
new file mode 100644 (file)
index 0000000..2a17d44
--- /dev/null
@@ -0,0 +1,9 @@
+{
+  "site_title": "Olly's website",
+  "navigation": [
+    "/index.html"
+  ],
+  "page_to_title": {
+    "/index.html": "Home"
+  }
+}
diff --git a/_config/server.jst b/_config/server.jst
new file mode 100644 (file)
index 0000000..1439059
--- /dev/null
@@ -0,0 +1,25 @@
+let jst_server = require('@ndcode/jst_server')
+
+return {
+  "enable_caching": false,
+  "listen": [
+    {"port": 8080},
+    {"port": 8443, "protocol": "https:"}
+  ],
+  "mime_types": {
+    ".css": "text/css; charset=utf-8",
+    ".html": "text/html; charset=utf-8",
+    ".ico": "image/x-icon",
+    ".jpg": "image/jpeg",
+    ".jpeg": "image/jpeg",
+    ".js": "application/javascript; charset=utf-8",
+    ".json": "application/json; charset=utf-8",
+    ".png": "image/png",
+    ".svg": "image/svg+xml",
+    ".xml": "text/xml; charset=utf-8"
+  },
+  sites: {
+    'localhost': new jst_server.SiteDefault(_server, '.'),
+    'localhost.localdomain': new jst_server.SiteRedirect(_server, 'localhost')
+  }
+}
diff --git a/_config/site.jst b/_config/site.jst
new file mode 100644 (file)
index 0000000..7a250a5
--- /dev/null
@@ -0,0 +1,23 @@
+let jst_server = require('@ndcode/jst_server')
+
+let CustomSite = function(server, root) {
+  if (!this instanceof CustomSite)
+    throw Error('CustomSite is a constructor')
+  jst_server.SiteRoot.call(this, server, root)
+}
+
+CustomSite.prototype = Object.create(jst_server.SiteRoot.prototype)
+
+CustomSite.prototype.respond = async function(env) {
+  if (
+    env.pathname === '/node_modules' ||
+    env.pathname.slice(0, 14) === '/node_modules/' ||
+    env.pathname === '/package.json'
+  ) {
+    this.die(env, `banned file ${env.pathname}`)
+    return
+  }
+  return /*await*/ jst_server.SiteRoot.prototype.respond.call(this, env)
+}
+
+return new CustomSite(_server, _root)
diff --git a/_favicon/.favicons.html b/_favicon/.favicons.html
new file mode 100644 (file)
index 0000000..e54eb06
--- /dev/null
@@ -0,0 +1 @@
+<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"><meta name="theme-color" content="#ffffff">
\ No newline at end of file
diff --git a/_favicon/favicons.html b/_favicon/favicons.html
new file mode 100644 (file)
index 0000000..02ba31d
--- /dev/null
@@ -0,0 +1,6 @@
+<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
+<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
+<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
+<link rel="manifest" href="/manifest.json">
+<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
+<meta name="theme-color" content="#ffffff">
diff --git a/_favicon/favicons.zip b/_favicon/favicons.zip
new file mode 100644 (file)
index 0000000..11ac24b
Binary files /dev/null and b/_favicon/favicons.zip differ
diff --git a/_ssl/ca.conf b/_ssl/ca.conf
new file mode 100644 (file)
index 0000000..d0d9a5f
--- /dev/null
@@ -0,0 +1,25 @@
+[ ca ]
+default_ca      = CA_default            # The default ca section
+
+[ CA_default ]
+
+#dir            = ./demoCA              # top dir
+#database       = $dir/index.txt        # index file.
+#new_certs_dir  = $dir/newcerts         # new certs dir
+#
+#certificate    = $dir/cacert.pem       # The CA cert
+#serial         = $dir/serial           # serial no file
+#private_key    = $dir/private/cakey.pem# CA private key
+#RANDFILE       = $dir/private/.rand    # random number file
+#
+default_days   = 365                   # how long to certify for
+#default_crl_days= 30                   # how long before next CRL
+#default_md     = md5                   # md to use
+#
+#policy         = policy_any            # default policy
+#email_in_dn    = no                    # Don't add the email into cert DN
+#
+#name_opt       = ca_default            # Subject name display option
+#cert_opt       = ca_default            # Certificate display option
+#copy_extensions = none
+copy_extensions = copyall
diff --git a/_ssl/ca_cert.pem b/_ssl/ca_cert.pem
new file mode 100644 (file)
index 0000000..a77b130
--- /dev/null
@@ -0,0 +1,21 @@
+-----BEGIN CERTIFICATE-----
+MIIDYDCCAkigAwIBAgIJANSi4mXBF9a+MA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV
+B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5QdpWUfcnl0Kfrc1I3KlM3SpneGcv6FT/U4hjW++AZ
+ezss0w==
+-----END CERTIFICATE-----
diff --git a/_ssl/ca_cert.srl b/_ssl/ca_cert.srl
new file mode 100644 (file)
index 0000000..401cc51
--- /dev/null
@@ -0,0 +1 @@
+D29D1C6A226490AC
diff --git a/_ssl/ca_key.pem b/_ssl/ca_key.pem
new file mode 100644 (file)
index 0000000..e65d8ce
--- /dev/null
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAy2PngRdvbUTVsDW+Lg3VlALPu4w8m3qLPeBPLYDyjiRHNn5Q
+cKJZGvRlN+e8fSeb9igpzrgpCgK4S9rZpJrOX9heBHs2/5fQ568lHXJKgjCNm8AM
+/2v0/txy46iOJeZmsBNtSVzYIKgHHIsUVGP4Ct/lezPsznacEXOL+wmtEbAcMH73
+vFrPMaiq8lRb8yTNEF4gI2b8TKS8oHW55owiilQmNNDH4dtCqh2ATCDB2jNEYXUa
+74vP9qD30XDAco2XY5/AUPslMEF28z9jAvoqvO5S7sVMRGBmkFOJ8yDB9exmtObe
+s4ReNY6g5624yoG4MTxjTcb2rv666Qp6/vjUPwIDAQABAoIBAA3vOEsl2eJ4ltNN
+u0vYcsuDLcxBnV1hleyVU5dggD2wypg3KzesR8KK/+xGmilQ72R79/FLuLQQ36OC
+yOp4GK+EWVyhPHFia1OUMkzEKcqlnO4QyFMviEd1vwFN6P87u8lQa2pdTAlguawA
+81Gcz7+e+0/njM/QXHztl6eJUCwn7zEbG8+we0g8GkLILOBA3Tuy5Vu+ox1LQZQp
+WPqIMhm0GXPOVRKBr0mPVWtJvyAYvTX13GqNM1YFbElkbnkbsTaJhg/L3J9UJNsm
+BbOg0oUdq1yWoy7cjOXiq3aG9rNws9PBXbbDB/G67aae/1SJ7eBTV/kCEuYh0YDx
+MSn5xYECgYEA/uZueW4dFTKMBebNFvJreQei1ecaGwEFckUYD5u02VugtYc9inQ2
+sK7ENq/CsA10WKBxV84lIdiG5yXjG1RwCLvTV6YBP5uL9dVMln25x6ZDUxOlYzuZ
+OZUcabR3Y3Ar349vDV+vFle47J0YW8H89O5YlVxvLfZ+CFFFSBSMRCECgYEAzESS
+5IvNH1RUCR0tqRkHA0SXMiNxF85lFbUrbS2yMI60LCaTE2q/uK5008f5laD3LYKU
+Gq7SVP1U4z0+g9jGa0rvYd1h3o6fJMrFBiBN1ZRRzMFaiQxxNbyjCV7LR86m6aSo
+pz4f7k8EmzrsmZw7MF/l9Dy3AWHpg1cwYdR6DF8CgYB17kS0d6aK9Rzlahf/At+I
+WmkTD937Gmjbqm3sYry0R3k+IzjswsG+0szDBGRNsZvfmTN3TU/OrfAUJ2pAbbt7
+vvKTvaEcPanubeYGRlrarOi/GfrNw3grtPo1SaJm5jHWN/VIObm225UaG8B2S3Tu
+GQvw5pglqsI6tOcZ5y/SIQKBgBVJuD1VTIVNVoy0m8OZth9jEJbLFsgyXFqMzP/N
+2VoyJRjM1FsbrutiUw6XMq2jXt9BUooNWiI9XJFqGo/HEbaw0o3ScpatKmy9LRdc
+WoA9uuCp7fOGdm3xQNSDKpBLOx3yaRk04kMFvScoVuwTWh/Kfr6bbT8Zoypq9cHc
+UPPlAoGBAIEtVPhH6R51/HREPMWXWgwZujkeD0VQX+hNP8VOgSlts9L4bDn7res5
+DXHDXU3Q+vY+86qDvJgJaOdmt7IoNXgRlU9tUZP4MD8YG32Xjn3dnB5e/3SmBJwD
+NV4mVx+7X6me5rb4NdpMcSzulVXy3SfnQTaDsNghpcTqOXLFI0ti
+-----END RSA PRIVATE KEY-----
diff --git a/_ssl/localhost.conf b/_ssl/localhost.conf
new file mode 100644 (file)
index 0000000..fa3ef54
--- /dev/null
@@ -0,0 +1,66 @@
+# The main section is named req because the command we are using is req
+# (openssl req ...)
+[ req ]
+## This specifies the default key size in bits. If not specified then 512 is
+## used. It is used if the -new option is used. It can be overridden by using
+## the -newkey option. 
+#default_bits = 2048
+#
+## This is the default filename to write a private key to. If not specified the
+## key is written to standard output. This can be overridden by the -keyout
+## option.
+#default_keyfile = oats.key
+#
+## If this is set to no then if a private key is generated it is not encrypted.
+## This is equivalent to the -nodes command line option. For compatibility
+## encrypt_rsa_key is an equivalent option. 
+#encrypt_key = no
+
+# This option specifies the digest algorithm to use. Possible values include
+# md5 sha1 mdc2. If not present then MD5 is used. This option can be overridden
+# on the command line.
+default_md = sha1
+
+# if set to the value no this disables prompting of certificate fields and just
+# takes values from the config file directly. It also changes the expected
+# format of the distinguished_name and attributes sections.
+prompt = no
+
+# if set to the value yes then field values to be interpreted as UTF8 strings,
+# by default they are interpreted as ASCII. This means that the field values,
+# whether prompted from a terminal or obtained from a configuration file, must
+# be valid UTF8 strings.
+utf8 = yes
+
+# This specifies the section containing the distinguished name fields to
+# prompt for when generating a certificate or certificate request.
+distinguished_name = my_req_distinguished_name
+
+# this specifies the configuration file section containing a list of extensions
+# to add to the certificate request. It can be overridden by the -reqexts
+# command line switch. See the x509v3_config(5) manual page for details of the
+# extension section format.
+req_extensions = my_extensions
+
+[ my_req_distinguished_name ]
+C = PT
+ST = Lisboa
+L = Lisboa
+O  = Oats In The Water
+#CN = *.oats.org
+CN = localhost
+
+[ my_extensions ]
+basicConstraints=CA:FALSE
+subjectAltName=@my_subject_alt_names
+subjectKeyIdentifier = hash
+
+[ my_subject_alt_names ]
+#DNS.1 = *.oats.org
+#DNS.2 = *.oats.net
+#DNS.3 = *.oats.in
+#DNS.4 = oats.org
+#DNS.5 = oats.net
+#DNS.6 = oats.in
+DNS.1 = localhost
+DNS.2 = localhost.localdomain
diff --git a/_ssl/localhost_cert.pem b/_ssl/localhost_cert.pem
new file mode 100644 (file)
index 0000000..8820da7
--- /dev/null
@@ -0,0 +1,21 @@
+-----BEGIN CERTIFICATE-----
+MIIDgDCCAmigAwIBAgIJANKdHGoiZJCsMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV
+BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBh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Yglx5PSJTvA
+zGvABNuodcksOPLyzPiKcTPVks5Ls1WxDgOYoRNeEYHszYDW
+-----END CERTIFICATE-----
diff --git a/_ssl/localhost_cert_bundle.pem b/_ssl/localhost_cert_bundle.pem
new file mode 100644 (file)
index 0000000..48fa2d7
--- /dev/null
@@ -0,0 +1,42 @@
+-----BEGIN CERTIFICATE-----
+MIIDgDCCAmigAwIBAgIJANKdHGoiZJCsMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV
+BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX
+aWRnaXRzIFB0eSBMdGQwHhcNMTgxMTE2MTAyNjU1WhcNMTgxMjE2MTAyNjU1WjBf
+MQswCQYDVQQGEwJQVDEPMA0GA1UECAwGTGlzYm9hMQ8wDQYDVQQHDAZMaXNib2Ex
+GjAYBgNVBAoMEU9hdHMgSW4gVGhlIFdhdGVyMRIwEAYDVQQDDAlsb2NhbGhvc3Qw
+ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDDJLav5I1Dxx9Lzv7DyHig
+ApIkm9U8tcRKuM3Q4q3xj8P2VmSHVHZ0FfjKs/NZ8hLi3go+EzGolmiRKPA7V9UQ
+Zgm5MmC6tewiol76lsjehUKuG+DmT3n79xSHsj5PC6wkE/IkifcQIeGVJWgQbRR4
+JSGaX4tmmpxNrDDgpVnaXEO8I5KR/jvniAn2DoTKlY5XSIUXlbZQPHdlLdLUU7in
+5M19b9qnIdJRxa4mcOWNtsUHU16SJZAmQBmg4vAhMc4XyJ23YE8cNxUxusKrhoUB
+sWmvjGgbbaYgtwBmCFQNSFiJhyzgg6sdUot7wVXDkXBTJPQRQO82CJyw6YoDnTCL
+AgMBAAGjWTBXMAkGA1UdEwQCMAAwKwYDVR0RBCQwIoIJbG9jYWxob3N0ghVsb2Nh
+bGhvc3QubG9jYWxkb21haW4wHQYDVR0OBBYEFPKfGhTkosDI90l245Si/Ce/CLr/
+M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
+5624yoG4MTxjTcb2rv666Qp6/vjUPwIDAQABo1MwUTAdBgNVHQ4EFgQUQbZw0emw
+0IwXLQAg13thU7AEgRMwHwYDVR0jBBgwFoAUQbZw0emw0IwXLQAg13thU7AEgRMw
+DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAv9RHAheIwsVqdvbF
+USorz0z7PjDM8dmI1yanPNBUjNIMceZ0h+CcFOztMH8dvMM0r5pCQkIJJyFCyXtK
+y61AOrNbOAgnDm3z1YrVB8NEnji9Qicctpbse8UymD2kOdBXjU1Egrd/uUAgJZmP
+ASYeEYf/n7/bMwTNAJ+qc0o793ILIwJ20Ois43oh3RB57xDzHlHWEbN+lZFZWjmT
+yuVPvwULYmgLP8huh3EOwnsh0eCYkhgImhJICawjWQLT+EHbD3xt+QRYElDgv/Av
+kqRliJCa3yF8NLUdsQp7jD5QdpWUfcnl0Kfrc1I3KlM3SpneGcv6FT/U4hjW++AZ
+ezss0w==
+-----END CERTIFICATE-----
diff --git a/_ssl/localhost_csr.pem b/_ssl/localhost_csr.pem
new file mode 100644 (file)
index 0000000..b28c691
--- /dev/null
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE REQUEST-----
+MIIDDDCCAfQCAQAwXzELMAkGA1UEBhMCUFQxDzANBgNVBAgMBkxpc2JvYTEPMA0G
+A1UEBwwGTGlzYm9hMRowGAYDVQQKDBFPYXRzIEluIFRoZSBXYXRlcjESMBAGA1UE
+AwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwyS2
+r+SNQ8cfS87+w8h4oAKSJJvVPLXESrjN0OKt8Y/D9lZkh1R2dBX4yrPzWfIS4t4K
+PhMxqJZokSjwO1fVEGYJuTJgurXsIqJe+pbI3oVCrhvg5k95+/cUh7I+TwusJBPy
+JIn3ECHhlSVoEG0UeCUhml+LZpqcTaww4KVZ2lxDvCOSkf4754gJ9g6EypWOV0iF
+F5W2UDx3ZS3S1FO4p+TNfW/apyHSUcWuJnDljbbFB1NekiWQJkAZoOLwITHOF8id
+t2BPHDcVMbrCq4aFAbFpr4xoG22mILcAZghUDUhYiYcs4IOrHVKLe8FVw5FwUyT0
+EUDvNgicsOmKA50wiwIDAQABoGgwZgYJKoZIhvcNAQkOMVkwVzAJBgNVHRMEAjAA
+MCsGA1UdEQQkMCKCCWxvY2FsaG9zdIIVbG9jYWxob3N0LmxvY2FsZG9tYWluMB0G
+A1UdDgQWBBTynxoU5KLAyPdJduOUovwnvwi6/zANBgkqhkiG9w0BAQUFAAOCAQEA
+L4XofNRjzahIDCj/pHVnsaXtioidv5Hp0vE+9LPhzZz/bH/e7s8lJnTalEkPNUxD
+FPwiRar6MILQwn5N1b+kToSoiYDsCL77Y5WSlhcwe7gLwgDTlNwu2H030BZEr0ve
+AEAems45TJk8o3kC5s3dt0KaGbRikub1HMTpFrlQUBLbO848t6qXcZCVjoAWYKlp
+jaYn7r3bWVyZ2W2oIlQ19Tbxz+kG81Vxrg1FtAo7aBHTaOvEskgnEQ2Emc0mbLoe
+YoT0Gg7Vrurl+T5gazmV1WMKszSjP8NKhTUcMESiRIUsmQczWiDBONiH9PGmGKHI
+7aEBzQIK7m3goyS3I4q6nw==
+-----END CERTIFICATE REQUEST-----
diff --git a/_ssl/localhost_ext.conf b/_ssl/localhost_ext.conf
new file mode 100644 (file)
index 0000000..d5005dc
--- /dev/null
@@ -0,0 +1,13 @@
+basicConstraints=CA:FALSE
+subjectAltName=@my_subject_alt_names
+subjectKeyIdentifier = hash
+
+[ my_subject_alt_names ]
+#DNS.1 = *.oats.org
+#DNS.2 = *.oats.net
+#DNS.3 = *.oats.in
+#DNS.4 = oats.org
+#DNS.5 = oats.net
+#DNS.6 = oats.in
+DNS.1 = localhost
+DNS.2 = localhost.localdomain
diff --git a/_ssl/localhost_key.pem b/_ssl/localhost_key.pem
new file mode 100644 (file)
index 0000000..6c94353
--- /dev/null
@@ -0,0 +1,27 @@
+-----BEGIN RSA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F
+LLyF5/0/CK56agL3YxGREx2iQdauqTsOyr2LLN0CgYEAzYEgPN9u6ymd415m4KKO
+c1krmh1Ei9M0wa9A6j9I6H3cgu05x4n+c8HjyPlVdlstINDYmqlL4C6VwvCMsR1E
+60e7qZ07fKwNK7L54FmGfI0LJ/wAK8+WOV5+PiiZc5dHX35ZzQ1eyBLiCysEYR02
+KIcvTiiLh/NsDqAv+Qc/n7sCgYAup0z+3LnVoeturXz2sIWpbFi804ayrK64OcUL
+5n4C3T9QuNr8drqQVs0EFIiVFlgKLmr+n6kYx0iMeavU5gcIMxehbTXtCQPtbF5+
+nMPantsFZhEBc+a7pUe1WwQeEKhIGqGCDBaEKiR+NNmsboE2HjlZRcBv+zM9QwED
+6DW17QKBgQCRZfGUWasWXW6s9aZ1FgLPAXz/M9BLZjnx627KvbF4C+ZwfszntJxn
+1A74mhHWJyKbt8YzfOTsTj40lp/npSpgjRQmUoqThx8d2cA41ALo0ktk6E9Zpp1j
+phi0woa+TdEpqE2Jb8hJcyRKGCOVOKL/bnZL/QVgMebhg02n//wa9w==
+-----END RSA PRIVATE KEY-----
diff --git a/_ssl/n.sh b/_ssl/n.sh
new file mode 100755 (executable)
index 0000000..9fbf379
--- /dev/null
+++ b/_ssl/n.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# see https://gist.github.com/Soarez/9688998
+
+# note that the CSR contains X509 extensions, particularly the SAN which
+# is mandatory for getting Google Chrome to accept the certificate, but
+# unfortunately "openssl x509" will strip extensions -- this can be fixed
+# by using the "openssl ca" command with "extensions = copyall" (or in
+# the normal case filters would be specified on what extensions to copy),
+# but the "openssl ca" command is very complicated and requires a directory
+# structure to be set up, so we fake it with the "localhost_ext.conf" file
+
+# generate a key for the subject
+#openssl genrsa -out localhost_key.pem 2048
+
+# generate a CSR
+openssl req -new -key localhost_key.pem -out localhost_csr.pem -config localhost.conf
+
+# generate a key for the CA
+#openssl genrsa -out ca_key.pem 2048
+
+# generate a self signed certificate for the CA
+openssl req -new -x509 -key ca_key.pem -out ca_cert.pem
+
+# sign the certificate
+#openssl x509 -req -in localhost_csr.pem -extfile localhost_ext.conf -CA ca_cert.pem -CAkey ca_key.pem -CAcreateserial -out localhost_cert.pem
+openssl x509 -req -in localhost_csr.pem -extfile localhost_ext.conf -CA ca_cert.pem -CAkey ca_key.pem -CAserial ca_cert.srl -out localhost_cert.pem
+
+# resolve problems with not including the signing chain (can improve this?)
+cat localhost_cert.pem ca_cert.pem > localhost_cert_bundle.pem
diff --git a/calculatebutton.html.jst b/calculatebutton.html.jst
new file mode 100644 (file)
index 0000000..662ebae
--- /dev/null
@@ -0,0 +1,62 @@
+let querystring = require('querystring')
+let stream_buffers = require('stream-buffers')
+
+return async env => {
+  if (env.request.method == 'POST') {
+    let write_stream = new stream_buffers.WritableStreamBuffer()
+    let data = new Promise(
+      (resolve, reject) => {
+        write_stream.
+        on('finish', () => {resolve(write_stream.getContents())}).
+        on('error', () => {reject()})
+      }
+    )
+    env.request.pipe(write_stream)
+    let query = querystring.parse((await data).toString())
+
+    let radius_and_units = query.radius.split(' ')
+
+let radius = parseInt(radius_and_units[0])
+let units = radius_and_units[1] || 'units'
+let area = Math.PI * radius * radius
+let circumference = Math.PI * radius * 2
+let diameter = radius * 2
+
+    _site.serve(
+      env,
+      200,
+      `<!DOCTYPE html>
+<html>
+<head>
+<title>Hello World HTML</title>
+</head>
+<body>
+<h1>The radius is: ${radius} ${units}</h1>
+<h1>The area is: ${area} ${units}²</h1>
+<h1>The circumference is: ${circumference} ${units}</h1>
+<h1>The diameter is: ${diameter}  ${units}</h1>
+</body>
+</html>
+`,
+      'calculatebutton.html.jst'
+    )
+  }
+  else {
+    _site.serve(
+      env,
+      200,
+      `<!DOCTYPE html>
+<html>
+<head>
+<title>Hello World HTML</title>
+</head>
+<body>
+<h1>404 Error - Unable to Calculate</h1>
+</body>
+</html>
+`,
+      'calculatebutton.html.jst'
+    )
+  }
+}
+
diff --git a/circle.html b/circle.html
new file mode 100644 (file)
index 0000000..085cc8d
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Circle Calculator</title>
+</head>
+<body>
+<h1>Circle Calculator</h1>
+Please type the number, optionally followed by the unit (there must be a space between the number and the unit).
+<form action="/calculatebutton.html" method="post">
+  <div>
+    <label for="radius">Radius:</label>
+    <input type="text" id="radius" name="radius">
+  </div>
+  <div class="button">
+    <button type="submit">Calculate</button>
+  </div>
+</form>
+</body>
+</html>
+
diff --git a/index.html b/index.html
new file mode 100644 (file)
index 0000000..2e7cc0f
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Olly's Website</title>
+</head>
+<body>
+<h1>Olly's Website</h1>
+<a href="/circle.html">Go to Circle Calculator</a>
+</body>
+</html>
+
diff --git a/package.json b/package.json
new file mode 100644 (file)
index 0000000..ca1edc5
--- /dev/null
@@ -0,0 +1,16 @@
+{
+  "name": "@ndcode/olly_website",
+  "version": "0.1.0",
+  "description": "Olly's website",
+  "directories": {},
+  "dependencies": {
+    "cookie": "^0.3.1",
+    "querystring": "^0.2.0",
+    "stream-buffers": "^3.0.2",
+    "xdate": "^0.8.2"
+  },
+  "devDependencies": {},
+  "scripts": {},
+  "author": "Nick Downing",
+  "license": "GPL-3.0"
+}