summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Bracco <href@random.sh>2022-03-31 03:59:05 +0000
committerJordan Bracco <href@random.sh>2022-03-31 03:59:05 +0000
commitf836ca4eab996342b1873dd708bbb0cd0e2def24 (patch)
tree1c6e9f5ccd48512c2e5d4e2591735cd451bbcaf7
initialHEADmain
-rw-r--r--.gitignore3
-rw-r--r--Makefile59
-rwxr-xr-xbin/render-markdown26
-rw-r--r--includes/css/modern-normalize.min.css9
-rwxr-xr-xincludes/layout.tpl.html18
-rw-r--r--src/about/infrastructure/index.md11
-rw-r--r--src/about/site/index.md8
-rw-r--r--src/error.md7
-rw-r--r--src/index.md5
-rw-r--r--src/site.css33
10 files changed, 179 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a84565c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+/build/
+/.published
+/.build
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..2f15f33
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,59 @@
+BUCKET=rndm-www
+S3_HOST="${BUCKET}.s3-website.fr-par.scw.cloud"
+URL="https://random.sh"
+SITE_NAME=random.sh
+
+LAYOUT=includes/layout.tpl.html
+STYLE=src/site.css
+STYLE_LIBS=includes/css/modern-normalize.min.css
+MARKDOWNFILES!=find src/ -type f -name '*.md'
+ASSETS!=find src/ -type f -not -name '*.md' -not -name "site.css"
+
+.export SITE_NAME BUCKET S3_HOST URL LAYOUT
+
+.MAIN: all
+
+all: sync
+
+build: .build
+sync: .published
+
+resync:
+ -rm .published
+ ${MAKE} sync
+
+clean:
+ -rm -r build/*
+
+.PHONY: all build sync resync clean
+
+# -- CSS
+${STYLE:S/^src/build/}: ${STYLE} ${STYLE_LIBS}
+ cat ${STYLE_LIBS} ${STYLE} > ${.TARGET}
+BUILDS+=${STYLE:S/^src/build/}
+
+# -- MD
+.for __md in ${MARKDOWNFILES}
+#.info "(markdown) ${__md} => ${__md:S/^src/build/:S/.md$/.html/}"
+${__md:S/^src/build/:S/.md$/.html/}: ${__md} bin/render-markdown ${LAYOUT} ${STYLE:S/^src/build/}
+ @mkdir -p "${.TARGET:H}"
+ bin/render-markdown "${LAYOUT}" "${__md}" > "${.TARGET}"
+BUILDS+=${__md:S/^src/build/:S/.md$/.html/}
+.endfor
+
+# -- Assets
+.for __s in ${ASSETS}
+#.info "(static) ${__s} => ${__s:S/^src/build/}"
+${__s:S/^src/build/}: ${__s}
+ @mkdir -p "${.TARGET:H}"
+ ln -s ${__s:tA} ${.TARGET}
+BUILDS+=${__s:S/^src/build/}
+.endfor
+
+.build: $(BUILDS)
+ @touch ${.TARGET}
+
+.published: .build
+ aws s3 sync --delete "build/" "s3://${BUCKET}/"
+ varnishadm -S /var/db/varnish.secret -T front.stairway.internal.random.sh:8081 ban "req.http.host ~ ${BUCKET}"
+ @touch ${.TARGET}
diff --git a/bin/render-markdown b/bin/render-markdown
new file mode 100755
index 0000000..84be150
--- /dev/null
+++ b/bin/render-markdown
@@ -0,0 +1,26 @@
+#!/usr/bin/env ruby
+require 'kramdown'
+require 'yaml'
+
+@site_name = ENV["SITE_NAME"]
+@url = ENV["URL"]
+
+template = ARGV.shift
+source_file = ARGV.first
+source = ARGF.read
+meta = {}
+
+if (md = source.match(/^(?<metadata>---\s*\n.*?\n?)^(---\s*$\n?)/m))
+ source = md.post_match
+ meta = YAML.load(md[:metadata]) || {}
+end
+
+body = Kramdown::Document.new(source).to_html
+
+if meta["title"]
+ title="#{@site_name} / #{meta["title"]}"
+else
+ title=@site_name
+end
+
+puts(File.read(template) % {body: body, title: title, built_at: Time.now.utc, source_file: source_file, site_name: @site_name, url: @url})
diff --git a/includes/css/modern-normalize.min.css b/includes/css/modern-normalize.min.css
new file mode 100644
index 0000000..aba965c
--- /dev/null
+++ b/includes/css/modern-normalize.min.css
@@ -0,0 +1,9 @@
+/**
+ * Minified by jsDelivr using clean-css v4.2.3.
+ * Original file: /npm/modern-normalize@1.1.0/modern-normalize.css
+ *
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
+ */
+/*! modern-normalize v1.1.0 | MIT License | https://github.com/sindresorhus/modern-normalize */
+*,::after,::before{box-sizing:border-box}html{-moz-tab-size:4;tab-size:4}html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}body{font-family:system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji'}hr{height:0;color:inherit}abbr[title]{text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Consolas,'Liberation Mono',Menlo,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}::-moz-focus-inner{border-style:none;padding:0}:-moz-focusring{outline:1px dotted ButtonText}:-moz-ui-invalid{box-shadow:none}legend{padding:0}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}
+/*# sourceMappingURL=/sm/b8ae781793ee4eb86edef3f2a2ac43a5575d063ed8cd287d7553f9f1b2776616.map */ \ No newline at end of file
diff --git a/includes/layout.tpl.html b/includes/layout.tpl.html
new file mode 100755
index 0000000..a6552e2
--- /dev/null
+++ b/includes/layout.tpl.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <link rel="stylesheet" href="/site.css">
+ <title>%{title}</title>
+ </head>
+ <body>
+ <header>
+ <h1><a href="/">./random.sh</a></h1>
+ </header>
+ <article>
+ %{body}
+ </article>
+ </body>
+<!-- generated_at="%{built_at}" from="%{source_file}" -->
+</html>
diff --git a/src/about/infrastructure/index.md b/src/about/infrastructure/index.md
new file mode 100644
index 0000000..fec3275
--- /dev/null
+++ b/src/about/infrastructure/index.md
@@ -0,0 +1,11 @@
+---
+title: about / infrastructure
+---
+
+# Infrastructure
+
+* OS: FreeBSD
+
+## Jails
+
+* Networking using `netgraph` (`ng_bridge`, `ng_eiface`)
diff --git a/src/about/site/index.md b/src/about/site/index.md
new file mode 100644
index 0000000..2cdba94
--- /dev/null
+++ b/src/about/site/index.md
@@ -0,0 +1,8 @@
+---
+title: about / site
+---
+
+# About this website
+
+This website source code is available at [https://git.random.sh/random.sh.git](https://git.random.sh/random.sh.git).
+
diff --git a/src/error.md b/src/error.md
new file mode 100644
index 0000000..3b65319
--- /dev/null
+++ b/src/error.md
@@ -0,0 +1,7 @@
+---
+title: not found
+---
+
+## Not found
+
+Sorry...
diff --git a/src/index.md b/src/index.md
new file mode 100644
index 0000000..6880d63
--- /dev/null
+++ b/src/index.md
@@ -0,0 +1,5 @@
+---
+---
+
+* [Login](/login)
+{: .buttons}
diff --git a/src/site.css b/src/site.css
new file mode 100644
index 0000000..1c47ac0
--- /dev/null
+++ b/src/site.css
@@ -0,0 +1,33 @@
+body {
+ max-width: 960px;
+ margin: 0 auto;
+ font-size: 1.2em;
+ color: #0f172a;
+}
+
+body > header > h1 > a {
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
+ -webkit-font-smoothing: antialiased;
+ text-decoration: none;
+ color: black;
+}
+
+body > header {
+ margin-bottom: 2em;
+}
+
+ul.buttons {
+ list-style-type: none;
+}
+ul.buttons > li {
+ display: inline-block;
+ margin-right: 0.5em;
+}
+ul.buttons > li > a {
+ display: inline-block;
+ background-color: #d4d4d8;
+ color: #18181b;
+ padding: 0.2em 0.3em;
+ text-decoration: none;
+ border: 1px solid #52525b;
+}