Commit 3f9bbb53 authored by Lukas Bhm's avatar Lukas Bhm
Browse files

next prod ready version

parent cd6ad9a4
# ChiefSend
Eine Tolle Webapp zum Austausch von Dateien
## Installation
`git clone https://gitlab.cs.fau.de/ib49uquh/chiefsend.git`
`cd chiefsend`
`docker volume create chiefsend-vol`
`docker build -t chiefsend:latest .`
`docker run --name chiefsend-test -d -p 8000:5000 --mount source=chiefsend-vol,target=/home/chiefsend/data --rm chiefsend:latest`
## Removing
`docker container stop chiefsend-test`
`docker container rm chiefsend-test`
`docker volume rm chiefsend-vol`
# ChiefSend
Eine Tolle Webapp zum Austausch von Dateien
## Installation and Usage
`docker build -t chiefsend:latest .`
`docker-compose up`
......@@ -7,11 +7,11 @@ from flask_wtf import FlaskForm
class UploadForm(FlaskForm):
files = MultipleFileField('Dateien hochladen', validators=[DataRequired()])
name = StringField(validators=[Optional()])
timer = SelectField(choices=[(2, '2 Minuten'), (5, '5 Minuten'), (15, '15 Minuten'), (30, '30 Minuten'),
timer = SelectField(choices=[(0.25, '15 Sekunden'), (2, '2 Minuten'), (5, '5 Minuten'), (15, '15 Minuten'), (30, '30 Minuten'),
(120, '2 Stunden'), (360, '6 Stunden'), (1440, '1 Tag'), (10080, '7 Tage'),
(43200, '1 Monat'), (990000000, 'Für immer')],
label='Verfügbarkeit', validators=[DataRequired()], default=1440)
label='Verfügbarkeit', validators=[DataRequired()], default=1440, coerce=float) # FIXME or int?
download_limit = SelectField(
choices=[(1, '1 Download'), (2, '2 Downloads'), (5, '5 Downloads'), (15, '15 Downloads'), (50, '50 Downloads')],
label='Downloads', validators=[DataRequired()], default=5)
choices=[(1, '1 Download'), (2, '2 Downloads'), (5, '5 Downloads'), (15, '15 Downloads'), (50, '50 Downloads'), (200, '200 Downloads'), (2147483646, 'Unbegrenzt')],
label='Downloads', validators=[DataRequired()], default=5, coerce=int)
submit = SubmitField('Hochladen')
......@@ -5,8 +5,8 @@ from app import app, db
from flask import redirect, url_for, render_template, send_from_directory, current_app, abort
from app.models import Share, Attachment
from app.forms import UploadForm
from shutil import make_archive
from app import task_queue as que
from shutil import make_archive, rmtree
def delete_share(share_id):
......@@ -14,7 +14,6 @@ def delete_share(share_id):
share = Share.query.get_or_404(str(share_id))
# delete files
try:
from shutil import rmtree
rmtree(os.path.join(current_app.config['MEDIA_LOCATION'], share.id))
os.remove(os.path.join(current_app.config['MEDIA_LOCATION'], share.id + '.zip'))
except OSError as e:
......@@ -104,7 +103,7 @@ def get_and_check_share(share_id):
def shared(share_id):
share = get_and_check_share(share_id)
if share is None: return redirect(url_for('expired'))
return render_template('Shared.html', url=url_for('download', share_id=share.id))
return render_template('Shared.html', share=share, url=url_for('download', share_id=share.id))
@app.route('/d/<string:share_id>', methods=['GET'])
......@@ -128,5 +127,5 @@ def media(share_id, filename):
def zip(share_id):
share = get_and_check_share(share_id)
if share is None: return redirect(url_for('expired'))
return send_from_directory(os.path.join(current_app.config['MEDIA_LOCATION']),
return send_from_directory(current_app.config['MEDIA_LOCATION'],
filename=str(share.id) + '.zip', as_attachment=True)
......@@ -15,7 +15,7 @@ services:
rq:
container_name: "chiefsend-tasks"
image: chiefsend:latest
image: "chiefsend:latest"
volumes:
- type: volume
source: chiefsend-vol
......@@ -25,7 +25,7 @@ services:
web:
container_name: "chiefsend-web"
build: .
image: chiefsend:latest
image: "chiefsend:latest"
ports:
- "8000:5000"
volumes:
......
APScheduler==3.6.3
click==7.1.2
Flask==1.1.2
Flask-SQLAlchemy==2.4.4
Flask-WTF==0.14.3
gunicorn==20.0.4
itsdangerous==1.1.0
Jinja2==2.11.2
MarkupSafe==1.1.1
pytz==2020.1
six==1.15.0
SQLAlchemy==1.3.19
tzlocal==2.1
Werkzeug==1.0.1
WTForms==2.3.3
Flask
Flask-SQLAlchemy
Flask-WTF
rq
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment