From: Joann Mõndresku Date: Wed, 14 Jul 2021 21:00:00 +0000 (+0300) Subject: Launch and Intentions X-Git-Url: https://git.based.quest/%7B%7B%20.RelPermalink%20%7D%7D?a=commitdiff_plain;h=0324a0cf72ccfa59db420a6574d6c59a579e4d9f;p=web-old.git Launch and Intentions --- 0324a0cf72ccfa59db420a6574d6c59a579e4d9f diff --git a/articles/launch-and-intentions.md b/articles/launch-and-intentions.md new file mode 100644 index 0000000..33f7c14 --- /dev/null +++ b/articles/launch-and-intentions.md @@ -0,0 +1,22 @@ +Launch and Intentions + +Hey, my name's Cernodile, the system administrator for based.quest and its services. +I started this website with the intent of creating a sane, perhaps based, space on the +internet where you are not being spied or tracked on. I will be offering services that +help you achieve sovereignty over your data. + +To kick things off, I've launched an [Invidious instance](https://iv.based.quest). Invidious +allows you to watch YouTube videos without actually ever interfacing with Google. If you find +Invidious tedious to use, you can use it as an API and pick a front-end of your liking (e.g. +FreeTube). + +I will not be moving my [Searx instance](https://searx.cernodile.com) neither my [Matrix](https://matrix.org) +homeserver, they will continue to be available on cernodile.com. This domain will continue to +house anything that I haven't on cernodile.com. I am thinking of trying out [PeerTube](https://joinpeertube.org) and +maybe if I can work out GDPR nuances, [Dendrite Matrix homeserver](https://github.com/matrix-org/dendrite). + + +Thanks for reading, +- Cernodile + +;tags:site future news diff --git a/blogit b/blogit new file mode 100755 index 0000000..6035d1e --- /dev/null +++ b/blogit @@ -0,0 +1,203 @@ +#!/usr/bin/make -f +# Source: https://pedantic.software/git/blogit/ +BLOG := $(MAKE) -f $(lastword $(MAKEFILE_LIST)) --no-print-directory +ifneq ($(filter-out help,$(MAKECMDGOALS)),) +include config +endif + +# The following can be configured in config +BLOG_DATE_FORMAT_INDEX ?= %x +BLOG_DATE_FORMAT ?= %x %X +BLOG_TITLE ?= blog +BLOG_DESCRIPTION ?= blog +BLOG_URL_ROOT ?= http://localhost/blog +BLOG_FEED_MAX ?= 20 +BLOG_FEEDS ?= rss atom +BLOG_SRC ?= articles + + +.PHONY: help init build deploy clean + +ARTICLES = $(shell git ls-tree HEAD --name-only -- $(BLOG_SRC)/ 2>/dev/null) +TAGFILES = $(patsubst $(BLOG_SRC)/%.md,tags/%,$(ARTICLES)) + +help: + $(info blogit init|build|deploy|clean) + +init: + mkdir -p $(BLOG_SRC) data templates + printf '$$TITLE' > templates/header.html + printf '' > templates/footer.html + printf '' > templates/index_header.html + printf '

Tags:' > templates/tag_list_header.html + printf '$$NAME' > templates/tag_entry.html + printf ', ' > templates/tag_separator.html + printf '

' > templates/tag_list_footer.html + printf '

Articles

' > templates/article_list_footer.html + printf '' > templates/index_footer.html + printf '' > templates/tag_index_header.html + printf '' > templates/tag_index_footer.html + printf '

$$TITLE

