Commit e9b39a85 authored by Lukas Böhm's avatar Lukas Böhm
Browse files

restructure html

parent be54989d
......@@ -5,9 +5,9 @@ class Share(db.Model):
__tablename__ = 'Share'
id = db.Column('ID', db.String(64), primary_key=True, unique=True)
name = db.Column('Name', db.String(32))
expires = db.Column('Expires', db.DATETIME)
download_limit = db.Column('DownloadLimit', db.INTEGER)
name = db.Column('Name', db.String(32), nullable=True)
expires = db.Column('Expires', db.DATETIME, nullable=False)
download_limit = db.Column('DownloadLimit', db.INTEGER, nullable=False)
files = db.relationship('Attachment', backref='share')
......@@ -16,5 +16,5 @@ class Attachment(db.Model):
__tablename__ = 'Attachment'
id = db.Column('ID', db.INTEGER, primary_key=True, unique=True)
filename = db.Column('filename', db.String())
share_id = db.Column('ShareID', db.String(64), db.ForeignKey('Share.ID'))
filename = db.Column('filename', db.String(), nullable=False)
share_id = db.Column('ShareID', db.String(64), db.ForeignKey('Share.ID'), nullable=False)
......@@ -9,22 +9,6 @@ from app.forms import UploadForm
from shutil import rmtree
def check_expired(share):
if share.download_limit < 0 or datetime.now() > share.expires:
# delete files
try:
rmtree(os.path.join(current_app.config['MEDIA_LOCATION'], share.id))
except OSError as e:
print("Error: %s - %s." % (e.filename, e.strerror))
# delete from database
for att in share.files:
db.session.delete(att)
db.session.delete(share)
db.session.commit()
return True
return False
@app.route('/privacy')
def privacy():
return render_template('Privacy.html')
......@@ -66,11 +50,34 @@ def upload():
db.session.add(att)
# wrap it up
db.session.commit()
return redirect(url_for('download', share_id=share_id))
return redirect(url_for('shared', share_id=share_id))
return render_template('Upload.html', form=form)
def check_expired(share):
if share.download_limit < 0 or datetime.now() > share.expires:
# delete files
try:
rmtree(os.path.join(current_app.config['MEDIA_LOCATION'], share.id))
except OSError as e:
print("Error: %s - %s." % (e.filename, e.strerror))
# delete from database
for att in share.files:
db.session.delete(att)
db.session.delete(share)
db.session.commit()
return True
return False
@app.route('/shared/<string:share_id>')
def shared(share_id):
share = Share.query.get_or_404(share_id)
check_expired(share)
return render_template('Shared.html', url=url_for('download', share_id=share.id))
@app.route('/d/<string:share_id>', methods=['GET'])
def download(share_id):
share = Share.query.get_or_404(share_id)
......
app/static/img/favicon.ico

980 KB | W: | H:

app/static/img/favicon.ico

16.6 KB | W: | H:

