Compare commits
2 commits
a27b25182b
...
962a06fa70
Author | SHA1 | Date | |
---|---|---|---|
962a06fa70 | |||
cdf6957c1e |
18
README.md
18
README.md
|
@ -0,0 +1,18 @@
|
|||
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
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#!/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
|
||||
if header.get("type") == "txt":
|
||||
file_name = write_text(data, title=header.get("title"))
|
||||
elif header.get("type") == "html":
|
||||
elif header.get("type") == "raw":
|
||||
file_name = write_content(data)
|
||||
else:
|
||||
print("Unknown type.")
|
||||
|
|
Reference in a new issue