refined autoremove support
This commit is contained in:
22
README.md
22
README.md
@@ -1,6 +1,6 @@
|
|||||||
# FLEES
|
# FLEES
|
||||||
|
|
||||||
A very small file sharing website.
|
A small file sharing website.
|
||||||
|
|
||||||
The name comes from mispronouncing "files" very badly.
|
The name comes from mispronouncing "files" very badly.
|
||||||
|
|
||||||
@@ -16,14 +16,15 @@ The name comes from mispronouncing "files" very badly.
|
|||||||
|
|
||||||
- generate and manage shares with `code/flees-manager.py`
|
- generate and manage shares with `code/flees-manager.py`
|
||||||
- configure service with data/config.json
|
- configure service with data/config.json
|
||||||
- Change your app_secret_key !!
|
- Change your `app_secret_key` !!
|
||||||
- Change your public_url
|
- Change your `public_url`
|
||||||
- uid = user id for new files
|
- Change your `timezone`
|
||||||
- workers = parallel processes (i.e. one upload reserves a process)
|
- `uid` = user id for new files
|
||||||
- timeout = timeout for processes, single upload might take a long time!
|
- `workers` = parallel processes (i.e. one upload reserves a process)
|
||||||
- max_zip_size = zipping a share with more data is not allowed
|
- `timeout` = timeout for processes, single upload might take a long time!
|
||||||
|
- `max_zip_size` = zipping a share with more data is not allowed
|
||||||
- configure bind host and port in .env
|
- configure bind host and port in .env
|
||||||
- proxy with nginx, match body size and timeout to your needs:
|
- proxy with nginx, match bind port, body size and timeout to your needs:
|
||||||
```
|
```
|
||||||
location /flees/ {
|
location /flees/ {
|
||||||
proxy_pass http://localhost:8136/;
|
proxy_pass http://localhost:8136/;
|
||||||
@@ -36,7 +37,6 @@ location /flees/ {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- configure local port in `docker-compose.yaml`
|
|
||||||
- change website colors in code/static/css/colors.css
|
- change website colors in code/static/css/colors.css
|
||||||
|
|
||||||
- Check `flees-manager.py rest` command to get direct links to various
|
- Check `flees-manager.py rest` command to get direct links to various
|
||||||
@@ -96,11 +96,13 @@ Operation is one of download, direct_download, zip_download, or upload
|
|||||||
- @app.route('/files/<name>/<token>', methods=['GET'])
|
- @app.route('/files/<name>/<token>', methods=['GET'])
|
||||||
Return plain text list of files in the share
|
Return plain text list of files in the share
|
||||||
- @app.route('/list/<name>/<token>', methods=['GET'])
|
- @app.route('/list/<name>/<token>', methods=['GET'])
|
||||||
Login to a share with a token
|
List share contents for the browser
|
||||||
- @app.route('/list/<name>', methods=['GET'])
|
- @app.route('/list/<name>', methods=['GET'])
|
||||||
List share contents for the browser
|
List share contents for the browser
|
||||||
- @app.route('/logout/<name>', methods=['GET'])
|
- @app.route('/logout/<name>', methods=['GET'])
|
||||||
Logout from share. Only for browser.
|
Logout from share. Only for browser.
|
||||||
|
- @app.route('/ls/<name>/<token>', methods=['GET'])
|
||||||
|
List share contents for the console client
|
||||||
- @app.route('/direct/<name>/<token>/<filename>', methods=['GET'])
|
- @app.route('/direct/<name>/<token>/<filename>', methods=['GET'])
|
||||||
Download a file using the filename token (if direct download enabled)
|
Download a file using the filename token (if direct download enabled)
|
||||||
- @app.route('/download/<name>/<token>/<filename>', methods=['GET'])
|
- @app.route('/download/<name>/<token>/<filename>', methods=['GET'])
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
FROM alpine:3.5
|
FROM alpine:3.5
|
||||||
RUN apk add --update \
|
RUN apk add --update \
|
||||||
|
tzdata \
|
||||||
python3 \
|
python3 \
|
||||||
python3-dev \
|
python3-dev \
|
||||||
py3-pip \
|
py3-pip \
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ from utils.utils import *
|
|||||||
from utils.crypt import *
|
from utils.crypt import *
|
||||||
|
|
||||||
|
|
||||||
__FLEES_VERSION__ = "20181104.0"
|
__FLEES_VERSION__ = "20181118.0"
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config.from_object(__name__)
|
app.config.from_object(__name__)
|
||||||
config_values = read_config(app)
|
config_values = read_config(app)
|
||||||
|
|||||||
@@ -1,11 +1,34 @@
|
|||||||
import subprocess,json
|
import json
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
config = json.load(open('data/config.json','rt'))
|
config = json.load(open(os.environ['FLEES_CONFIG'],'rt'))
|
||||||
|
|
||||||
subprocess.call([
|
TZ = "Etc/UTC"
|
||||||
|
if 'timezone' in config:
|
||||||
|
TZ = config['timezone']
|
||||||
|
assert os.path.exists('/usr/share/zoneinfo/' + TZ), "Invalid timezone '%s'. See /usr/share/zoneinfo/*"%( TZ, )
|
||||||
|
|
||||||
|
with open('/etc/timezone', 'wt') as fp:
|
||||||
|
fp.write(TZ)
|
||||||
|
fp.close()
|
||||||
|
if os.path.exists('/etc/localtime'):
|
||||||
|
os.remove('/etc/localtime')
|
||||||
|
os.symlink(
|
||||||
|
'/usr/share/zoneinfo/' + TZ,
|
||||||
|
'/etc/localtime'
|
||||||
|
)
|
||||||
|
|
||||||
|
env = os.environ.copy()
|
||||||
|
env['TZ'] = TZ
|
||||||
|
|
||||||
|
subprocess.call(
|
||||||
|
[
|
||||||
'gunicorn',
|
'gunicorn',
|
||||||
'-b','0.0.0.0:80',
|
'-b','0.0.0.0:80',
|
||||||
'--timeout',str(config['timeout']),
|
'--timeout',str(config['timeout']),
|
||||||
'-w',str(config['workers']),
|
'-w',str(config['workers']),
|
||||||
'app:app'
|
'app:app'
|
||||||
])
|
],
|
||||||
|
env = env
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from dateutil.relativedelta import relativedelta
|
|
||||||
from flask import current_app as app
|
from flask import current_app as app
|
||||||
import requests
|
import requests
|
||||||
import re
|
import re
|
||||||
@@ -122,12 +121,14 @@ def file_age(path):
|
|||||||
os.stat(path).st_mtime
|
os.stat(path).st_mtime
|
||||||
)
|
)
|
||||||
diff = now - then
|
diff = now - then
|
||||||
rdiff = relativedelta(now, then)
|
return (
|
||||||
return diff, "%dM %02dD %02d:%02dH" % (
|
diff,
|
||||||
rdiff.years * 12 + rdiff.months,
|
"%03d d %s"%(
|
||||||
rdiff.days,
|
diff.days,
|
||||||
rdiff.hours,
|
datetime.utcfromtimestamp(
|
||||||
rdiff.minutes
|
diff.seconds
|
||||||
|
).strftime('%H:%M:%S')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
"timeout": 3600,
|
"timeout": 3600,
|
||||||
"uid": 1000,
|
"uid": 1000,
|
||||||
"gid": -1,
|
"gid": -1,
|
||||||
|
"timezone": "Etc/UTC",
|
||||||
"max_zip_size": 1000,
|
"max_zip_size": 1000,
|
||||||
"app_secret_key": "Cz2dw5NiRt3PSMFBSLTAJJi7kKrc4QU2CdQqEeOaU6",
|
"app_secret_key": "Cz2dw5NiRt3PSMFBSLTAJJi7kKrc4QU2CdQqEeOaU6",
|
||||||
"notifier": "",
|
"notifier": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user