app/static/img/favicon.ico
app/static/img/favicon.ico
app/static/img/favicon.ico
app/static/img/favicon.ico
  • 2-up
  • Swipe
  • Onion skin
{% extends "Base.html" %}
{% block page %}
<div class="d-flex flex-column flex-md-row align-items-center p-3 px-md-4 mb-3 bg-white border-bottom shadow-sm">
<h5 class="my-0 mr-md-auto font-weight-normal">ChiefSend</h5>
<nav class="my-2 my-md-0 mr-md-3">
<a class="p-2 text-dark" href="{{ url_for('privacy') }}">Privacy</a>
<a class="p-2 text-dark" href="{{ url_for('about') }}">About</a>
</nav>
</div>
\ No newline at end of file
</div>
<div class="container">
{% block content %}
{% endblock content %}
<footer class="pt-4 my-md-5 pt-md-5 border-top">
<div class="row text-center center">
<small class="d-block mb-3 text-muted text-center">Chief Corporation &copy; 2020</small>
</div>
</footer>
</div>
{% endblock page %}
{% extends 'Base.html' %}
{% extends 'BasePage.html' %}
{% block content %}
<div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
<h1 class="display-4">Herunterladen</h1>
<p class="lead">Hier laden sie die zu ihrem Code zugehörigen Dateien runter.</p>
</div>
{% block page %}
{% include "includes/Header.html" %}
<div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
<h1 class="display-4">Herunterladen</h1>
<p class="lead">Hier laden sie die zu ihrem Code zugehörigen Dateien runter.</p>
</div>
<div class="container">
<div class="card mb-4 shadow-sm text-center">
<div class="card-header">
<h4 class="my-0 font-weight-normal">{{ up.name }}</h4>
......@@ -27,10 +23,9 @@
</li>
{% endfor %}
</ul>
<a href="{{ url_for('zip', share_id=up.id) }}" download class="btn btn-block btn-outline-primary">
Dateien gepackt herunterladen
</a>
</div>
</div>
{% include "includes/Footer.html" %}
</div>
{% endblock page %}
{% endblock content %}
{% extends 'Base.html' %}
{% extends 'BasePage.html' %}
{% block page %}
{% include "includes/Header.html" %}
<div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
<h1 class="display-4">Abgelaufen</h1>
<p class="lead">Es tut uns leid, aber diese Dateien sind nicht mehr verfügbar.</p>
</div>
{% include "includes/Footer.html" %}
{% endblock page %}
{% block content %}
<div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
<h1 class="display-4">Abgelaufen</h1>
<p class="lead">Es tut uns leid, aber diese Dateien sind nicht mehr verfügbar.</p>
</div>
{% endblock content %}
<!doctype html>
<html lang="de">
{% extends "Base.html" %}
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="ChiefSend">
<meta name="author" content="Lukas Böhm, Jonas Pfister, Max Smietana (moralische Unterstützung)">
<link rel="icon" href="{{ url_for('static', filename='img/favicon.ico') }}">
<title>Privacy</title>
</head>
<body>
{% block page %}
<h1>Datenschutzerklärung</h1>
<p>Mir doch egal</p>
</body>
</html>
\ No newline at end of file
<p>Mir doch egal.</p>
{% endblock page %}
\ No newline at end of file
{% extends 'BasePage.html' %}
{% block content %}
<div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
<h1 class="display-4">Hochgeladen!</h1>
<p class="lead">Kopieren und verschicken sie den unten stehenden Link.</p>
</div>
<div class="card mb-4 shadow-sm text-center">
<div class="input-group mb-3">
<input type="text" class="form-control" aria-label="Shared URL" aria-describedby="copy-url" id="url" readonly value="http://localhost:5000/shared/9e0c409b-26f6-446b-9690-66d4e5942926">
<div class="input-group-append">
<button class="input-group-text" id="copy-url">@</button>
</div>
<a href="{{ url }}" class="btn btn-lg btn-block btn-primary">Zum Download</a>
</div>
<script>
$(document).ready(function() {
$("#url").val("{{ url }}");
$("#copy-url").click(function(){
/* Get the text field */
let copyText = document.getElementById("url");
/* Select the text field */
copyText.select();
copyText.setSelectionRange(0, 99999); /*For mobile devices*/
/* Copy the text inside the text field */
document.execCommand("copy");
});
});
</script>
</div>
{% endblock content %}
{% extends 'Base.html' %}
{% extends 'BasePage.html' %}
{% block page %}
{% include "includes/Header.html" %}
<div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
<h1 class="display-4">Hochladen</h1>
<p class="lead">Hier können Sie Dateien bis zu 1000MB hochladen und sofort per Link teilen.</p>
</div>
{% block content %}
<div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
<h1 class="display-4">Hochladen</h1>
<p class="lead">Hier können Sie Dateien bis zu 1000MB hochladen und sofort per Link teilen.</p>
</div>
<div class="container">
<div class="card mb-4 shadow-sm text-center">
<form method="post" enctype="multipart/form-data">
{{ form.hidden_tag() }}
......@@ -36,20 +33,16 @@
</form>
</div>
{% include "includes/Footer.html" %}
</div>
<script>
// to let the name of the file appear on select
$(".custom-file-input").on("change", function() {
let fns = $(this)[0].files;
let label = "";
for (var i = 0; i < fns.length; i++){
label = label.concat(fns[i].name);
if (i < fns.length-1) label = label.concat(", ");
}
$(this).siblings(".custom-file-label").addClass("selected").html(label);
});
</script>
{% endblock page %}
\ No newline at end of file
<script>
// to let the name of the file appear on select
$(".custom-file-input").on("change", function() {
let fns = $(this)[0].files;
let label = "";
for (var i = 0; i < fns.length; i++){
label = label.concat(fns[i].name);
if (i < fns.length-1) label = label.concat(", ");
}
$(this).siblings(".custom-file-label").addClass("selected").html(label);
});
</script>
{% endblock content %}
\ No newline at end of file
<footer class="pt-4 my-md-5 pt-md-5 border-top">
<div class="row text-center center">
<small class="d-block mb-3 text-muted text-center">Chief Corporation &copy; 2020</small>
</div>
</footer>
\ No newline at end of file
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
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