summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblendoit <blendoit@gmail.com>2020-01-22 18:15:52 -0800
committerblendoit <blendoit@gmail.com>2020-01-22 18:15:52 -0800
commit2f1d0719faa0d955a82e87c0ea022f458e1c699f (patch)
treea6f5d5403d4884c9ef3e6c7c3b6060151fcc373b
First commit.
-rw-r--r--website/Pipfile15
-rw-r--r--website/Pipfile.lock141
-rw-r--r--website/app/forms.py28
-rw-r--r--website/app/routes.py54
-rw-r--r--website/app/static/styles/default.css25
-rw-r--r--website/app/static/styles/home.css50
-rw-r--r--website/app/static/styles/no.css54
-rw-r--r--website/app/static/styles/yes.css54
-rw-r--r--website/app/templates/base.html25
-rw-r--r--website/app/templates/home.html24
-rw-r--r--website/app/templates/login.html34
-rw-r--r--website/app/templates/no.html23
-rw-r--r--website/app/templates/register.html31
-rw-r--r--website/app/templates/yes.html17
14 files changed, 575 insertions, 0 deletions
diff --git a/website/Pipfile b/website/Pipfile
new file mode 100644
index 0000000..e28b64e
--- /dev/null
+++ b/website/Pipfile
@@ -0,0 +1,15 @@
+[[source]]
+name = "pypi"
+url = "https://pypi.org/simple"
+verify_ssl = true
+
+[dev-packages]
+
+[packages]
+flask = "*"
+flask-wtf = "*"
+uwsgi = "*"
+flask-socketio = "*"
+
+[requires]
+python_version = "3.8"
diff --git a/website/Pipfile.lock b/website/Pipfile.lock
new file mode 100644
index 0000000..1e6bd41
--- /dev/null
+++ b/website/Pipfile.lock
@@ -0,0 +1,141 @@
+{
+ "_meta": {
+ "hash": {
+ "sha256": "efc56d845e2a3dfa2fa6132963f17abed9e32f9efdc80d03898efdcd1c3d07a3"
+ },
+ "pipfile-spec": 6,
+ "requires": {
+ "python_version": "3.8"
+ },
+ "sources": [
+ {
+ "name": "pypi",
+ "url": "https://pypi.org/simple",
+ "verify_ssl": true
+ }
+ ]
+ },
+ "default": {
+ "click": {
+ "hashes": [
+ "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13",
+ "sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7"
+ ],
+ "version": "==7.0"
+ },
+ "flask": {
+ "hashes": [
+ "sha256:13f9f196f330c7c2c5d7a5cf91af894110ca0215ac051b5844701f2bfd934d52",
+ "sha256:45eb5a6fd193d6cf7e0cf5d8a5b31f83d5faae0293695626f539a823e93b13f6"
+ ],
+ "index": "pypi",
+ "version": "==1.1.1"
+ },
+ "flask-socketio": {
+ "hashes": [
+ "sha256:2172dff1e42415ba480cee02c30c2fc833671ff326f1598ee3d69aa02cf768ec",
+ "sha256:7ff5b2f5edde23e875a8b0abf868584e5706e11741557449bc5147df2cd78268"
+ ],
+ "index": "pypi",
+ "version": "==4.2.1"
+ },
+ "flask-wtf": {
+ "hashes": [
+ "sha256:5d14d55cfd35f613d99ee7cba0fc3fbbe63ba02f544d349158c14ca15561cc36",
+ "sha256:d9a9e366b32dcbb98ef17228e76be15702cd2600675668bca23f63a7947fd5ac"
+ ],
+ "index": "pypi",
+ "version": "==0.14.2"
+ },
+ "itsdangerous": {
+ "hashes": [
+ "sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19",
+ "sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749"
+ ],
+ "version": "==1.1.0"
+ },
+ "jinja2": {
+ "hashes": [
+ "sha256:74320bb91f31270f9551d46522e33af46a80c3d619f4a4bf42b3164d30b5911f",
+ "sha256:9fe95f19286cfefaa917656583d020be14e7859c6b0252588391e47db34527de"
+ ],
+ "version": "==2.10.3"
+ },
+ "markupsafe": {
+ "hashes": [
+ "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473",
+ "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161",
+ "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235",
+ "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5",
+ "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff",
+ "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b",
+ "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1",
+ "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e",
+ "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183",
+ "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66",
+ "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1",
+ "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1",
+ "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e",
+ "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b",
+ "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905",
+ "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735",
+ "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d",
+ "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e",
+ "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d",
+ "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c",
+ "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21",
+ "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2",
+ "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5",
+ "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b",
+ "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6",
+ "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f",
+ "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f",
+ "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7"
+ ],
+ "version": "==1.1.1"
+ },
+ "python-engineio": {
+ "hashes": [
+ "sha256:50d108fc7feb7f970e6ebc86733752ebd714545bb5622383e6135bdad45fc9fe",
+ "sha256:f6bd466dea769bb19c59eaf8e68a296b195b6957650523f13a73d8c0767b7a38"
+ ],
+ "version": "==3.11.1"
+ },
+ "python-socketio": {
+ "hashes": [
+ "sha256:48cba5b827ac665dbf923a4f5ec590812aed5299a831fc43576a9af346272534",
+ "sha256:af6c23c35497960f82106e36688123ecb52ad5a77d0ca27954ff3811c4d9d562"
+ ],
+ "version": "==4.4.0"
+ },
+ "six": {
+ "hashes": [
+ "sha256:1f1b7d42e254082a9db6279deae68afb421ceba6158efa6131de7b3003ee93fd",
+ "sha256:30f610279e8b2578cab6db20741130331735c781b56053c59c4076da27f06b66"
+ ],
+ "version": "==1.13.0"
+ },
+ "uwsgi": {
+ "hashes": [
+ "sha256:4972ac538800fb2d421027f49b4a1869b66048839507ccf0aa2fda792d99f583"
+ ],
+ "index": "pypi",
+ "version": "==2.0.18"
+ },
+ "werkzeug": {
+ "hashes": [
+ "sha256:7280924747b5733b246fe23972186c6b348f9ae29724135a6dfc1e53cea433e7",
+ "sha256:e5f4a1f98b52b18a93da705a7458e55afb26f32bff83ff5d19189f92462d65c4"
+ ],
+ "version": "==0.16.0"
+ },
+ "wtforms": {
+ "hashes": [
+ "sha256:0cdbac3e7f6878086c334aa25dc5a33869a3954e9d1e015130d65a69309b3b61",
+ "sha256:e3ee092c827582c50877cdbd49e9ce6d2c5c1f6561f849b3b068c1b8029626f1"
+ ],
+ "version": "==2.2.1"
+ }
+ },
+ "develop": {}
+}
diff --git a/website/app/forms.py b/website/app/forms.py
new file mode 100644
index 0000000..ae6a2dc
--- /dev/null
+++ b/website/app/forms.py
@@ -0,0 +1,28 @@
+from flask_wtf import FlaskForm
+from wtforms import StringField, PasswordField, SubmitField, BooleanField
+from wtforms.validators import DataRequired, Length, EqualTo
+
+
+class RegistrationForm(FlaskForm):
+ alias = StringField('Alias',
+ validators=[DataRequired(),
+ Length(min=2, max=20)])
+ password = PasswordField('Password', validators=[DataRequired()])
+ password_confirm = PasswordField(
+ 'Confirm Password', validators=[DataRequired(),
+ EqualTo('password')])
+ submit = SubmitField('Create Alias')
+
+
+class LoginForm(FlaskForm):
+ alias = StringField('Alias',
+ validators=[DataRequired(),
+ Length(min=2, max=20)])
+ password = PasswordField('Password', validators=[DataRequired()])
+ remember = BooleanField('Remember Alias')
+ submit = SubmitField('Login Alias')
+
+
+class NewMessage(FlaskForm):
+ recipient = StringField('Recipient', validators=[DataRequired()])
+ message = StringField('message', validators=[DataRequired()])
diff --git a/website/app/routes.py b/website/app/routes.py
new file mode 100644
index 0000000..f1497b8
--- /dev/null
+++ b/website/app/routes.py
@@ -0,0 +1,54 @@
+from flask import Flask, render_template, flash, redirect, url_for
+from forms import RegistrationForm, LoginForm
+
+app = Flask(__name__)
+app.config['SECRET_KEY'] = 'foobarblendoitfoobar!'
+
+posts = [{
+ 'author':
+ 'Marius',
+ 'date':
+ 'Dec. 26th, 2019',
+ 'content':
+ "this is a test where I write a message that isn't too short, it isn't too long, it's just the right size."
+}, {
+ 'author': 'Achille',
+ 'date': 'Dec. 25th, 2019',
+ 'content': "this is a second test!"
+}, {
+ 'author': 'Jeanne',
+ 'date': 'Dec. 24th, 2019',
+ 'content': "this is a third test!"
+}]
+
+
+@app.route("/")
+@app.route("/home")
+def home():
+ return render_template('home.html', posts=posts)
+
+@app.route("/yes")
+def yes():
+ return render_template("yes.html")
+
+@app.route("/no")
+def no():
+ return render_template("no.html")
+
+@app.route("/register", methods=['GET', 'POST'])
+def register():
+ form = RegistrationForm()
+ if form.validate_on_submit():
+ flash(f"Alias created for {form.alias.data}.", 'success')
+ return redirect(url_for('home'))
+ return render_template('register.html', title="Register", form=form)
+
+
+@app.route("/login")
+def login():
+ form = LoginForm()
+ return render_template('login.html', title="Login", form=form)
+
+
+if __name__ == '__main__':
+ app.run(debug=True)
diff --git a/website/app/static/styles/default.css b/website/app/static/styles/default.css
new file mode 100644
index 0000000..47ba29d
--- /dev/null
+++ b/website/app/static/styles/default.css
@@ -0,0 +1,25 @@
+:root {
+ --primary-color: #003B5C;
+ --secondary-color: #C3D7EE;
+ --home: rgba(200, 200, 200, 0.7);
+ --yes: rgba(0, 255, 0, 0.7);
+ --no: rgba(255, 0, 0, 0.7);
+}
+
+* {
+ margin: 0;
+ padding: 0;
+}
+
+body {
+ font-family: 'Liberation Sans', sans-serif;
+ line-height: 1.2;
+}
+
+h1 {
+
+}
+
+h2 {
+
+}
diff --git a/website/app/static/styles/home.css b/website/app/static/styles/home.css
new file mode 100644
index 0000000..262b40c
--- /dev/null
+++ b/website/app/static/styles/home.css
@@ -0,0 +1,50 @@
+.main {
+ height: 100%;
+ position: absolute;
+ left: 3%;
+ right: 3%;
+ background: linear-gradient(to top, var(--secondary-color), var(--primary-color)) fixed;
+}
+
+.tab-yes {
+ height: 100%;
+ width: 10%;
+ float: left;
+ position: fixed;
+ z-index: -1;
+ background: var(--yes);
+}
+.tab-no {
+ height: 100%;
+ width: 10%;
+ float: right;
+ position: fixed;
+ z-index: -1;
+ right: 0;
+ background: var(--no);
+}
+
+.tab-yes:hover ~ .main {
+ left: 5%;
+ transition: 0.2s;
+}
+
+.tab-no:hover ~ .main {
+ right: 5%;
+ transition: 0.2s;
+}
+
+.post {
+ background: white;
+ border-radius: 14px;
+ padding: 1rem;
+ margin: 1rem;
+ width: 20%;
+}
+
+.post:hover {
+ background: linear-gradient(to left, var(--no) 50%, var(--yes) 50%);
+ cursor: pointer;
+ transition: 0.8s;
+ color: white;
+}
diff --git a/website/app/static/styles/no.css b/website/app/static/styles/no.css
new file mode 100644
index 0000000..09171a6
--- /dev/null
+++ b/website/app/static/styles/no.css
@@ -0,0 +1,54 @@
+.main {
+ height: 100%;
+ right: 0;
+ left: 6%;
+ position: absolute;
+ z-index: 1;
+ background: linear-gradient(to top, var(--secondary-color), var(--primary-color)) fixed;
+}
+
+.tab-home {
+ height: 100%;
+ width: 3%;
+ float: left;
+ position: relative;
+ z-index: 0;
+ background: var(--home);
+}
+
+.tab-yes {
+ height: 100%;
+ width: 3%;
+ float: left;
+ position: relative;
+ z-index: -1;
+ background: var(--yes);
+}
+
+.tab-home:hover ~ .main {
+ left: 9%;
+ transition: 0.2s;
+}
+
+.tab-home:hover {
+ width: 6%;
+ transition: 0.2s;
+}
+
+.tab-yes:hover ~ .main {
+ left: 9%;
+ transition: 0.2s;
+}
+
+.tab-yes:hover {
+ width: 6%;
+ transition: 0.2s;
+}
+
+.post {
+ background: white;
+ border-radius: 14px;
+ padding: 1rem;
+ margin: 1rem;
+ width: 20%;
+}
diff --git a/website/app/static/styles/yes.css b/website/app/static/styles/yes.css
new file mode 100644
index 0000000..96443e1
--- /dev/null
+++ b/website/app/static/styles/yes.css
@@ -0,0 +1,54 @@
+.main {
+ height: 100%;
+ right: 6%;
+ left: 0;
+ position: absolute;
+ z-index: 1;
+ background: linear-gradient(to top, var(--secondary-color), var(--primary-color)) fixed;
+}
+
+.tab-home {
+ height: 100%;
+ width: 3%;
+ float: right;
+ position: relative;
+ z-index: 0;
+ background: var(--home);
+}
+
+.tab-no {
+ height: 100%;
+ width: 3%;
+ float: right;
+ position: relative;
+ z-index: -1;
+ background: var(--no);
+}
+
+.tab-home:hover ~ .main {
+ right: 9%;
+ transition: 0.2s;
+}
+
+.tab-home:hover {
+ width: 6%;
+ transition: 0.2s;
+}
+
+.tab-no:hover ~ .main {
+ right: 9%;
+ transition: 0.2s;
+}
+
+.tab-no:hover {
+ width: 6%;
+ transition: 0.2s;
+}
+
+.post {
+ background: white;
+ border-radius: 14px;
+ padding: 1rem;
+ margin: 1rem;
+ width: 20%;
+}
diff --git a/website/app/templates/base.html b/website/app/templates/base.html
new file mode 100644
index 0000000..5520493
--- /dev/null
+++ b/website/app/templates/base.html
@@ -0,0 +1,25 @@
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to">
+
+ {% if title %}
+ <title>{{ title }}</title>
+ {% else %}
+ <title>Blendoit</title>
+ {% endif %}
+ </head>
+ <body>
+ {% with messages = get_flashed_messages(with_categories=true) %}
+ {% if messages %}
+ {% for message in messages %}
+ <div class="alert">
+ {{ message }}
+ </div>
+ {% endfor %}
+ {% endif %}
+ {% endwith %}
+
+ {% block content %}{% endblock %}
+ </body>
+</html>
diff --git a/website/app/templates/home.html b/website/app/templates/home.html
new file mode 100644
index 0000000..89984eb
--- /dev/null
+++ b/website/app/templates/home.html
@@ -0,0 +1,24 @@
+<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/default.css') }}">
+<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/home.css') }}">
+
+{% extends "base.html" %}
+
+{% block content %}
+
+<div>
+ <a href="{{ url_for('yes') }}" class="tab-yes"></a>
+ <a href="{{ url_for('no') }}" class="tab-no"></a>
+
+ <div class="main">
+ {% for post in posts %}
+ <div class="post">
+ <h1>{{post.author}}</h1>
+ <h2>{{post.date}}</h2>
+ <p>{{post.content}}</p>
+ </div>
+ {% endfor %}
+ </div>
+</div>
+
+
+{% endblock content %}
diff --git a/website/app/templates/login.html b/website/app/templates/login.html
new file mode 100644
index 0000000..63217e1
--- /dev/null
+++ b/website/app/templates/login.html
@@ -0,0 +1,34 @@
+{% extends "base.html" %}
+{% block content %}
+
+<div class="content-section">
+ <form method="POST" action="">
+ {{ form.hidden_tag() }}
+ <fieldset class="form-group">
+ <legend>Join Today</legend>
+ <div class="form-group">
+ {{ form.alias.label }}
+ {{ form.alias }}
+ </div>
+ <div class="form-group">
+ {{ form.password.label }}
+ {{ form.password }}
+ </div>
+ <div class="form-group">
+ {{ form.password_confirm.label }}
+ {{ form.password_confirm }}
+ </div>
+ </fieldset>
+ <div class="form-group">
+ {{ form.submit(class="btn") }}
+ </div>
+ </form>
+</div>
+
+<div>
+ <small>
+ Already have an account? <a href="{{ url_for('login') }}">Sign In</a>
+ </small>
+</div>
+
+{% endblock content %}
diff --git a/website/app/templates/no.html b/website/app/templates/no.html
new file mode 100644
index 0000000..e1b9238
--- /dev/null
+++ b/website/app/templates/no.html
@@ -0,0 +1,23 @@
+<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/default.css') }}">
+<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/no.css') }}">
+
+{% extends "base.html" %}
+{% block content %}
+
+<div>
+ <a href="{{ url_for('yes') }}" class="tab-yes"></a>
+ <a href="{{ url_for('home') }}" class="tab-home"></a>
+
+ <div class="main">
+ {% for post in posts %}
+ <div class="post">
+ <h1>{{post.author}}</h1>
+ <h2>{{post.date}}</h2>
+ <p>{{post.content}}</p>
+ </div>
+ {% endfor %}
+ </div>
+</div>
+
+
+{% endblock content %}
diff --git a/website/app/templates/register.html b/website/app/templates/register.html
new file mode 100644
index 0000000..456b8f7
--- /dev/null
+++ b/website/app/templates/register.html
@@ -0,0 +1,31 @@
+{% extends "base.html" %}
+{% block content %}
+
+<div class="content-section">
+ <form method="POST" action="">
+ {{ form.hidden_tag() }}
+ <fieldset class="form-group">
+ <legend>Create a new alias</legend>
+ <div class="form-group">
+ {{ form.alias.label(class="form-control-label") }}
+ {{ form.alias(class="form-control") }}
+ </div>
+ <div class="form-group">
+ {{ form.password.label(class="form-control-label") }}
+ {{ form.password(class="form-control") }}
+ </div>
+ <div class="form-group">
+ {{ form.password_confirm.label(class="form-control-label") }}
+ {{ form.password_confirm(class="form-control") }}
+ </div>
+ </fieldset>
+ <div class="form-group">
+ {{ form.submit(class="btn") }}
+ </div>
+ </form>
+</div>
+<div>
+ Sign in with existing alias? <a href="{{ url_for('login') }}">Sign In</a>
+</div>
+
+{% endblock content %}
diff --git a/website/app/templates/yes.html b/website/app/templates/yes.html
new file mode 100644
index 0000000..b915221
--- /dev/null
+++ b/website/app/templates/yes.html
@@ -0,0 +1,17 @@
+<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/default.css') }}">
+<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/yes.css') }}">
+
+{% extends "base.html" %}
+{% block content %}
+
+<div>
+ <a href="{{ url_for('no') }}" class="tab-no"></a>
+ <a href="{{ url_for('home') }}" class="tab-home"></a>
+
+ <div class="main">
+ <p> yes, no?</p>
+ </div>
+</div>
+
+
+{% endblock content %}
Copyright 2019--2024 Marius PETER