Commit Graph

129 Commits

Author SHA1 Message Date
Xevion
f8e8d0fbaf Add likes/comment counts + like button to individual post viewer
- Only render in jQuery and likes script when a user is logged in
- Possibly we should show the like button but redirect to login page?
2022-03-30 16:49:59 -05:00
Xevion
531c60d163 Remove spaCy references and generate new Pipfile.lock 2022-03-30 16:00:08 -05:00
Xevion
73d9fd5454 Replace profanity-filter with better-profanity
Since Heroku refuses to let me downloda the spaCy model, we're going
with this instead. :/
2022-03-30 15:57:47 -05:00
Xevion
3a0c1690d3 Remove runtime spacy model downloading 2022-03-30 02:39:51 -05:00
Xevion
018752f0df Add spaCy en-core-web-sm model to Pipfile 2022-03-30 02:38:05 -05:00
Xevion
29d9426d57 Remove unused ProfanityFilter instance from route_forms.py 2022-03-30 02:24:49 -05:00
Xevion
3ab3fd5476 Ensure Spacy NLP model is downloaded by Heroku in production 2022-03-30 02:10:20 -05:00
Xevion
b0aa5addbf Merge pull request #2 from Xevion/profanity-filters
Profanity Filters, Likes, Model Revamp, Flask-WTF Forms, CSRF, jQuery, TOS & License
2022-03-30 01:48:11 -05:00
Xevion
2c8d97559d Show divider only when post form is displayed, add post count text. 2022-03-30 01:45:44 -05:00
Xevion
765e786231 Add like counter to user profile
- Also fixed some issue with get_post_count() method? Weird.
2022-03-30 01:41:32 -05:00
Xevion
11394bfb7e Re-add red border to form errors, limit like button to logged in users 2022-03-30 01:36:32 -05:00
Xevion
d16df75bf5 Add better message hints to RegEx validators
I realized that users wouldn't be able to understand why their username
was invalid, so rather than getting rid of it, I added message hints
and split it up into two different validators. If the first one fails,
the second one will show as well.

Not perfect, but better than before by a longshot.
2022-03-30 01:33:17 -05:00
Xevion
7da54f656d Limit possible characters in a username heavily to combat abuse 2022-03-30 01:27:28 -05:00
Xevion
fdec448e74 Show up to 2 usernames, calculate number unshown on likes status text
- Switched to username for likes display text instead of name
- Reminder: Strict usernames, no spaces, a-Z + 0-9
2022-03-30 01:20:01 -05:00
Xevion
c5c3b01dfa Use jQuery to allow users to like/unlike posts with dynamic updates
- Only the pages that need jQuery and the likes.js script will load it
2022-03-30 01:18:42 -05:00
Xevion
bfb69621e1 Add like querying/checking/rendering to Feed posts
- Change runnerspace.live to Runnerspace
- Change post viewing URL to say /post/🆔 instead of /feed/🆔
2022-03-30 00:21:55 -05:00
Xevion
2a443979b9 Hide "New Users" box when no users are in database
- Also improved CSS organization
- Use space-around flex to center stats box
- Capitalized 'runnerspace'
2022-03-29 23:40:02 -05:00
Xevion
6b4d5acfb9 Move highly-static routes in separate blueprint 2022-03-29 23:34:31 -05:00
Xevion
cf8a754caf Implement inefficient like summation methods 2022-03-29 23:23:48 -05:00
Xevion
1a323a8349 Add PostLike and CommentLike models
- Also adjusted some User methods and added ones I believe may be wanted
or needed in time.
- Adjusted online time delta back to 3 minutes.
- Started looking into how to sum 'likes' efficiently on a user's posts.
2022-03-29 22:45:59 -05:00
Xevion
58861acd3d Change minimum comment length to 1 character
Comments like "yes", "no" or 😈 wouldn't be available to post either.
2022-03-29 21:16:12 -05:00
Xevion
66715ecc72 Improve edit profile and add comment styling 2022-03-29 21:14:42 -05:00
Xevion
2cb42bbc8b Fix profile editing form not coming pre-populated with data
Not sure why Form.populate_obj() wasn't working - looking at the source
and the description as well as relevant StackOverflow answers, that
method would apparently work just fine. Looking again, Form.process()
was recommended instead.

