From 92b314623aee547763ee050c253039a5b8f3cdf9 Mon Sep 17 00:00:00 2001 From: finn Date: Thu, 8 Aug 2024 15:14:44 +0000 Subject: [PATCH] appearance tweaks --- backend/app/email.py | 2 +- backend/app/forms.py | 2 +- backend/app/routes.py | 3 +- backend/app/templates/404.html | 2 +- backend/app/templates/500.html | 2 +- backend/app/templates/_post.html | 2 - backend/app/templates/_postnav.html | 14 ++++ backend/app/templates/base.html | 8 +-- backend/app/templates/edit_profile.html | 2 +- backend/app/templates/explore.html | 7 +- backend/app/templates/index.html | 7 +- backend/app/templates/login.html | 2 +- backend/app/templates/register.html | 2 +- backend/app/templates/reset_password.html | 2 +- .../app/templates/reset_password_request.html | 2 +- backend/app/templates/user.html | 65 +++++++++---------- 16 files changed, 67 insertions(+), 57 deletions(-) create mode 100644 backend/app/templates/_postnav.html diff --git a/backend/app/email.py b/backend/app/email.py index 0e5723a..383c9af 100644 --- a/backend/app/email.py +++ b/backend/app/email.py @@ -18,7 +18,7 @@ def send_email(subject, sender, recipients, text_body, html_body): def send_password_reset_email(user): token = user.get_reset_password_token() hostname = app.config['REAL_HOSTNAME'] - send_email('[Blog] Reset Password', + send_email('reset oily password', sender=app.config['ADMINS'][0], recipients=[user.email], text_body=render_template('email/reset_password.txt', hostname=hostname, user=user, token=token), diff --git a/backend/app/forms.py b/backend/app/forms.py index d9a5c14..ccc880c 100644 --- a/backend/app/forms.py +++ b/backend/app/forms.py @@ -51,7 +51,7 @@ class ResetPasswordRequestForm(FlaskForm): submit = SubmitField('Request Password Reset') class PostForm(FlaskForm): - post = TextAreaField('Post:', validators=[DataRequired(), Length(min=1, max=140)]) + post = TextAreaField('Post', validators=[DataRequired(), Length(min=1, max=140)]) submit = SubmitField('Submit') class EmptyForm(FlaskForm): diff --git a/backend/app/routes.py b/backend/app/routes.py index 12b3d78..5ec44f9 100644 --- a/backend/app/routes.py +++ b/backend/app/routes.py @@ -44,7 +44,8 @@ def index(): def explore(): query = sa.select(Post).order_by(Post.timestamp.desc()) page = request.args.get('page', 1, type=int) - posts = db.paginate(query, page=page, per_page=app.config['POSTS_PER_PAGE'], error_out=False) + ppp = app.config['POSTS_PER_PAGE'] * 2 + posts = db.paginate(query, page=page, per_page=ppp, error_out=False) next_url = url_for('explore', page=posts.next_num) if posts.has_next else None prev_url = url_for('explore', page=posts.prev_num) if posts.has_prev else None diff --git a/backend/app/templates/404.html b/backend/app/templates/404.html index 3c74661..e5a1fd0 100644 --- a/backend/app/templates/404.html +++ b/backend/app/templates/404.html @@ -2,7 +2,7 @@ {% block content %} -

File Not Found

+

File Not Found

Back

{% endblock %} diff --git a/backend/app/templates/500.html b/backend/app/templates/500.html index 699d215..8e3e544 100644 --- a/backend/app/templates/500.html +++ b/backend/app/templates/500.html @@ -2,7 +2,7 @@ {% block content %} -

An unexpected error has occurred.

+

An unexpected error has occurred.

Administrator has been notified.

Back

diff --git a/backend/app/templates/_post.html b/backend/app/templates/_post.html index dd71e87..28dd82a 100644 --- a/backend/app/templates/_post.html +++ b/backend/app/templates/_post.html @@ -1,4 +1,3 @@ - -
@@ -10,4 +9,3 @@ {{ post.body }}
diff --git a/backend/app/templates/_postnav.html b/backend/app/templates/_postnav.html new file mode 100644 index 0000000..34f4cf4 --- /dev/null +++ b/backend/app/templates/_postnav.html @@ -0,0 +1,14 @@ +
+ {% if prev_url %} + Newer + {% else %} + Newer + {% endif %} + + {% if next_url %} + Older + {% else %} + Older + {% endif %} +
+ diff --git a/backend/app/templates/base.html b/backend/app/templates/base.html index deaf3df..668388e 100644 --- a/backend/app/templates/base.html +++ b/backend/app/templates/base.html @@ -3,9 +3,9 @@ {% if title %} - {{ title }} - blogpage + {{ title }} - Page {% else %} - Welcome to blog. + oily {% endif %} @@ -21,8 +21,8 @@ {% endif %} -

oily.dad

-

destroy me

+

oily.dad

+
oilydada7ckiseinkbeathsefwgkvjrce743xy7x7iiybkuxh4vheead.onion

{% with messages = get_flashed_messages() %} diff --git a/backend/app/templates/edit_profile.html b/backend/app/templates/edit_profile.html index e347134..62c8488 100644 --- a/backend/app/templates/edit_profile.html +++ b/backend/app/templates/edit_profile.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block content %} -

Edit Profile

+

Edit Profile

{{ form.hidden_tag() }}

diff --git a/backend/app/templates/explore.html b/backend/app/templates/explore.html index fec6a59..8d47563 100644 --- a/backend/app/templates/explore.html +++ b/backend/app/templates/explore.html @@ -3,7 +3,6 @@ {% block explorecurrent %}class="current"{% endblock %} {% block content %} -

Hello, {{ current_user.username }}!

{% if form %} {{ form.hidden_tag() }} @@ -17,11 +16,13 @@

{{ form.submit() }}

{% endif %} + {% for post in posts %} {% include '_post.html' %} {% endfor %} - {% if prev_url %}Newer Posts{% endif %} - {% if next_url %}Older Posts{% endif %} +
+ + {% include '_postnav.html' %} {% endblock %} diff --git a/backend/app/templates/index.html b/backend/app/templates/index.html index 9f81852..730de59 100644 --- a/backend/app/templates/index.html +++ b/backend/app/templates/index.html @@ -3,7 +3,6 @@ {% block indexcurrent %}class="current"{% endblock %} {% block content %} -

Hello, {{ current_user.username }}!

{% if form %}
{{ form.hidden_tag() }} @@ -17,11 +16,13 @@

{{ form.submit() }}

{% endif %} + {% for post in posts %} {% include '_post.html' %} {% endfor %} - {% if prev_url %}Newer Posts{% endif %} - {% if next_url %}Older Posts{% endif %} +
+ + {% include '_postnav.html' %} {% endblock %} diff --git a/backend/app/templates/login.html b/backend/app/templates/login.html index 4bc8eb1..7f98f86 100644 --- a/backend/app/templates/login.html +++ b/backend/app/templates/login.html @@ -3,7 +3,7 @@ {% block logincurrent %}class="current"{% endblock %} {% block content %} -

Sign In

+

Sign In

{{ form.hidden_tag() }}

diff --git a/backend/app/templates/register.html b/backend/app/templates/register.html index 02b4226..8d2f8f7 100644 --- a/backend/app/templates/register.html +++ b/backend/app/templates/register.html @@ -2,7 +2,7 @@ {% block content %} -

Register

+

Register

{{ form.hidden_tag() }}

diff --git a/backend/app/templates/reset_password.html b/backend/app/templates/reset_password.html index 50f8dba..2d030ef 100644 --- a/backend/app/templates/reset_password.html +++ b/backend/app/templates/reset_password.html @@ -2,7 +2,7 @@ {% block content %} -

Reset Your Password

+

Reset Your Password

{{ form.hidden_tag() }}

diff --git a/backend/app/templates/reset_password_request.html b/backend/app/templates/reset_password_request.html index da2b56e..c71035a 100644 --- a/backend/app/templates/reset_password_request.html +++ b/backend/app/templates/reset_password_request.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block content %} -

