Compare commits
No commits in common. "962a06fa700f09c3d1c0d0c3ea1647e531c5a582" and "a27b25182b659a1ce4c1ffef2f22720ed8eeaa94" have entirely different histories.
962a06fa70
...
a27b25182b
18
README.md
18
README.md
|
@ -1,18 +0,0 @@
|
||||||
Shrlok
|
|
||||||
======
|
|
||||||
|
|
||||||
Publish stuff on the Web by piping it to a Unix domain socket (WIP).
|
|
||||||
|
|
||||||
Shrlok listens in the background on a Unix socket for a small header followed by
|
|
||||||
data and pushes this data in a directory with some basic treatment. For example,
|
|
||||||
text pushed to Shrlok is put into a `pre` tag of an HTML page.
|
|
||||||
|
|
||||||
The current expected format is described at the top of the `shrlok.py` module.
|
|
||||||
|
|
||||||
Supported types:
|
|
||||||
|
|
||||||
- `txt`: put into a `pre` tag in an HTML page;
|
|
||||||
- `raw`: put as is.
|
|
||||||
|
|
||||||
Example: TODO
|
|
||||||
|
|
6
shr-txt.sh
Executable file
6
shr-txt.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Share a text file to shrlok.
|
||||||
|
cat <(printf '{"type":"txt"}\0') "$1" \
|
||||||
|
| socat - UNIX-CONNECT:/run/shrlok/shr.sock \
|
||||||
|
| sed 's|/var/www/files|https://files.dece.space|' \
|
||||||
|
; echo
|
|
@ -67,7 +67,7 @@ class Handler(socketserver.StreamRequestHandler):
|
||||||
file_name = None
|
file_name = None
|
||||||
if header.get("type") == "txt":
|
if header.get("type") == "txt":
|
||||||
file_name = write_text(data, title=header.get("title"))
|
file_name = write_text(data, title=header.get("title"))
|
||||||
elif header.get("type") == "raw":
|
elif header.get("type") == "html":
|
||||||
file_name = write_content(data)
|
file_name = write_content(data)
|
||||||
else:
|
else:
|
||||||
print("Unknown type.")
|
print("Unknown type.")
|
||||||
|
|
Reference in a new issue