Compare commits
9 Commits
0f2e5feb92
...
compressio
Author | SHA1 | Date | |
---|---|---|---|
3244a017c6
|
|||
6b1c6de309
|
|||
978ae8fd03
|
|||
fe6f79d651
|
|||
0875e512a2
|
|||
6fcfa782b9 | |||
f7e4903bd6 | |||
63549e06a0 | |||
5036e6791f |
@ -1,26 +1,38 @@
|
||||
(import hyrule.collections [assoc])
|
||||
(import isal.igzip [compress :as gzip])
|
||||
(import isal.isal_zlib [compress :as zstd])
|
||||
|
||||
(defn send-code [code]
|
||||
(import hyrule.collections [assoc])
|
||||
(require hyrule.control [branch])
|
||||
|
||||
(defn pack-code [code]
|
||||
(.encode f"HTTP/1.1 {code}\r\n" "utf-8"))
|
||||
|
||||
(defn send-headers [headers]
|
||||
(defn pack-headers [headers]
|
||||
(.encode (+ (.join "\r\n" (lfor [k v] (.items headers) f"{k}: {v}")) "\r\n\r\n") "utf-8"))
|
||||
|
||||
(defn send-body [body]
|
||||
(cond
|
||||
(defn send [[code 200] [headers None] [body ""] [request-headers None]]
|
||||
(when (is headers None)
|
||||
(setv headers {}))
|
||||
|
||||
(setv body (cond
|
||||
(isinstance body bytes) body
|
||||
(isinstance body str) (.encode body "utf-8")))
|
||||
|
||||
(defn send [[code 200] [headers None] [body ""]]
|
||||
(when (is headers None)
|
||||
(setv headers {}))
|
||||
(when request-headers
|
||||
(when (.get request-headers "Accept-Encoding")
|
||||
(branch (in it (.get request-headers "Accept-Encoding"))
|
||||
"zstd" (do
|
||||
(setv (get headers "Accept-Encoding") "gzip")
|
||||
(setv body (zstd body)))
|
||||
"gzip" (do
|
||||
(setv (get headers "Accept-Encoding") "gzip")
|
||||
(setv body (gzip body))))))
|
||||
|
||||
(assoc headers "WHAT...-your-trans-gener..." "that is so cool...")
|
||||
|
||||
(when (not-in "Content-Type" headers)
|
||||
(assoc headers "Content-Type" "text/html"))
|
||||
|
||||
(+
|
||||
(send-code code)
|
||||
(send-headers headers)
|
||||
(send-body body)))
|
||||
(pack-code code)
|
||||
(pack-headers headers)
|
||||
body))
|
||||
|
@ -39,7 +39,7 @@
|
||||
True (get address 0))) f": {(. parsed-request (get "method"))} {(. parsed-request (get "route") (get "path"))}"))
|
||||
|
||||
(setv response (match-request parsed-request))
|
||||
(.sendall client-socket (http.response.send #** response))
|
||||
(.sendall client-socket (http.response.send :request-headers (.get parsed-request "headers") #** response))
|
||||
|
||||
(except [e Exception]
|
||||
(.warn log (format-exc))
|
||||
|
BIN
www/src/assets/88x31/it-its.png
Normal file
BIN
www/src/assets/88x31/it-its.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
www/src/assets/88x31/not-a-person.png
Normal file
BIN
www/src/assets/88x31/not-a-person.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 900 B |
BIN
www/src/assets/88x31/this-machine-kills-fascists.png
Normal file
BIN
www/src/assets/88x31/this-machine-kills-fascists.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -64,5 +64,5 @@
|
||||
:locals local-scope
|
||||
:globals global-scope)))))
|
||||
|
||||
(print f"{(.replace path #[[./pages/]] #[[./output/]])} more recent, skipping")))))
|
||||
(print f"{(.replace path #[[./pages/]] #[[../site/html/]])} more recent, skipping")))))
|
||||
|
||||
|
@ -64,10 +64,24 @@ specific:
|
||||
src: //tasiaiso.vulpecula.zone/images/badges/tasiaiso.png
|
||||
alt: tasia's 88x31
|
||||
|
||||
# does not 301 to https if requested with http
|
||||
- host: //www.31a05b.net/
|
||||
src: https://www.31a05b.net/a/8831/31a05b.png
|
||||
alt: 31A05B9C's random site
|
||||
|
||||
- host: //bunbun.dev/
|
||||
src: //bunbun.dev/assets/88x31s/bunbun.dev.gif
|
||||
alt: bunbun.dev
|
||||
|
||||
general:
|
||||
- src: assets/88x31/e2vial-88x31.gif
|
||||
alt: an estrogen vial spinning next to the text "powered by estrogen"
|
||||
|
||||
- src: assets/88x31/it-its.png
|
||||
alt: it/its
|
||||
|
||||
- src: assets/88x31/not-a-person.png
|
||||
alt: not a person
|
||||
|
||||
- src: assets/88x31/this-machine-kills-fascists.png
|
||||
alt: this machine kills fascists
|
||||
|
@ -15,7 +15,7 @@
|
||||
(h2 "site info" ~(run "make-footnote \"as of last build\""))
|
||||
(details
|
||||
(summary "git changelog")
|
||||
(pre ~(run "git log --pretty=format:'%ad %s' --date=short")))
|
||||
(pre ~(run #[[git log --pretty=format:'%ad %s' --date=short | sed 's/</\</g; s/>/\>/g']])))
|
||||
|
||||
(details
|
||||
(summary "file tree of the site on the server")
|
||||
|
@ -7,7 +7,7 @@
|
||||
(p #[[
|
||||
recently, dollcode has become a thing frquently utilized by both this one's friends and other beings it observes.
|
||||
this is inconvenient, because many of them have written their own transcoders for the format, which can handle arbitrarily large numbers.
|
||||
at time of writing, the only two translators it has found (]] ~(link "https://noe.sh/dollcode") #[[, ]] ~(link "https://999eagle.moe/dollcode") #[[)
|
||||
at time of writing, the only two translators it has found (]] ~(link "https://noe.sh/dollcode") ", " ~(link "https://999eagle.moe/dollcode") #[[)
|
||||
do not support nubbers larger than 64 bit integers. thusly, it can read few of its friends encoded strings.]])
|
||||
|
||||
(p #[[
|
||||
@ -55,5 +55,4 @@
|
||||
(code (pre
|
||||
~(run "cat data/thoughts/dollcode/dollcode-invocation-time")))
|
||||
|
||||
(footnote "this post was rewritten on 2025-05-12, as part of the migration to the new website. the wording has been updated, however it remains similar to the original.")
|
||||
(br)))
|
||||
(footnote "this post was rewritten on 2025-05-12, as part of the migration to the new website. the wording has been updated, however it remains similar to the original.")))
|
||||
|
@ -113,5 +113,4 @@
|
||||
~(run "syntax-hl data/thoughts/python-goto/evil-fizzbuzz.py")))
|
||||
(br)
|
||||
|
||||
(footnote "this post was rewritten on 2025-05-12, as part of the migration to the new website. the wording has been updated, however it remains similar to the original.")
|
||||
(br)))
|
||||
(footnote "this post was rewritten on 2025-05-12, as part of the migration to the new website. the wording has been updated, however it remains similar to the original.")))
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
`(
|
||||
~content
|
||||
(br)
|
||||
~(run "put-footnotes")
|
||||
~(comments f"/html/thought/view-thought.html?thought={(get page-name -1)}")))
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
tmpfile=$(mktemp)
|
||||
|
||||
timeout 0.6s nvim "$1" -c "set nonu | set nornu" -c "autocmd LspAttach * execute 'TOhtml | w! ${tmpfile} | qa!'" >/dev/null || nvim "$1" -c "set nonu | set nornu" -c "TOhtml | w! ${tmpfile} | qa!" >/dev/null
|
||||
timeout 0.6s nvim "$1" -c "set noswapfile" -c "%s/^$/ /g" -c "set conceallevel=0" -c "set nonu | set nornu" -c "autocmd LspAttach * execute 'TOhtml | w! ${tmpfile} | qa!'" >/dev/null || nvim "$1" -c "set noswapfile" -c "%s/^$/ /" -c "set conceallevel=0" -c "set nonu | set nornu" -c "TOhtml | w! ${tmpfile} | qa!" >/dev/null
|
||||
|
||||
cat "${tmpfile}" | pup --pre 'style, pre' | sed '/^$/d'
|
||||
|
||||
|
Reference in New Issue
Block a user