Merged v1.0.0 into feature-download-zip
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
.idea
|
.idea
|
||||||
data
|
data
|
||||||
|
tmp
|
||||||
temp
|
temp
|
||||||
node_modules
|
node_modules
|
||||||
app/node_modules
|
app/node_modules
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
scripts
|
scripts
|
||||||
docs
|
docs
|
||||||
|
_releases
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@ data
|
|||||||
temp
|
temp
|
||||||
node_modules
|
node_modules
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
_releases
|
||||||
|
|||||||
@@ -11,11 +11,11 @@
|
|||||||
Simple open source self-hosted file sharing solution.
|
Simple open source self-hosted file sharing solution.
|
||||||
|
|
||||||
* Supports many and very big files (Streams ftw)
|
* Supports many and very big files (Streams ftw)
|
||||||
* Resumable up- and downloads ([TUS](https://tus.io))
|
* Resumable up- and downloads ([tus.io](https://tus.io))
|
||||||
* Set an expire-time for your upload bucket
|
* Set an expire-time for your upload bucket
|
||||||
* One-time downloads
|
* One-time downloads
|
||||||
* Password protected downloads ([AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard))
|
* Requires Node >=7.4 or use `--harmony-async-await` flag
|
||||||
* Requires Node >=7.4
|
* Password protected download list ([AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard))
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,19 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
accessLog: 'dev'
|
accessLog: 'dev',
|
||||||
|
retentions: {
|
||||||
|
"one-time": "one time download",
|
||||||
|
10: "10 Seconds",
|
||||||
|
60: "1 Minute",
|
||||||
|
300: "5 Minutes",
|
||||||
|
3600: "1 Hour",
|
||||||
|
21600: "6 Hours",
|
||||||
|
86400: "1 Day",
|
||||||
|
259200: "3 Days",
|
||||||
|
604800: "1 Week",
|
||||||
|
1209600: "2 Weeks",
|
||||||
|
2419200: "4 Weeks",
|
||||||
|
4838400: "8 Weeks"
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module.exports = class DB {
|
|||||||
for (sid of Object.keys(this.db)) {
|
for (sid of Object.keys(this.db)) {
|
||||||
for (f of this.db[sid]) {
|
for (f of this.db[sid]) {
|
||||||
// no removal of one-time downloads
|
// no removal of one-time downloads
|
||||||
if(!Number.isInteger(f.metadata.retention)) return;
|
if(!Number.isInteger(+f.metadata.retention)) return;
|
||||||
|
|
||||||
expires = (+f.metadata.createdAt) + (+f.metadata.retention * 1000) - Date.now();
|
expires = (+f.metadata.createdAt) + (+f.metadata.retention * 1000) - Date.now();
|
||||||
if(expires <= 0) {
|
if(expires <= 0) {
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ if(config.accessLog) {
|
|||||||
app.use('/app', express.static(path.join(__dirname, '../public/app')));
|
app.use('/app', express.static(path.join(__dirname, '../public/app')));
|
||||||
app.use('/assets', express.static(path.join(__dirname, '../public/assets')));
|
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
|
// Upload App
|
||||||
app.get('/', (req, res) => {
|
app.get('/', (req, res) => {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<title>PsiTransfer</title>
|
<title>PsiTransfer</title>
|
||||||
<link href="/assets/favicon.ico" rel="icon" type="image/x-icon"/>
|
<link href="/assets/favicon.ico" rel="icon" type="image/x-icon"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta name="robots" content="noindex,nofollow">
|
||||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||||
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
|
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
|
||||||
<style>
|
<style>
|
||||||
@@ -36,7 +37,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container text-right">
|
<div class="container text-right">
|
||||||
<span class="text-muted"><a href="http://psitransfer.psi.cx" target="_blank">Powered by PsiTransfer</a></span>
|
<span class="text-muted"><a href="https://github.com/psi-4ward/psitransfer" target="_blank">Powered by PsiTransfer</a></span>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="/app/common.js"></script>
|
<script src="/app/common.js"></script>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<title>PsiTransfer</title>
|
<title>PsiTransfer</title>
|
||||||
<link href="/assets/favicon.ico" rel="icon" type="image/x-icon"/>
|
<link href="/assets/favicon.ico" rel="icon" type="image/x-icon"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta name="robots" content="noindex,nofollow">
|
||||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||||
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
|
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
|
||||||
<style>
|
<style>
|
||||||
@@ -44,7 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container text-right">
|
<div class="container text-right">
|
||||||
<span class="text-muted"><a href="http://psitransfer.psi.cx" target="_blank">Powered by PsiTransfer</a></span>
|
<span class="text-muted"><a href="https://github.com/psi-4ward/psitransfer" target="_blank">Powered by PsiTransfer</a></span>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<title>PsiTransfer</title>
|
<title>PsiTransfer</title>
|
||||||
<link href="/assets/favicon.ico" rel="icon" type="image/x-icon"/>
|
<link href="/assets/favicon.ico" rel="icon" type="image/x-icon"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta name="robots" content="noindex,nofollow">
|
||||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||||
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
|
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
|
||||||
<style>
|
<style>
|
||||||
@@ -60,7 +61,7 @@
|
|||||||
|
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container text-right">
|
<div class="container text-right">
|
||||||
<span class="text-muted"><a href="http://psitransfer.psi.cx" target="_blank">Powered by PsiTransfer</a></span>
|
<span class="text-muted"><a href="https://github.com/psi-4ward/psitransfer" target="_blank">Powered by PsiTransfer</a></span>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="/app/common.js"></script>
|
<script src="/app/common.js"></script>
|
||||||
|
|||||||
2
public/robots.txt
Normal file
2
public/robots.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
User-agent: *
|
||||||
|
Disallow: /
|
||||||
32
scripts/create-bundle.sh
Executable file
32
scripts/create-bundle.sh
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
cd $DIR
|
||||||
|
|
||||||
|
# Get the current tag or use commit hash if there's none
|
||||||
|
NAME=$(git describe --exact-match --tags $(git log -n1 --pretty='%h') 2>/dev/null || git log -n1 --pretty='%h')
|
||||||
|
|
||||||
|
echo "Building app"
|
||||||
|
cd $DIR/../app
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
|
||||||
|
echo "Bundling to _releases/psitransfer-$NAME.tar.gz"
|
||||||
|
cd $DIR/..
|
||||||
|
mkdir -p _releases
|
||||||
|
|
||||||
|
tar -czf _releases/psitransfer-$NAME.tar.gz --transform "s~^~psitransfer-$NAME/~" \
|
||||||
|
LICENSE \
|
||||||
|
README.md \
|
||||||
|
Dockerfile \
|
||||||
|
.dockerignore \
|
||||||
|
app.js \
|
||||||
|
config.js \
|
||||||
|
package.json \
|
||||||
|
docs \
|
||||||
|
lib \
|
||||||
|
public
|
||||||
|
|
||||||
|
echo "DONE"
|
||||||
43
scripts/traffic-limit.sh
Executable file
43
scripts/traffic-limit.sh
Executable file
@@ -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
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# tar -czf psitransfer-1.0.0-rc.1.tar.gz --transform 's~^~psitransfer-1.0.0-rc.1/~' LICENSE README.md app.js config.* data lib package.json public
|
|
||||||
@@ -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
|
|
||||||
Reference in New Issue
Block a user