From 3e31051f546a4f060978a7d5675db4b4011ad092 Mon Sep 17 00:00:00 2001 From: Christoph Wiechert Date: Tue, 25 Apr 2017 21:53:09 +0200 Subject: [PATCH 1/7] Fixed: Powered by link href --- public/html/download.html | 2 +- public/html/error.html | 2 +- public/html/upload.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/html/download.html b/public/html/download.html index 51fe7e0..08fe374 100644 --- a/public/html/download.html +++ b/public/html/download.html @@ -36,7 +36,7 @@ diff --git a/public/html/error.html b/public/html/error.html index 07c9244..999db34 100644 --- a/public/html/error.html +++ b/public/html/error.html @@ -44,7 +44,7 @@ diff --git a/public/html/upload.html b/public/html/upload.html index d39d0bd..e4a0f0f 100644 --- a/public/html/upload.html +++ b/public/html/upload.html @@ -60,7 +60,7 @@ From 2b79d0b337e54036e5e51c67bc30c51b92c1c5f8 Mon Sep 17 00:00:00 2001 From: Christoph Wiechert Date: Tue, 25 Apr 2017 21:54:10 +0200 Subject: [PATCH 2/7] Readme and traffic-limit.sh improvements --- README.md | 10 +++++++-- scripts/traffic-limit.sh | 43 ++++++++++++++++++++++++++++++++++++ tmp/scripts/traffic-limit.sh | 18 --------------- 3 files changed, 51 insertions(+), 20 deletions(-) create mode 100755 scripts/traffic-limit.sh delete mode 100755 tmp/scripts/traffic-limit.sh diff --git a/README.md b/README.md index 963cbe1..ba30535 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ Simple open source self-hosted file sharing solution. * Resumable up- and downloads ([TUS](https://tus.io)) * Set an expire-time for your upload bucket * One-time downloads -* Password protected downloads ([AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)) -* Requires Node >=7.4 +* Requires Node >=7.4 or use `--harmony-async-await` flag +* Password protected download list ([AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)) ![Screenshot](https://raw.githubusercontent.com/psi-4ward/psitransfer/master/docs/psitransfer.gif) @@ -84,6 +84,12 @@ Psitransfer uses [debug](https://github.com/visionmedia/debug): DEBUG=psitransfer:* npm start ``` +## Side notes + +* There is no (end-to-end) payload encryption (yet). + +:star2: Contribution is highly welcome :metal: + ## License [BSD](LICENSE) diff --git a/scripts/traffic-limit.sh b/scripts/traffic-limit.sh new file mode 100755 index 0000000..630750c --- /dev/null +++ b/scripts/traffic-limit.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -e + +# Helper script to limit traffic for iface:port +# http://www.codeoriented.com/how-to-limit-network-bandwidth-for-a-specific-tcp-port-on-ubuntu-linux/ +# https://wiki.archlinux.org/index.php/Advanced_traffic_control + +if ! which tc &>/dev/null ; then + 2>&1 echo Error: tc executable not found + 2>&1 echo Please install iproute2 package + exit 1 +fi + +IFACE=$1 +RATE=$3 +PORT=$2 + +if [ -z "$3" ] ; then + echo "Traffic limitter" + echo "Usage: $0 IFACE PORT RATE" + echo + echo "Available interfaces: $(ls -m /sys/class/net)" + echo + echo "Rate units: " + echo " kbps: Kilobytes per Second" + echo " mbps: Megabytes per Second" + echo " gbps: Gigabytes per Second" + echo " off: No rate limit" + echo + echo "Examples:" + echo " $0 wlan0 8080 10kbps" + echo " $0 wlan0 8080 off" + exit 1 +fi + +sudo tc qdisc del root dev $IFACE &>/dev/null || true + +[ "$RATE" = "off" ] && exit + +sudo tc qdisc add dev $IFACE root handle 1:0 htb default 10 +sudo tc class add dev $IFACE parent 1:0 classid 1:10 htb rate $RATE prio 0 +sudo tc filter add dev $IFACE parent 1:0 prio 0 protocol ip u32 match ip protocol 4 0xff match ip dport $PORT 0xffff flowid 1:10 +sudo tc qdisc show dev $IFACE diff --git a/tmp/scripts/traffic-limit.sh b/tmp/scripts/traffic-limit.sh deleted file mode 100755 index bad00b9..0000000 --- a/tmp/scripts/traffic-limit.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# http://www.codeoriented.com/how-to-limit-network-bandwidth-for-a-specific-tcp-port-on-ubuntu-linux/ - -IF=$2 -BAND=$1 -PORT=$3 - -if [ -z "$3" ] ; then - echo $0 10kbps wlan0 8080 - exit 1 -fi - -tc qdisc del root dev $IF -tc qdisc add dev $IF root handle 1:0 htb default 10 -tc class add dev $IF parent 1:0 classid 1:10 htb rate $BAND prio 0 -tc filter add dev $IF parent 1:0 prio 0 protocol ip u32 match ip protocol 4 0xff match ip dport $PORT 0xffff flowid 1:10 -tc qdisc show dev $IF From 24a2c748cd48d3033fe602f7d5f3764a3bf533c3 Mon Sep 17 00:00:00 2001 From: Christoph Wiechert Date: Fri, 5 May 2017 20:57:20 +0200 Subject: [PATCH 3/7] Added: meta-tags and robots.txt to prevent search engine indexing --- lib/endpoints.js | 4 ++++ public/html/download.html | 1 + public/html/error.html | 1 + public/html/upload.html | 1 + public/robots.txt | 2 ++ 5 files changed, 9 insertions(+) create mode 100644 public/robots.txt diff --git a/lib/endpoints.js b/lib/endpoints.js index 734f17a..f618729 100644 --- a/lib/endpoints.js +++ b/lib/endpoints.js @@ -31,6 +31,10 @@ if(config.accessLog) { app.use('/app', express.static(path.join(__dirname, '../public/app'))); app.use('/assets', express.static(path.join(__dirname, '../public/assets'))); +// robots.txt +app.get('/robots.txt', (req, res) => { + res.sendFile(path.join(__dirname, '../public/robots.txt')); +}); // Upload App app.get('/', (req, res) => { diff --git a/public/html/download.html b/public/html/download.html index 08fe374..a6b8321 100644 --- a/public/html/download.html +++ b/public/html/download.html @@ -5,6 +5,7 @@ PsiTransfer +