diff --git a/bin/backup b/bin/backup index 7aadfcd..a723916 100755 --- a/bin/backup +++ b/bin/backup @@ -3,6 +3,8 @@ rsync -avzh --delete --include=".description" --exclude=".*" /var/gopher/ /var/cosmic-backup/gopher/ rsync -avzh --delete --exclude=".*" /var/wiki/ /var/cosmic-backup/wiki/ cd /var/cosmic-backup || exit +rm ./gopher/rss.xml # skip archival of rss feed +rm ./gopher/atom.xml # skip archival of atom feed git add . git commit -m "backup" git push origin master diff --git a/bin/gemini b/bin/gemini index b4c6b4a..9871245 100755 --- a/bin/gemini +++ b/bin/gemini @@ -12,16 +12,16 @@ if [ "$run_user" = "gemini" ]; then # generate index pages # curl -s gopher://localhost | /var/cosmic/awk/gophermap2gemini.awk > /var/gemini/index.gmi cp /var/cosmic/templates/geminiintro.tmpl /var/gemini/index.gmi - curl -s gopher://localhost/1/listing.gophermap | head -n 20 | /var/cosmic/awk/gophermap2gemini.awk >> /var/gemini/index.gmi - curl -s gopher://localhost/1/log | /var/cosmic/awk/gophermap2gemini.awk > /var/gemini/log/index.gmi - curl -s gopher://localhost/1/ships | /var/cosmic/awk/gophermap2gemini.awk > /var/gemini/ships/index.gmi + curl -s -N gopher://localhost/1/listing.gophermap | head -n 20 | /var/cosmic/awk/gophermap2gemini.awk >> /var/gemini/index.gmi + curl -s -N gopher://localhost/1/log | /var/cosmic/awk/gophermap2gemini.awk > /var/gemini/log/index.gmi + curl -s -N gopher://localhost/1/ships | /var/cosmic/awk/gophermap2gemini.awk > /var/gemini/ships/index.gmi sed 's?gopher://cosmic.voyage/0/?gemini://cosmic.voyage/?' /var/gopher/rss.xml | sed 's?gopher://cosmic.voyage?gemini://cosmic.voyage?' > /var/gemini/rss.xml sed 's?gopher://cosmic.voyage/0/?gemini://cosmic.voyage/?' /var/gopher/atom.xml | sed 's?gopher://cosmic.voyage?gemini://cosmic.voyage?' > /var/gemini/atom.xml # create ship directories find "/var/gopher/" -maxdepth 1 ! -path "/var/gopher/" ! -path "/var/gopher/ships" ! -path "/var/gopher/log" -type d | sed 's|/var/gopher/||' | sort | while read -r ship do - curl -s "gopher://localhost/1/ships/${ship}" | /var/cosmic/awk/gophermap2gemini.awk > "/var/gemini/ships/${ship}/index.gmi" + curl -s -N "gopher://localhost/1/ships/${ship}" | /var/cosmic/awk/gophermap2gemini.awk > "/var/gemini/ships/${ship}/index.gmi" done # Let user's know it's done printf "Gemini and gemini feeds rebuilt successfully.\\n" diff --git a/bin/web b/bin/web index 5f7441a..b029b8b 100755 --- a/bin/web +++ b/bin/web @@ -27,7 +27,6 @@ entry_index () { { printf " %s\\n" "$title" printf " \\n" "$loghtml" - cat "$web_styles_html" printf "\\n\\n
\\n"
     printf "<< BACK TO RELAY ONE LOG\\n\\n\\n"
     sed 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g' "${gopher_dir}${log}"
@@ -47,7 +46,6 @@ if [ "$run_user" = "root" ] || [ "$run_user" = "publish" ]; then
   root_index_html="${temp_dir}/index.html"
   log_html="${temp_dir}/log/index.html"
   web_header_html="/etc/templates/webheader.tmpl"
-  web_styles_html="/etc/templates/webstyles.tmpl"
   ships_html="${temp_dir}/ships/index.html"
   error_html="${temp_dir}/error.html"
   join_html="${temp_dir}/join.html"