' > templates/article_header.html + printf '' > templates/article_footer.html + printf 'blog\n' > .git/info/exclude + +build: blog/index.html tagpages $(patsubst $(BLOG_SRC)/%.md,blog/%.html,$(ARTICLES)) $(patsubst %,blog/%.xml,$(BLOG_FEEDS)) + +deploy: build + rsync -rLtvz $(BLOG_RSYNC_OPTS) blog/ data/ $(BLOG_REMOTE) + +clean: + rm -rf blog tags + +config: + printf 'BLOG_REMOTE:=%s\n' \ + '$(shell printf "Blog remote (eg: host:/var/www/html): ">/dev/tty; head -n1)' \ + > $@ + +tags/%: $(BLOG_SRC)/%.md + mkdir -p tags + grep -i '^; *tags:' "$<" | cut -d: -f2- | sed 's/ */\n/g' | sed '/^$$/d' | sort -u > $@ + +blog/index.html: $(ARTICLES) $(TAGFILES) $(addprefix templates/,$(addsuffix .html,header index_header tag_list_header tag_entry tag_separator tag_list_footer article_list_header article_entry article_separator article_list_footer index_footer footer)) + mkdir -p blog + TITLE="$(BLOG_TITLE)"; \ + export TITLE; \ + envsubst < templates/header.html > $@; \ + envsubst < templates/index_header.html >> $@; \ + envsubst < templates/tag_list_header.html >> $@; \ + first=true; \ + for t in $(shell cat $(TAGFILES) | sort -u); do \ + "$$first" || envsubst < templates/tag_separator.html; \ + NAME="$$t" \ + URL="@$$t.html" \ + envsubst < templates/tag_entry.html; \ + first=false; \ + done >> $@; \ + envsubst < templates/tag_list_footer.html >> $@; \ + envsubst < templates/article_list_header.html >> $@; \ + first=true; \ + for f in $(ARTICLES); do \ + printf '%s ' "$$f"; \ + git log --diff-filter=A --date="format:%s $(BLOG_DATE_FORMAT_INDEX)" --pretty=format:'%ad%n' -- "$$f"; \ + done | sort -k2nr | cut -d" " -f1,3- | while IFS=" " read -r FILE DATE; do \ + "$$first" || envsubst < templates/article_separator.html; \ + URL="`printf '%s' "\$$FILE" | sed 's,^$(BLOG_SRC)/\(.*\).md,\1,'`.html" \ + DATE="$$DATE" \ + TITLE="`head -n1 "\$$FILE" | sed -e 's/^# //g'`" \ + envsubst < templates/article_entry.html; \ + first=false; \ + done >> $@; \ + envsubst < templates/article_list_footer.html >> $@; \ + envsubst < templates/index_footer.html >> $@; \ + envsubst < templates/footer.html >> $@; \ + + +blog/tag/%.html: $(ARTICLES) $(addprefix templates/,$(addsuffix .html,header tag_header index_entry tag_footer footer)) + +.PHONY: tagpages +tagpages: $(TAGFILES) + +$(BLOG) $(patsubst %,blog/@%.html,$(shell cat $(TAGFILES) | sort -u)) + +blog/@%.html: $(TAGFILES) $(addprefix templates/,$(addsuffix .html,header tag_index_header tag_list_header tag_entry tag_separator tag_list_footer article_list_header article_entry article_separator article_list_footer tag_index_footer footer)) + mkdir -p blog + TITLE="Articles tagged $*"; \ + TAGS="$*"; \ + export TITLE; \ + export TAGS; \ + envsubst < templates/header.html > $@; \ + envsubst < templates/tag_index_header.html >> $@; \ + envsubst < templates/article_list_header.html >> $@; \ + first=true; \ + for f in $(shell grep -FH '$*' $(TAGFILES) | sed 's,^tags/\([^:]*\):.*,$(BLOG_SRC)/\1.md,'); do \ + printf '%s ' "$$f"; \ + git log --diff-filter=A --date="format:%s $(BLOG_DATE_FORMAT_INDEX)" --pretty=format:'%ad%n' -- "$$f"; \ + done | sort -k2nr | cut -d" " -f1,3- | while IFS=" " read -r FILE DATE; do \ + "$$first" || envsubst < templates/article_separator.html; \ + URL="`printf '%s' "\$$FILE" | sed 's,^$(BLOG_SRC)/\(.*\).md,\1,'`.html" \ + DATE="$$DATE" \ + TITLE="`head -n1 "\$$FILE" | sed -e 's/^# //g'`" \ + envsubst < templates/article_entry.html; \ + first=false; \ + done >> $@; \ + envsubst < templates/article_list_footer.html >> $@; \ + envsubst < templates/tag_index_footer.html >> $@; \ + envsubst < templates/footer.html >> $@; \ + + +blog/%.html: $(BLOG_SRC)/%.md $(addprefix templates/,$(addsuffix .html,header article_header article_footer footer)) + mkdir -p blog + TITLE="$(shell head -n1 $<)"; \ + export TITLE; \ + AUTHOR="$(shell git log -n 1 --reverse --format="%cn" -- "$<")"; \ + export AUTHOR; \ + DATE_POSTED="$(shell git log --diff-filter=A --date="format:$(BLOG_DATE_FORMAT)" --pretty=format:'%ad' -- "$<")"; \ + export DATE_POSTED; \ + DATE_EDITED="$(shell git log -n 1 --date="format:$(BLOG_DATE_FORMAT)" --pretty=format:'%ad' -- "$<")"; \ + export DATE_EDITED; \ + TAGS="$(shell grep -i '^; *tags:' "$<" | cut -d: -f2- | paste -sd ',')"; \ + export TAGS; \ + envsubst < templates/header.html > $@; \ + envsubst < templates/article_header.html >> $@; \ + sed -e 1d \ + -e '/^;/d' \ + -e 's/&/\&/g' \ + -e 's//\>/g' \ + -e '/^```$$/{s,.*,,;x;p;/^<\/code>/d;s,.*,
,;bT}' \
+		-e 'x;/<\/code>/{x;s,\$$,\$,g;$$G;p;d};x' \
+		-e 's,\\\$$,\$,g' \
+		-e '/^####/{s,^####,

