Commit Graph

124 Commits

Author SHA1 Message Date
000efdaec6 Add ReplyBuilder.matches method to check if the current remaining string starts with the given prefix
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-23 18:14:01 -07:00
5164842289 Add blank=True for Post.user_token
This was preventing tests from passing and having a blanked-out user
token, which is OK

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-23 18:05:04 -07:00
c22eff1676 Add spoiler escape
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-20 01:26:41 -07:00
83e0a5b84e Add spoiler tags
Boards can have spoiler processors enabled on them now.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-20 01:18:06 -07:00
b299f4f548 Fix small posting bug
User name may not always be filled out and that causes errors if not
set

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-20 01:00:48 -07:00
d4cef8d552 Add board.hidden migration
whoops

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-20 00:45:02 -07:00
8c6c05b264 Add hidden boards
Hidden boards are excluded from the board listing.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-20 00:43:22 -07:00
c53111ea60 Add user tripcodes
Users can separate their name and a password with ## to create the
illusion of consistent posting.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-20 00:28:02 -07:00
8f4b6d7aea Add navbar to home, news, and rules pages
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-19 22:34:58 -07:00
6b5632d483 Add home, news, and rules links to nav bar
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-19 22:34:26 -07:00
68d2d26b46 Move board navbar to be in the board and post view only
While it's a neat idea to put it on every page, it was also appearing on
*every page* - including stuff like "delete post" page and reply windows
and stuff.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-19 19:50:22 -07:00
7c73d1ff36 Remove debugging message from reports context processor
Whoops!

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-19 19:47:33 -07:00
60441aa5d9 Add initial navbar
This includes all boards, as well as report counts if the user is an
admin.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-19 19:45:36 -07:00
2fd9b17b37 Add news_snippet.html
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-19 19:08:15 -07:00
b2cb1536c1 Add recent news header to boards and posts
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-19 18:59:25 -07:00
d15816fdc4 Add reply to this thread link to the bottom of the post view
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-18 22:09:11 -07:00
1173cc16cb Add 25px margin to top and bottom of threads on the board
This should hopefully visually separate things a little better.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-18 19:38:04 -07:00
08b4fe0086 Fix post ordering in reply view
I think this was database-specific. Replies should now be ordered by
their ID.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-18 19:10:04 -07:00
08acfa327c Add initial migrations
I was putting this off during initial development so that experiments
and toying around with models would not be saved in the history,
especially if rebuilding the entire database was required. Now that the
models are in a more stable place, we can start tracking migrations.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-17 19:50:47 -07:00
412ae8f632 Add "boards" context processor
This adds the "boards" context data to all pages, so they can render the
boards nav page.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-17 19:49:17 -07:00
0bc7a043ea Add new rule
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-17 18:55:02 -07:00
89849cf034 Add site title to all pages
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-17 18:53:56 -07:00
1da0e87c54 Add site name config, settings context processor, and site branding to every page
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-17 18:17:31 -07:00
4709f5567e Add home and rules pages
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-17 18:16:30 -07:00
b40b65bef6 Add restricted.css for future styles that are accessible by admin-only
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-17 17:49:12 -07:00
bd970943de Add user IP and token to posts in-line for staff
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-17 17:48:12 -07:00
0b0c0fe603 Update wipe to check user token as well as user IP
Wiping is done via a single user post. It will search for all posts by
that IP address *or* user token and delete them.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-17 17:02:51 -07:00
1856adaf3b Add user post wiping
If a user has spammed a lot of posts and made a mess of the board, this
will allow us to delete all posts by the offending user from the same
IP.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-17 16:59:23 -07:00
8ea95a927c Move modify.js + ban.js => restricted.js
Further in on restricted JS to simplify things. Rather than breaking out
all Javascript stuff into their own granular files, this just includes
all admin actions together in the same file.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-17 15:56:44 -07:00
1a2ac653d7 Fix /banned/ page redirect error
The URL routing for /banned/ was going to the board controller because it
would match /banned/ as a board URL rather than its verbatim value. This
is fixed by moving the board route match to the bottom of the URL
routing list.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-17 15:47:46 -07:00
794db714de Remove can_modify context variable, use is_staff instead
For both ban and modify actions, we trust staff users to not abuse
otherwise-secret scripts and links. We don't supply "can_modify" context
variable anymore and just use user.is_staff instead. The same goes for
ban links and scripts.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-17 15:32:10 -07:00
e686c3b235 Add ActionSuccessView
ActionSuccessView is a a generic view that indicates that something was
successful, e.g. deleting a post or banning a user. This hopefully
reduces the amount of boilerplate code used for creating success pages
since most of them can derive from this generic view.

The report and delete success views are updated to use this directly.

The ban and modify success views are updated to derive from this class,
with special permissions required.

The post success view is updated to derive from this class, using a
different template.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-17 15:08:33 -07:00
bfd3dedb09 Better positioning of ban window
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-14 00:08:56 -07:00
996e75dc2a Add news posts
You know. For basic information.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 23:01:51 -07:00
a4f00e6242 Add user post deletion
Users can delete their posts as long as they don't clear their cookies,
and as long as server-side user sessions are persistent.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 21:28:07 -07:00
96e8b7752f Yet more unnecessary field removal
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 15:44:52 -07:00
a1483007b7 Remove unnecessary fields from boardview
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 15:42:27 -07:00
708e232e49 Remove unnecessary fields from PostView
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 15:36:17 -07:00
83533b5fb4 Add post and image deletion
This one was kind of a doozy. This also adds a custom 403 error page and
fixes some permission denied behavior that I was having issues with for
a while.

This is also set up in a way that hopefully will allow me to easily
implement user post deletion.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 15:19:20 -07:00
6ff64a3299 Rename {post_create,post_modify,reply_create}_view.html
This drops the _view suffix of each of these, makes it more consistent
and less of a chore to type.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 13:16:57 -07:00
f54337a139 Add report cooldowns
This is to prevent report flooding/spamming.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 13:06:33 -07:00
f04604ce69 Users may only report a post once per IP address.
If a user *really* doesn't like a post, they may try to report it
multiple times. Users may now only report a single post once per IP
address.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 12:35:57 -07:00
f131c58d1b Add post hiding
This allows users to hide posts that they may find unsavory. On threads
themselves in the board view, this adds a minus/plus button that will
toggle back and forth if hidden. This also adds a post menu item that
will toggle a post being hidden.

This also changes the post snippet layout a little bit. This caused
minor issues with the other menu items, but it should be fixed in this
set of changes too.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 12:03:09 -07:00
089913c8fe Center some text on the board and post detail views
The board name and the "create new thread/reply" links are now centered.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 22:39:24 -07:00
925c17675f Add inline image expansion
Clicking an image will expand it.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 22:26:51 -07:00
0d6b6ca5b5 Add image hover
If a user hovers over an image with their mouse, it will load the image
and display it in the corner.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 22:02:51 -07:00
b646509f75 Update post information to come before the image info in a post
The post number, username, subject, etc all come before the an image (if
there is one) now, rather than sorta wedged afterwards. This seems to be
working.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 21:17:19 -07:00
c8fd8ffa89 Update Post.get_absolute_url() to always include the post ID
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 21:16:38 -07:00
3f1615f058 Add post count, image count, and unique posters to post detail
Just like 4chan has!!!!!!!

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 21:12:16 -07:00
5df21ccb95 Add poster name saving via cookie
When a user makes a new post with a name set, it will get saved via a
cookie to the user's client and it will automatically get set the next
time a user makes a post.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 20:28:21 -07:00