@@ -74,10 +72,9 @@ if [ "$run_user" = "root" ] || [ "$run_user" = "publish" ]; then
     printf ""
     printf ""
     printf ""
-    cat "$web_styles_html"
     printf ""
     printf ""
-    printf "a link to our mastodon account, to verify it as legitimate"
+    printf "a link to our mastodon account, to verify it as legitimate"
     printf "
" printf "
"
     # Intro text
@@ -102,7 +99,6 @@ if [ "$run_user" = "root" ] || [ "$run_user" = "publish" ]; then
     {
       printf "Cosmic Voyage - Transmission Log"
       printf ""
-      cat "$web_styles_html"
       printf ""
       printf ""
       printf "
" @@ -165,7 +161,6 @@ if [ "$run_user" = "root" ] || [ "$run_user" = "publish" ]; then { printf "Cosmic Voyage - Ships" printf "" - cat "$web_styles_html" printf "" printf "" printf "
" @@ -195,7 +190,6 @@ if [ "$run_user" = "root" ] || [ "$run_user" = "publish" ]; then { printf "Cosmic Voyage - %s" "$ship" printf "" "$ship" - cat "$web_styles_html" printf "" printf "" printf "
" @@ -218,7 +212,6 @@ if [ "$run_user" = "root" ] || [ "$run_user" = "publish" ]; then { printf "Cosmic Voyage - About %s" "${ship}" printf "" "${ship}" - cat "$web_styles_html" printf "" printf "" printf "
" @@ -245,7 +238,6 @@ if [ "$run_user" = "root" ] || [ "$run_user" = "publish" ]; then { printf "Cosmic Voyage - \"%s\" Author" "${ship}" printf "" "${ship}" - cat "$web_styles_html" printf "" printf "" printf "
" @@ -281,7 +273,6 @@ if [ "$run_user" = "root" ] || [ "$run_user" = "publish" ]; then # Print error page cat "$web_header_html" > "${error_html}" { - cat "$web_styles_html" printf "
<< BACK TO RELAY ONE"
     printf "\\n\\n\\nERROR. TRANSMISSION NOT FOUND.
" } >> "${error_html}" @@ -291,7 +282,6 @@ if [ "$run_user" = "root" ] || [ "$run_user" = "publish" ]; then { printf "Cosmic Voyage - How to Join" printf "" - cat "$web_styles_html" printf "" printf "" printf "
" @@ -308,6 +298,8 @@ if [ "$run_user" = "root" ] || [ "$run_user" = "publish" ]; then install -m 775 -o publish -g publish "/var/cosmic/files/cosmicbanner.png" "${temp_dir}" install -m 775 -o publish -g publish "/var/cosmic/files/inconsolata-regular-webfont.woff" "${temp_dir}" install -m 775 -o publish -g publish "/var/cosmic/files/inconsolata-regular-webfont.woff2" "${temp_dir}" + install -m 775 -o publish -g publish "/var/cosmic/files/styles.css" "${temp_dir}" + install -m 775 -o publish -g publish "/var/cosmic/files/scripts.js" "${temp_dir}" # generate tilde.json userlist=$(voyagers | awk '{print "{\"username\":\"" $0 "\"}," }') diff --git a/files/scripts.js b/files/scripts.js new file mode 100644 index 0000000..ab2945f --- /dev/null +++ b/files/scripts.js @@ -0,0 +1,31 @@ +// I'm sorry you have to see JavaScript on this site, but it's here to +// enable a manual dark mode toggle. When dark mode support improves I +// can probably remove this again. +function setMode(mode, val) { + if (val) document.body.classList.add(mode) + else document.body.classList.remove(mode) + Array.from(document.querySelectorAll('a')) + .filter( el => el.href.indexOf('cosmic.voyage') !== -1) + .map( el => { + var url = el.href + var p = url.indexOf('?') !== -1 ? url.substr(url.indexOf('?')) : '' + var baseURL = url.split('?')[0] + const params = new URLSearchParams(p) + if (val) { + params.append(mode, 1) + } else { + params.delete(mode) + } + p = params.toString() + el.href = baseURL + (p ? '?' + p : '') + }) +} + +window.addEventListener('DOMContentLoaded', function() { + var params = new URLSearchParams(window.location.search) + if (params.has('dark')) { + setMode('dark', true) + } else if (params.has('light')) { + setMode('light', true) + } +}) diff --git a/files/styles.css b/files/styles.css new file mode 100644 index 0000000..bf2e8b6 --- /dev/null +++ b/files/styles.css @@ -0,0 +1,141 @@ +@font-face { + font-family: 'inconsolata'; + src: url('/inconsolata-regular-webfont.woff2') format('woff2'), + url('/inconsolata-regular-webfont.woff') format('woff'); + font-weight: normal; + font-style: normal; + font-display: swap; +} + +html { + margin: 0; + padding: 0; +} + +body { + color: #333; + background-color: #f2f4f4; + background-repeat: repeat; +} + +a, +a:visited, +a:hover, +a:active { + color: rgb(62, 231, 123); + text-decoration: none; +} +a:hover { + text-decoration: underline; +} + +.dim { + color: rgb(62, 231, 123, 0.5); +} + +.mastodon { + display: none; +} + +@media (prefers-color-scheme: dark) { + body { + color: rgb(50, 200, 100); + background-color: #010; + background-image: none; + } + + a, + a:visited, + a:hover, + a:active { + color: rgb(62, 231, 123); + } + + .dim { + color: rgb(62, 231, 123, 0.5); + } +} + +@media (prefers-color-scheme: light) { + body { + color: #333; + background-color: #f2f4f4; + background-repeat: repeat; + } + + a, + a:visited, + a:hover, + a:active { + color: #333; + font-weight: bold; + } + + .dim { + color: rgba(30, 30, 30, 0.5); + } +} + +/* Manually toggled dark class on body */ +body.dark { + color: rgb(50, 200, 100); + background-color: #010; + background-image: none; +} +.dark a, +.dark a:visited, +.dark a:hover, +.dark a:active { + color: rgb(62, 231, 123); +} +.dark .dim { + color: rgb(62, 231, 123, 0.5); +} + +/* Manually toggled light class on body */ +body.light { + color: #333; + background-color: #f2f4f4; + background-repeat: repeat; +} + +.light a, +.light a:visited, +.light a:hover, +.light a:active { + color: #333; + font-weight: bold; +} + +.light .dim { + color: rgba(30, 30, 30, 0.5); +} + +.page-wrapper { + text-align: center; +} + +.inner-wrapper { + display: inline-block; + text-align: left; + white-space: pre; + font-family: 'inconsolata', monospace; + margin: 0 auto; + width: auto; +} + +ol { + padding: 0; + line-height: 0.5em; +} + +@media screen and (min-width: 700px) { + body, html { + font-size: 18px; + } +} +@media screen and (min-width: 900px) { + body, html { + font-size: 24px; + } +} diff --git a/postfix/access b/postfix/access index d804ec2..4a5065d 100644 --- a/postfix/access +++ b/postfix/access @@ -5,6 +5,7 @@ cosmic.voyage permit_auth_destination .thunix.cf permit_auth_destination .thunix.net permit_auth_destination .tildeverse.org permit_auth_destination +hmm.st permit_auth_destination aussies.space permit_auth_destination circumlunar.space permit_auth_destination ctrl-c.club permit_auth_destination diff --git a/postfix/transport b/postfix/transport index e5f68e6..85deef4 100644 --- a/postfix/transport +++ b/postfix/transport @@ -5,6 +5,7 @@ cosmic.voyage : .thunix.cf smtp .thunix.net smtp .tildeverse.org smtp +hmm.st smtp aussies.space smtp circumlunar.space smtp ctrl-c.club smtp diff --git a/templates/webheader.tmpl b/templates/webheader.tmpl index 80e3776..218d61d 100644 --- a/templates/webheader.tmpl +++ b/templates/webheader.tmpl @@ -11,36 +11,5 @@ - - + + diff --git a/templates/webstyles.tmpl b/templates/webstyles.tmpl deleted file mode 100644 index 516033e..0000000 --- a/templates/webstyles.tmpl +++ /dev/null @@ -1,140 +0,0 @@ - -