,;s,$$,

,;H;s,.*,,;x;p;d}' \ + -e '/^###/{s,^###,

,;s,$$,

,;H;s,.*,,;x;p;d}' \ + -e '/^##/{s,^##,

,;s,$$,

,;H;s,.*,,;x;p;d}' \ + -e '/^#/{s,^#,

,;s,$$,

,;H;s,.*,,;x;p;d}' \ + -e 's,`\([^`]*\)`,\1,g' \ + -e 's,\*\*\(\([^*<>][^*<>]*\*\?\)*\)\*\*,\1,g' \ + -e 's,\*\([^*<>][^*<>]*\)\*,\1,g' \ + -e 's,!\[\([^]]*\)\](\([^)]*\)),\1,g' \ + -e 's,\[\([^]]*\)\](\([^)]*\)),\1,g' \ + -e '/^- /{s,^- ,
  • ,;s,$$,
  • ,;x;/^<\/ul>/{x;bL};p;s,.*,
      ,;bT}' \ + -e '/^[1-9][0-9]*\. /{s,^[0-9]*\. ,
    • ,;s,$$,
    • ,;x;/^<\/ol>/{x;bL};p;s,.*,
        ,;bT}' \ + -e '/^$$/{x;/^$$/d;p;d}' \ + -e 'x;/^$$/{s,.*,

        ,;bT};x' \ + -e ':L;$$G;p;d' \ + -e ':T;p;:t;s,<\([^/>][^>]*\)>\(\(<[^/>][^>]*>\)*\),\2,;/<[^\/>]/bt;x;/^$$/{$${x;p};d};bL' \ + "$<" | envsubst >> $@; \ + envsubst < templates/article_footer.html >> $@; \ + envsubst < templates/footer.html >> $@; \ + +blog/rss.xml: $(ARTICLES) + printf '\n\n\n%s\n%s\n%s\n' \ + "$(BLOG_TITLE)" "$(BLOG_URL_ROOT)" "$(BLOG_DESCRIPTION)" > $@ + for f in $(ARTICLES); do \ + printf '%s ' "$$f"; \ + git log --diff-filter=A --date="format:%s %a, %d %b %Y %H:%M:%S %z" --pretty=format:'%ad%n' -- "$$f"; \ + done | sort -k2nr | head -n $(BLOG_FEED_MAX) | cut -d" " -f1,3- | while IFS=" " read -r FILE DATE; do \ + printf '\n%s\n%s\n%s\n%s\n%s\n\n' \ + "`head -n 1 $$FILE`" \ + "$(BLOG_URL_ROOT)/`basename $$FILE .md`.html" \ + "$(BLOG_URL_ROOT)/`basename $$FILE .md`.html" \ + "$$DATE" \ + "`sed -n '1d;/^$$/{2{d;b};q};p' < $$FILE`"; \ + done >> $@ + printf '\n\n' >> $@ + +blog/atom.xml: $(ARTICLES) + printf '\n\n%s\n%s\n%s\n\n%s\n\n' \ + "$(BLOG_TITLE)" "$(BLOG_DESCRIPTION)" "$(shell date +%Y-%m-%dT%H:%M:%SZ)" "$(BLOG_URL_ROOT)" "$(BLOG_URL_ROOT)/atom.xml" "$(BLOG_URL_ROOT)/atom.xml" > $@ + for f in $(ARTICLES); do \ + printf '%s ' "$$f"; \ + git log --diff-filter=A --date="format:%s %Y-%m-%dT%H:%M:%SZ" --pretty=format:'%ad %aN%n' -- "$$f"; \ + done | sort -k2nr | head -n $(BLOG_FEED_MAX) | cut -d" " -f1,3- | while IFS=" " read -r FILE DATE AUTHOR; do \ + printf '\n%s\n\n%s\n%s\n%s\n%s\n

        %s\n\n' \ + "`head -n 1 $$FILE`" \ + "$(BLOG_URL_ROOT)/`basename $$FILE .md`.html" \ + "$(BLOG_URL_ROOT)/`basename $$FILE .md`.html" \ + "$$DATE" \ + "`git log -n 1 --date="format:%Y-%m-%dT%H:%M:%SZ" --pretty=format:'%ad' -- "$$FILE"`" \ + "$$AUTHOR" \ + "`sed -n '1d;/^$$/{2{d;b};q};p' < $$FILE`"; \ + done >> $@ + printf '\n' >> $@ diff --git a/blogit.1 b/blogit.1 new file mode 100644 index 0000000..ebdaaa4 --- /dev/null +++ b/blogit.1 @@ -0,0 +1,157 @@ +.TH BLOG 1 blogit\-1.0 +.SH NAME +blogit \- a small static blog generator + +.SH SYNOPSIS +.B blogit +.RB [ init | build | deploy | clean ] + +.SH DESCRIPTION +.B blogit +is a small static blog generator, using a markdown-like syntax and git capabilities. +For example, first posted and last edited dates are extracted from git history. + +.SH GETTING STARTED +Run "blogit init" and follow the interactive configuration. +This will create the basic structure and initialize a git repository. + +.SH STRUCTURE +Articles are created in the +.B articles +directory, using a markdown-like syntax (see +.BR SYNTAX ). +HTML templates (configurable chunks of HTML code that will be used for static page generation) are stored in the +.B templates +directory, and can be edited (see +.BR TEMPLATES ). +Additional data can be stored in the +.B data +directory and will be copied at the root of the website. + +.SH WORKFLOW +The articles, templates and data can be created and edited offline. +To create a local version of the blog, run "blogit build". +It will be available in the +.B blog +directory, and the main page is index.html. +Note that only articles known to git will be created (this is to prevent unfinished articles to be published). +When its ready for publication, commit the changes to the git repository, and build the blog using "blogit build". +Then run "blogit deploy" to publish the site with +.BR rsync (1) +to the remote configured at the beginning. + +.SH SYNTAX +The first line of the article text file is its title. +The next line can be blank, and will be skipped if that case. +Then the remaining of the file is in a markdown format, with the following formatting options: +.TP +.B Sections +Sections and subsections are defined by lines starting with one or several +.RB ' # ', +each indicating a new section level. +.TP +.B Paragraphs +Paragraphs are started with a blank line. +.TP +.B Bold, italics +Chunks enclosed in stars +.RB ' * ' +are formatted in bold. +Chunks enclosed with two stars +.RB ' ** ' +are formatted in bold. +.TP +.B Images +Images are inserted using the following syntax: "![alternate text](url)". +.TP +.B Links +Links are inserted using the following syntax: "[link text](url)". +.TP +.B Comments +Lines starting with a semi-colon are comments and are ignored. +It can be used to store metadata. +In particular, comments beginning with "tags:" indicate tags and are available in the templates in the TAGS variable. +.TP +.B Code blocks +Code blocks start and end with ``` (this marker must be on its own line). +The content is not formatted, and will appear as writter in the source file. +.TP +.B +Unordered lists +Each item starts with "- ". +.TP +.B +Ordered lists +Each item starts with "1. ", "2. " and so on. +The numbers are not checked, so any number can actually be used. + +.SH TEMPLATES +Templates are small HTML code chunks that are used to build the blog pages. +Any variable reference +.RB ( $VARNAME ) +is replaced with the corresponding environment variable value. + +.SS Index page +The index page is built using the following templates: + +- header.html; + +- index_header.html; + +- tag_list_header.html; + +- tag_entry.html, for each tag; + +- tag_separator.html, between each tag; + +- tag_list_footer.html; + +- article_list_header.html; + +- article_entry.html, for each article entry; + +- article_separator.html, between each article; + +- article_list_footer.html; + +- index_footer.html; + +- footer.html. + +The TITLE variable will contain "index". +In tag_entry, the following additional variables are available: + +- URL, containing the (relative) URL of the tag index page; + +- NAME, the tag name. + +In article_entry, the following additional variables are available: + +- URL, containing the (relative) URL of the article; + +- DATE, the first publication date; + +- TITLE, the title of the article. + +.SS Article pages +Article pages are built from the following templates: + +- header.html + +- index_header.html + +- (then the article file is formatted and inserted) + +- index_footer.html + +- footer.html + +At all stages, the following variables are defined: + +- TITLE, the title of the article; + +- DATE_POSTED, the first publication date; + +- DATE_EDITED, the last edit (commit) date; + +- TAGS, the tags parsed from "tags:" comments. diff --git a/config b/config new file mode 100644 index 0000000..8a1ea43 --- /dev/null +++ b/config @@ -0,0 +1,2 @@ +BLOG_REMOTE:=web@based.quest:/var/www/based.quest/html/ +BLOG_TITLE:=based.quest diff --git a/templates/article_entry.html b/templates/article_entry.html new file mode 100644 index 0000000..317b478 --- /dev/null +++ b/templates/article_entry.html @@ -0,0 +1 @@ +
      1. $DATE $TITLE
      2. \ No newline at end of file diff --git a/templates/article_footer.html b/templates/article_footer.html new file mode 100644 index 0000000..04f5b84 --- /dev/null +++ b/templates/article_footer.html @@ -0,0 +1 @@ + diff --git a/templates/article_header.html b/templates/article_header.html new file mode 100644 index 0000000..c0557b6 --- /dev/null +++ b/templates/article_header.html @@ -0,0 +1,5 @@ + +<-- Back +
        +

        $TITLE

        +

        Posted on $DATE_POSTED

        diff --git a/templates/article_list_footer.html b/templates/article_list_footer.html new file mode 100644 index 0000000..776b4ca --- /dev/null +++ b/templates/article_list_footer.html @@ -0,0 +1 @@ +
    \ No newline at end of file diff --git a/templates/article_list_header.html b/templates/article_list_header.html new file mode 100644 index 0000000..625a9ba --- /dev/null +++ b/templates/article_list_header.html @@ -0,0 +1 @@ +
      diff --git a/templates/article_separator.html b/templates/article_separator.html new file mode 100644 index 0000000..e69de29 diff --git a/templates/footer.html b/templates/footer.html new file mode 100644 index 0000000..65228db --- /dev/null +++ b/templates/footer.html @@ -0,0 +1 @@ +

      Join us at Matrix: #based-quest:cernodile.com

      © 2021 - based.quest | Powered by blogit | Donate | Atom RSS

      diff --git a/templates/header.html b/templates/header.html new file mode 100644 index 0000000..39618d3 --- /dev/null +++ b/templates/header.html @@ -0,0 +1 @@ +$TITLE diff --git a/templates/index_footer.html b/templates/index_footer.html new file mode 100644 index 0000000..e69de29 diff --git a/templates/index_header.html b/templates/index_header.html new file mode 100644 index 0000000..9622533 --- /dev/null +++ b/templates/index_header.html @@ -0,0 +1,24 @@ + +

      > curl based.quest -v

      +

      * Trying 127.0.0.1:80...

      +

      * Connected to based.quest (127.0.0.1) port 80 (#0)

      +

      > GET / HTTP 1.1

      +

      > Host: based.quest

      +

      > User-Agent: curl/b.45.3d

      +

      > Accept */*

      +

      >

      +
      +

      < HTTP/1.1 200 OK

      +

      < Server: nginx

      +

      < Date: Right now o'clock

      +

      < Content-Type: base/based

      +

      < Last-Modified: Doesn't need to be modified, is perfect as-is.

      +

      < Connection: keep-alive

      +
      +

      based

      +
      +
      +

      Quick-links to services I host: Invidious, Searx.

      +

      Hall of Based: ReactOS, Matrix, PostmarketOS, Pine64

      +
      +

      Blog

      diff --git a/templates/tag_entry.html b/templates/tag_entry.html new file mode 100644 index 0000000..cb23fee --- /dev/null +++ b/templates/tag_entry.html @@ -0,0 +1 @@ +$NAME \ No newline at end of file diff --git a/templates/tag_index_footer.html b/templates/tag_index_footer.html new file mode 100644 index 0000000..e69de29 diff --git a/templates/tag_index_header.html b/templates/tag_index_header.html new file mode 100644 index 0000000..59bed19 --- /dev/null +++ b/templates/tag_index_header.html @@ -0,0 +1 @@ +

      $TITLE

      diff --git a/templates/tag_list_footer.html b/templates/tag_list_footer.html new file mode 100644 index 0000000..b9fa558 --- /dev/null +++ b/templates/tag_list_footer.html @@ -0,0 +1 @@ +

      \ No newline at end of file diff --git a/templates/tag_list_header.html b/templates/tag_list_header.html new file mode 100644 index 0000000..4d90b0d --- /dev/null +++ b/templates/tag_list_header.html @@ -0,0 +1 @@ +

      Tags: diff --git a/templates/tag_separator.html b/templates/tag_separator.html new file mode 100644 index 0000000..c3a6e48 --- /dev/null +++ b/templates/tag_separator.html @@ -0,0 +1 @@ +, \ No newline at end of file