commit 3b3ac734f8c9204530273446d6eaeacf22bf5e98
parent 5454a6f2603783e599bf3d5adde6c7b175006711
Author: Ryan Jeffrey <ryan@ryanmj.xyz>
Date: Sun, 21 Feb 2021 02:09:29 -0800
JS script checksum
Diffstat:
6 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/about.org b/about.org
@@ -4,7 +4,7 @@
#+options: p:nil pri:nil prop:nil stat:t tags:t tasks:t tex:t
#+options: timestamp:t title:nil toc:t todo:t |:t
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="css/terminal.css" />
-#+HTML_HEAD: <script src="scripts/main.js"></script>
+#+HTML_HEAD: <script src="scripts/main.js" integrity="sha384-__SHASUM__"></script>
#+language: en
#+select_tags: export
#+exclude_tags: noexport
diff --git a/index.org b/index.org
@@ -4,8 +4,8 @@
#+options: p:nil pri:nil prop:nil stat:t tags:t tasks:t tex:t
#+options: timestamp:t title:nil toc:t todo:t |:t
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="css/terminal.css" />
-#+HTML_HEAD: <script src="scripts/main.js"></script>
-#+HTML_HEAD: <link rel="shortcut icon" type="image/x-icon" href="res/favicon-32x32.ico">"
+#+HTML_HEAD: <script src="scripts/main.js" integrity="sha384-__SHASUM__"></script>
+#+HTML_HEAD: <link rel="shortcut icon" type="image/x-icon" href="res/favicon-32x32.ico">
#+language: en
#+select_tags: export
#+exclude_tags: noexport
diff --git a/posts/index.org b/posts/index.org
@@ -4,7 +4,8 @@
#+options: p:nil pri:nil prop:nil stat:t tags:t tasks:t tex:t
#+options: timestamp:t title:nil toc:t todo:t |:t
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../css/terminal.css" />
-#+HTML_HEAD: <script src="../scripts/main.js"></script>
+#+HTML_HEAD: <script src="../scripts/main.js" integrity="sha384-__SHASUM__"></script>
+#+HTML_HEAD: <link rel="shortcut icon" type="image/x-icon" href="/res/favicon.ico">
#+language: en
#+select_tags: export
#+exclude_tags: noexport
diff --git a/posts/mailserver-addendum.org b/posts/mailserver-addendum.org
@@ -4,8 +4,8 @@
#+options: p:nil pri:nil prop:nil stat:t tags:t tasks:t tex:t
#+options: timestamp:t title:nil toc:t todo:t |:t
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../css/terminal.css" />
-#+HTML_HEAD: <script src="../scripts/main.js" integrity="sha384-XS1iS5qpCSdI66js7YVxG6+tuvIeTft0XeleXz9G+LKqDXt2rcWB+0OOYzyKlEau"></script>
-#+HTML_HEAD: <link rel="shortcut icon" type="image/x-icon" href="res/favicon-32x32.ico">"
+#+HTML_HEAD: <script src="../scripts/main.js" integrity="sha384-__SHASUM__"></script>
+#+HTML_HEAD: <link rel="shortcut icon" type="image/x-icon" href="/res/favicon.ico">
#+language: en
#+select_tags: export
#+exclude_tags: noexport
@@ -32,11 +32,12 @@
#+TITLE: In Addition to Luke Smith's Mail Configuration Video
#+AUTHOR: Ryan Jeffrey
#+EMAIL: ryan@ryanmj.xyz
+#+DATE: <2020-09-16 Wed>
#+OPTIONS: num:nil
__PROMPT__ cat posts/mailserver-addendum.html
-I used [[https://youtu.be/9zP7qooM4pY][Luke Smith's video on setting up an email server]], and although it got me 90% of the way there, I encountered a couple of snags that he was able to avoid for whatever reason.
+I used [[https://youtu.be/9zP7qooM4pY][Luke Smith's video on setting up an email server]], and although it got me 90% of the way there, I encountered a couple of snags that he was able to avoid for whatever reason.
* Port 25
diff --git a/publish.el b/publish.el
@@ -40,6 +40,11 @@
(setq site-dir (concat (getenv "HOME") "/src/site"))
(setq export-site "/ssh:root@ryanmj.xyz:/var/www/underground/")
+;; Get SHA checksum for org-mode js file.
+(defvar js-sum1 (shell-command-to-string
+ "shasum -b -a 384 scripts/main.js | awk '{ print $1 }' | xxd -r -p | base64 | tr -d '\n'")
+ "SHA checksum for `org-mode' js file.")
+
(defun create-preamble (plist)
"Insert preamble, PLIST is list of options."
(let* ((file-name (file-name-nondirectory (plist-get plist :output-file))))
@@ -112,6 +117,15 @@ Return sitemap using TITLE and LIST returned by `create-blogmap-entry'."
"find . -name '*.org' -exec cat {} + | wc -c | numfmt --to=si | tr -d '\n'")
" Words</p>@@\n")))))
+;; Replace __SHASUM__ with the sum of the file.
+(add-hook 'org-export-before-parsing-hook #'(lambda (backend)
+ "Create fake ls listing."
+ (goto-char (point-min))
+ (while (search-forward "__SHASUM__" (point-max) t)
+ (kill-backward-chars (length "__SHASUM__"))
+ (insert-before-markers js-sum1))))
+
+
(defun create-blogmap-entry (entry _style project)
"Create an entry for the blogmap.
One string for each ENTRY in PROJECT."
diff --git a/software.org b/software.org
@@ -4,7 +4,7 @@
#+options: p:nil pri:nil prop:nil stat:t tags:t tasks:t tex:t
#+options: timestamp:t title:nil toc:t todo:t |:t
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="css/terminal.css" />
-#+HTML_HEAD: <script src="scripts/main.js"></script>
+#+HTML_HEAD: <script src="scripts/main.js" integrity="sha384-__SHASUM__"></script>
#+language: en
#+select_tags: export
#+exclude_tags: noexport