Also, I finally changed PyCharm to show me proper commit message
standards - so, be happy that things will look nice now. :)
2022-03-29 20:57:13 -05:00
Xevion
987e4f3256 Remove unused Post.likes
- As well as related methods
- In preparation for PostLikes and CommentLikes model implementations
2022-03-29 20:49:12 -05:00
Xevion
4d986d2c52 Remove unnecessary braces on pluralization filter
I should amend this, but nobody will notice if I make the commit subject line sound complex enough.
2022-03-29 18:14:55 -05:00
Xevion
fd35443a9a Revamp all model relationships to use backref attributes properly
- Fix new post form not including a CSRF token
- Removed some old leftover comment profanity validation, changed to validate_on_submit() for first time
- Include rest of pluralize macro work with this commit + used pluralizing logic where there once was none
2022-03-29 18:12:07 -05:00
Xevion
db560b7c41 Add pluralizing macro filter to templating engine
- Only some plural edits are included here - some are locked behind commits coming soon™️
- Also made index template statistics variables read better
- Fixed spelling error in CSRF Error template rendering (hadn't hit the page yet)
2022-03-29 18:07:39 -05:00
Xevion
49547e582c Improve License/TOS/Privacy statements 2022-03-29 17:06:56 -05:00
Xevion
839ef370be Create proper edit profile form w/ CSRF & refactor User.about_me null/empty string handling 2022-03-29 16:37:12 -05:00
Xevion
bad80cf483 Add force login method for development, add CSRF tokens to login & signup forms 2022-03-29 16:35:26 -05:00
Xevion
311f061b10 Implement CSRF protection & error page 2022-03-29 16:25:30 -05:00
Xevion
f41b83a15f Apply new form validation features to New Post form
- Use TextAreaField instead of StringField on forms.NewPostForm
- Fixed incorrect remember_me field and redirect in login
- Added placeholder usage to field rendering macro
2022-03-29 15:13:00 -05:00
Xevion
8cf2f02772 Implement new Profanity Checker on Form Validation
Why am I still up doing this at 3am
2022-03-29 03:00:12 -05:00
Xevion
820ecf3d74 Improve form field rendering macro to fix login/signup pages
It now looks less "dogshit" as one might say. Still quite dogshit, but acceptable 'dogshit'.
2022-03-29 02:51:47 -05:00
Xevion
862f58153e Test commit for GPG signing verificiation 2022-03-29 02:33:51 -05:00
Xevion
3b5307ab47 Migrate app to use WTForms for auth form validation
- Not finished yet, major styling breakage in this commit
- Also encapsulated GET & POST requests of /login and /signup routes into one route.
2022-03-29 02:30:19 -05:00
Xevion
2e8688f59b Revamp all form submissions with Flask-WTF forms
- Rename blueprint route 'main.user' to 'main.view_user' for clarity
- Rename 'forms.py' to 'route_forms.py'
2022-03-29 02:00:43 -05:00
Xevion
4968868d3a Add field rendering Macro for new form validation & add Flask-WTF to Pipfile 2022-03-29 01:30:26 -05:00
Xevion
040e505561 Improve/add error messages to look better visually
- Have not tested everywhere, but should work okayish
2022-03-28 18:54:17 -05:00
Xevion
2973f3ca81 Add profanity filter to comment and post creation
- For Heroku, I worry someone might add a racial slur or something. This isn't perfect, but it's good enough.
2022-03-28 18:29:47 -05:00
Xevion
208b9ba674 Fix new post form length filters not redirecting correctly
I never ran into this error myself, but I think if we did, it's possible it could have caused some kind of infinite loop. Or it would just error because the form is mapped to POST requests only - unless the browser would take the redirect and send the POST request there - but that wouldn't make sense given it's normal purpose.
2022-03-28 18:17:52 -05:00
Xevion
c4b22b8632 Attempt to fix database not creating tables 2022-03-28 18:04:45 -05:00
Xevion
2d014628e4 Fix circular imports issue by separating SQLAlchemy db instance into database.py 2022-03-28 17:57:52 -05:00
Xevion
3ea945b99f Add psycopg2 to Pipfile for SQLAlchemy Postgresql support
I'm not sure why this isn't installed automatically, but I guess in order to make sure tons of unused dependencies aren't installed on machines that don't need them as well as all the errors that crop up, it wasn't added.

As a user who's simply using it for deployment and didn't need it for local development, I suppose this is what happens.
2022-03-28 17:41:54 -05:00
Xevion
f5f6f13756 Fix Heroku using now deprecated Postgres DB URI for SQLAlchemy 2022-03-28 17:36:21 -05:00
Xevion
6c4b952004 Change all relative imports to standard imports 2022-03-28 17:30:31 -05:00
Xevion
e6db061500 Fix Gunicorn not finding app in app.py due to __name__ check 2022-03-28 17:27:16 -05:00
Xevion
6dfed98ba3 Rename create_app.py to app.py for Gunicorn command 2022-03-28 17:19:11 -05:00
Xevion
e997d4f67e Re-add gunicorn to Pipfile for Heroku deployment 2022-03-28 17:06:20 -05:00
Xevion
2cd2830d60 Update Pipfile.lock 2022-03-28 17:00:40 -05:00