From 3e19d8cc319d78677f22bbe0a82e48b788eb9d99 Mon Sep 17 00:00:00 2001 From: dongdigua Date: Sun, 2 Jul 2023 15:39:43 +0800 Subject: [PATCH] top-level Makefile, stat.cgi: memory, collections --- Makefile | 14 ++++++++++++++ gmi/collections.gmi | 2 ++ gmi/docker/README.gmi | 10 +--------- gmi/docker/cgi/auth.cgi | 34 ---------------------------------- gmi/docker/cgi/stat.cgi | 7 ++++++- org/internet_collections.org | 2 +- 6 files changed, 24 insertions(+), 45 deletions(-) create mode 100644 Makefile delete mode 100755 gmi/docker/cgi/auth.cgi diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b879e31 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +all: org posts gmi + +org: + cd org && make + +posts: + pandoc posts.md --css=css/everforest.css -s -o posts.html + +gmi: + misc/mdlist2gmi.py > posts.gmi + +clean: + rm posts.html + rm posts.gmi diff --git a/gmi/collections.gmi b/gmi/collections.gmi index d84f82d..ccd37e6 100644 --- a/gmi/collections.gmi +++ b/gmi/collections.gmi @@ -50,3 +50,5 @@ undergoes frequent maintenance, PDA? => gemini://warmedal.se/~bjorn + bjorn => gemini://ploum.net/index_en.gmi + Ploum author of offpunk +=> gemini://gemini.thegonz.net + Things +=> gemini://cdg.thegonz.net/ ++ Collaborative Directory of Geminispace diff --git a/gmi/docker/README.gmi b/gmi/docker/README.gmi index 8a93bb0..53b0367 100644 --- a/gmi/docker/README.gmi +++ b/gmi/docker/README.gmi @@ -12,12 +12,4 @@ alpine linux * gmid.conf reload ## TODO -I want to write CGI script to: -* check the log -* upload dynamic file - -First I need to get my client cert hash uploaded, so I came up an idea: -upload a pgp-signed message contains: HOSTNAME:CERTHASH, then use that client cert hash - -But later I thought it makes my server too complicated. -I just need a static site server, these are bloated. +execute as normal user? diff --git a/gmi/docker/cgi/auth.cgi b/gmi/docker/cgi/auth.cgi deleted file mode 100755 index 8ade863..0000000 --- a/gmi/docker/cgi/auth.cgi +++ /dev/null @@ -1,34 +0,0 @@ -#! /usr/bin/python - -# nobody write perl right? - -from os import environ -import sys -import subprocess -import re - - -if "GEMINI_SEARCH_STRING" not in environ: - print("11 signed message",end="\r\n") - sys.exit() - -query = environ["GEMINI_SEARCH_STRING"] -host = environ["SERVER_NAME"] - -p = subprocess.Popen(["gpgv", "--keyring", "./keyring"], stdin=subprocess.PIPE) -p.communicate(input=query.encode()) - -if p.returncode != 0: - print("gpg failed") - sys.exit() - -pattern = "^{}:([0-9a-z]+)$".format(host) -line = query.splitlines()[3] -match = re.match(pattern, line) - -if match == None: - print("bad hash") - sys.exit() - -print("20 text/gemini",end="\r\n") -print(match.group(1),end="\r\n") diff --git a/gmi/docker/cgi/stat.cgi b/gmi/docker/cgi/stat.cgi index 3db7c07..75a431f 100755 --- a/gmi/docker/cgi/stat.cgi +++ b/gmi/docker/cgi/stat.cgi @@ -1,4 +1,9 @@ #! /bin/sh printf "20 text/gemini\r\n" -printf "server: $SERVER_SOFTWARE\r\nOS: $(uname -or)\r\nuptime: $(uptime)\r\n" +printf "Domain: $SERVER_NAME\r\n" +printf "Server: $SERVER_SOFTWARE\r\n" +printf "OS: $(uname -or)\r\n" +printf "Up: $(uptime)\r\n" +printf "\n" +printf "$(free -h)\r\n" diff --git a/org/internet_collections.org b/org/internet_collections.org index 17cbee2..915b6a9 100644 --- a/org/internet_collections.org +++ b/org/internet_collections.org @@ -180,7 +180,7 @@ Welcome to the darkest dungeon of kernal *** [[https://kernal.eu/posts/linuxfx/][Dumping Linuxfx customers]] :fun: A Windows-like distro including the spyware and activation ** [[https://vimacs.wehack.space/laptop/][vimacs]] -Written with Vim and Emacs. A member of Linux Club of Peking University. +Written with Vim and Emacs. A member of Linux Club of Peking University. [[https://beijinglug.club/wiki/doku.php?id=blug-canary-3][blug]] signer with cat-v-like sidebar style *** [[https://vimacs.wehack.space/Mail-vs-IM.htm][谈电子邮件和即时通讯]] **** [[https://citizenlab.ca/2016/11/wechat-china-censorship-one-app-two-systems/][微信一app两制]]