commit aa04debaad78e420a81356959632876e85c4bee7
parent fba1fb15c5d2636b6a771143909768c3e90b763f
Author: Claudio Alessi <smoppy@gmail.com>
Date: Sun, 1 Jul 2018 13:26:23 +0200
[txthole] Add HTTP URL and a sample nginx configuration.
Diffstat:
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/README.md b/README.md
@@ -28,6 +28,7 @@ txthole
Store and retrieve text stream. Given the script is up and running, here's a sample usage:
$ echo Hello |nc your.host 2023
+ http://your.host/GmKwL
echo GmKwL |nc your.host 2023
$ echo GmKwL |nc your.host 2023
Hello
@@ -48,6 +49,27 @@ If it's unset then txthole will only output the code instead of the whole comman
This should be enough for most use cases.
+To serve content over HTTP, use something like this (nginx):
+
+ server {
+ root /tmp/pastes/;
+ server_name your.host;
+
+ location / {
+ rewrite ^/([-.a-zA-Z0-9]+)$ "/txthole.$1.paste" last;
+ }
+
+ location ~ /txthole\.([-.a-zA-Z0-9]+)\.paste {
+ add_header Content-Type text/plain;
+ }
+ }
+
+Take care of applying the right user/permission to the pastes directory:
+
+ $ chgrp www-data /tmp/pastes
+ $ chmod g+sr /tmp/pastes # s used to keep group
+
+
iwpick
------
Connects to a network. Authentication is not mandatory and only WPA2 is supported at the moment. It will works with no pain on any Linux system equipped with iwconfig, sdhcp and wpa_supplicant. Just run:
diff --git a/src/txthole b/src/txthole
@@ -20,6 +20,7 @@ run() {
cat "$p"
else
if [ -n "$TXTHOLE_PUBHOST" ]; then
+ echo "http://$TXTHOLE_PUBHOST/$label"
echo "echo $label | nc $TXTHOLE_PUBHOST $port"
else
echo "$label"