Reset Password

+

Reset Password

{{ form.hidden_tag() }}

diff --git a/backend/app/templates/user.html b/backend/app/templates/user.html index ad70ce0..e2e4df1 100644 --- a/backend/app/templates/user.html +++ b/backend/app/templates/user.html @@ -3,45 +3,40 @@ {% block profilecurrent %}class="current"{% endblock %} {% block content %} - - - - - -
- - -

User: {{ user.username }}

-

CUdebug: {{ current_user }}

-

Udebug: {{ user }}

- {% if user.about_me %}

{{ user.about_me }}

{% endif %} - {% if user.last_seen %}

Last activity:{{ user.last_seen }}

{% endif %} - {% if user == current_user %} -

Edit Profile

- {% elif not current_user.is_following(user) %} -

- - {{ form.hidden_tag() }} - {{ form.submit(value='Follow') }} - -

- {% else %} -

-

- {{ form.hidden_tag() }} - {{ form.submit(value='Unfollow') }} -
-

- {% endif %} - - -
+

+

+ + User: {{ user.username }} +

+ {% if user.about_me %}

{{ user.about_me }}

{% endif %} + {% if user.last_seen %}

Last activity: {{ user.last_seen }}

{% endif %} + {% if user == current_user %} +

Edit Profile

+ {% elif not current_user.is_following(user) %} +

+

+ {{ form.hidden_tag() }} + {{ form.submit(value='Follow') }} +
+

+ {% else %} +

+

+ {{ form.hidden_tag() }} + {{ form.submit(value='Unfollow') }} +
+

+ {% endif %} +

+ + {% for post in posts %} {% include '_post.html' %} {% endfor %} - {% if prev_url %}Newer Posts{% endif %} - {% if next_url %}Older Posts{% endif %} +
+ + {% include '_postnav.html' %} {% endblock %}