Commit 0676d954 authored by Lukas Böhm's avatar Lukas Böhm 🎱
Browse files

landing page

parent c0be5c6b
......@@ -2,6 +2,6 @@ from flask import Flask
app = Flask(__name__)
app.config['API_URL'] = 'http://localhost:6969'
app.config['SECRET_KEY'] = 'AYYY'
app.config['SECRET_KEY'] = '0345896u409568540968630498649058609'
import routes
......@@ -4,7 +4,7 @@ from werkzeug.exceptions import HTTPException
import requests as api
from chiefsend import app
from util import AuthForm, get_password, set_password
from util import AuthForm, get_password, set_password, SearchForm
@app.route('/privacy')
......@@ -17,9 +17,14 @@ def about():
return render_template('About.html')
@app.route('/')
def index():
return render_template('Landing.html')
@app.route('/', methods=['GET', 'POST'])
def landing():
form = SearchForm()
if form.validate_on_submit():
share_id = form.query.data.split(sep="/")[-1]
return redirect(url_for('download', share_id=share_id))
return render_template('Landing.html', form=form)
@app.errorhandler(HTTPException)
......
{% extends 'Base.html' %}
{% extends "Base.html" %}
{% block page %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/cover.css') }}">
<div class="cover bg-dark">
<div class="cover-container d-flex h-100 p-3 mx-auto flex-column">
<header class="masthead mb-auto">
<div class="inner">
<h3 class="masthead-brand">Cover</h3>
<nav class="nav nav-masthead justify-content-center">
<a class="nav-link active" href="#">Home</a>
<a class="nav-link" href="#">Features</a>
<a class="nav-link" href="#">Contact</a>
</nav>
</div>
</header>
<main role="main" class="inner cover">
<h1 class="cover-heading">Cover your page.</h1>
<p class="lead">Cover is a one-page template for building simple and beautiful home pages. Download, edit the text, and add your own fullscreen background photo to make it your own.</p>
<p class="lead">
<a href="#" class="btn btn-lg btn-secondary">Learn more</a>
</p>
</main>
<!-- Navbar -->
<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('public') }}">Öffentlich</a>
<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>
<footer class="mastfoot mt-auto">
<div class="inner">
<p>Cover template for <a href="https://getbootstrap.com/">Bootstrap</a>, by <a href="https://twitter.com/mdo">@mdo</a>.</p>
</div>
</footer>
<main class="container-fluid">
<div class="row align-items-center justify-content-center text-center">
<div class="col-lg-6">
<h1>ChiefSend</h1>
<p class="mb-5">Haben Sie schon einen Share link, oder wollen sie einen erstellen?</p>
<form class="form-group d-flex" method="post">
{{ form.hidden_tag() }}
{{ form.query(class="form-control", placeholder="Share ID oder Link") }}
{{ form.submit(class="btn btn-primary text-white px-4") }}
</form>
oder
<a class="form-group btn btn-block btn-outline-success" href="{{ url_for('upload') }}">
Share erstellen
</a>
</div>
</div>
</div>
{% endblock %}
\ No newline at end of file
</main>
{% endblock page %}
from flask import session
from flask_wtf import FlaskForm
from wtforms import SubmitField, PasswordField
from wtforms.validators import DataRequired
from wtforms import SubmitField, PasswordField, StringField
from wtforms.validators import DataRequired, InputRequired
class AuthForm(FlaskForm):
......@@ -9,6 +9,11 @@ class AuthForm(FlaskForm):
submit = SubmitField('Zugriff!')
class SearchForm(FlaskForm):
query = StringField('Suchbegriff', validators=[InputRequired()])
submit = SubmitField('Finden')
def get_password(share_id):
if share_id not in session:
return None
......
Markdown is supported
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