Commit graph

13622 commits

Author SHA1 Message Date
TLSM
fcb51c09d3
Implement assetcache module with asset hashing.
Provides a module `assetcache` to support automatic cachebusting of
static web assets, rather than the current approach of incrementing
a version number.

On module load, it walks the file/assets/ dir, computes a CRC32 of
each asset, and provides those hashes via `assetcache_get(path)` at
runtime. The primary consumer of hashes at present is the new `asset`
filter for Jinja2, which accepts a relative asset path and returns the
full path, with cache busting, suitable for final use in the template.

Ex: `{{ 'css/main.css' | asset }}`
2022-08-30 16:00:24 -04:00
TLSM
c00533dc6e
Remove unused copyrighted assets. 2022-08-30 14:59:23 -04:00
TLSM
e1244e9496 Fix flask-limiter having null limit_key.
Recently, unrelated changes led to enabling logging for flask-limiter
accidentally, at which point it was discovered that it wasn't actually
limiting requests due to Limiter.key_func = get_CF not being proper
for either prod (not behind Cloudflare) or localhost (likewise).

We instead use the remote_addr attached directly to the request using
the existing flask-limiter function to do so.

Detailed troubleshooting at:
https://github.com/themotte/rDrama/issues/222#issuecomment-1229489062
2022-08-30 06:37:56 -05:00
Julian Rota
27d48226de Remove lack of comment count increment if comment is a reply to self 2022-08-29 14:16:49 -05:00
Julian Rota
288183012e Fix misspelling of "culture ware" 2022-08-29 14:16:18 -05:00
Ben Rog-Wilhelm
de4d923b32 Fix some mod log errors and make it more durable to future changes. 2022-08-27 11:23:12 -05:00
Ben Rog-Wilhelm
74a21234b5
Make the Comments indicator into a link. 2022-08-27 06:33:05 -05:00
TLSM
de29d63a55 Improve tooltip legibility on TheMotte theme. 2022-08-27 06:15:38 -05:00
TLSM
0b332e31bf Fix timestamp tooltips not appearing.
Another JS load order bug, previously fixed upstream. bs_trigger() in
header.js must be run after DOM content is loaded to properly set the
events for tooltips to appear on hover. This commit uses standard
document ready event boilerplate to ensure this happens, regardless
of script load order.
2022-08-27 06:15:38 -05:00
Ben Rog-Wilhelm
210d4d3bc1 Bump cachebusters 2022-08-22 22:14:21 -05:00
Ben Rog-Wilhelm
280e7275a6 Rejigger theme pretty heavily. I apologize for this change not being neatly split apart in any way. 2022-08-22 22:02:39 -05:00
Julian Rota
f4a8b78d56 Fix an error with trying to sanitize really ugly HTML 2022-08-22 09:55:14 -05:00
Julian Rota
2d03dd1984 Remove remaining gumroad stuff 2022-08-22 09:54:35 -05:00
JulianRota
b94ca993da
Merge pull request #205 from zorbathut/pr_signal
Improve signal timeout behavior (from upstream 548030fcf)
2022-08-21 16:20:30 -04:00
JulianRota
8fb730f847
Merge pull request #208 from jgbyrne/leaderboard
Only show /leaderboard link in settings2 menu to admins.
2022-08-21 13:04:11 -04:00
JulianRota
8338bcb640
Merge pull request #207 from jgbyrne/frost
Userpage template: Short circuiting non-null checks for viewing user `v`
2022-08-21 12:58:47 -04:00
Jack Byrne
2adf38a377 Only show /leaderboard link in settings2 menu to admins, also a more polite 403 message, also more readable HTML 2022-08-21 01:44:56 +01:00
Jack Byrne
866c47c914 Userpage template: Short circuiting non-null checks for viewing user v 2022-08-21 01:14:11 +01:00
Ben Rog-Wilhelm
be0cebe67a Improve signal timeout behavior (from upstream 548030fcf) 2022-08-20 03:56:26 -05:00
Ben Rog-Wilhelm
13da98bd08 Add close icon to the install-app popup. 2022-08-19 04:53:02 -05:00
Jack Byrne
6b53867ae1 Post validation: better length validation for post submissions 2022-08-19 04:19:41 -05:00
Julian Rota
f2d657811f Fix the other report button for posts on the comments page 2022-08-19 03:18:35 -05:00
Julian Rota
21c99261e6 Remove polls from help page HTML 2022-08-19 03:16:46 -05:00
TLSM
d005bd6237 Fix desktop header dropdown menu clipping off page.
The width of the account menu dropdown header is determined by the
length of one's username. Users with short names cause the dropdown
menu to partially clip off the right side of the page, which is
unsightly and impedes usage thereof. This commit enforces a minimum
width to prevent that.

Alternate approaches such as right-aligning the dropdown proved
unwieldy with CSS when fixing this same bug on the upstream.
2022-08-17 14:03:11 -05:00
TLSM
965a4dc157 Fix improper calls to Comment.replies.
In four contexts, Comment.replies(.) was not updated to reflect the
interface changes with comment filtering. This directly caused #170
and #172 (which was a stack trace from the former).
  - Updating notifications for DMs (routes/users.py L690)
  - Updating notifications for modmail (routes/users.py L729)
  - morecomments for logged out users (routes/posts.py L421)
  - JSON for API access (classes/comment.py L347)

All four contexts seem to behave correctly after the change. However,
strictly speaking the JSON generation will not include a user's own
filtered or removed comments, though this is hard to remedy without
passing the user object `v` to json_core. Propagating that through the
codebase seems a worse option than leaving it as is.
2022-08-17 14:01:31 -05:00
TLSM
a95f47339d
Cachebust main.css. 2022-08-17 01:55:44 -04:00
TLSM
f1983da8d4
Fix long domains overflowing post-meta (#182).
In submissions and submission_listings, long domains would overflow
the container and generally break everything. Fixed in the template
by truncating the outputted text length and in the frontend by
enforcing a maximum width on the element.
2022-08-17 01:52:38 -04:00
TLSM
345ef7b5e7
Change distinguish color to red (#181). 2022-08-17 01:43:23 -04:00
TLSM
4cfd1d5a5b
Fix 2FA modal not displaying in UI (#178). (#180)
Fixes issue #178. Root cause was attempting to document.getElementById
of both modal and toggle input before both were loaded into the DOM.
In the upstream, Cloudflare's Rocket Loader is used, which papers over
many cases of inattention to loading order.
2022-08-16 22:38:19 -05:00
painejohn
defe23ea16
Update comment reply css + clear preview as well (#158)
This basically extends the CSS changes from
https://github.com/themotte/rDrama/pull/150 to also cover comment
_replies_ and then updates the JS from
https://github.com/themotte/rDrama/pull/153 to also reset the comment
reply preview div back to default after posting the comment reply.
2022-08-10 06:04:54 -05:00
Michael House
b5b1f79394
Merge pull request #155 from zorbathut/pr_deussy
Remove culture-warrish instances of `ussy` and `igger`.
2022-08-07 11:11:32 -05:00
Ben Rog-Wilhelm
ade79962b5 Include another section that somehow got lost 2022-08-07 10:19:26 -05:00
Michael House
8570b92d3d
Merge pull request #156 from zorbathut/pr_examplecull
Remove obsolete formatting help.
2022-08-07 08:02:19 -05:00
Ben Rog-Wilhelm
da19c8cb11 Remove marquee support from the formatting, because, uh, no. 2022-08-07 02:28:35 -05:00
Ben Rog-Wilhelm
d377889a13 Remove obsolete formatting help. 2022-08-07 02:26:59 -05:00
Ben Rog-Wilhelm
d844b6c340 Remove culture-warrish instances of ussy and igger. 2022-08-07 02:09:05 -05:00
painejohn
cbcc2aac6f
139: Disabled multimedia embedding
This change disables multimedia embedding:

- In comments and comments replies.
- In new submissions.
- In comment & submission preview

And it's all toggle-able via an envvar, except for the JS bits,
but I linked those to the github issue, so should be easy to find
in the future.

The way it works is:

- removes markdown image/video syntax,
  eg. `![](https://example.org/someimage.jpg)` into ``
- changes link text into anchors, eg.
  `https://example.org/someimage.jpg` into
  `[https://example.org/someimage.jpg](https://example.org/someimage.jpg)`
- removes html img/video/audio tags, eg.
  `<img href="https://example.org/someimage.jpg" />` into ``
- when embedding gifs via the giphy modal in "new submission", it will
  insert only an anchor to the gif
- when attaching an image, it will upload the image, then add only an
  anchor to the post/comment body

I tested this manually, but not sure if I got all the test cases. What I
checked was:

- create comment w/ image/video/audio media using markdown -> success
- create comment reply w/ image/video/audio media using markdown ->
  success
- create comment w/ link to img/imgur/youtube/audio -> success
- create comment w/ attachment -> success
- create comment reply w/ attachment -> success
- create comment w/ img/video tag -> success
- create comment reply w/ image/video tag -> success
- create post submission w/ image/video/media using markdown -> success
- create post submission w/ link to img/imgur/youtube/audio -> success
- create post submission w/ attachment -> success
- create post submission w/ giphy gif -> success

Also, updated the formatting page.

Co-authored-by: Ben Rog-Wilhelm <zorba-github@pavlovian.net>
2022-08-07 01:30:47 -05:00
painejohn
8463a9ebbe
135 - Posting a comment clears out comment textarea & preview 2022-08-07 01:17:46 -05:00
painejohn
4e8fef2ef0 115: Add cap on number of mentions
This caps the number of mentions in a submission or comment to
MENTION_LIMIT, which is set to 100 by default. When limit is exceeded,
returns a helpful message to the user.
2022-08-07 00:54:47 -05:00
Michael House
10b5823721
Merge branch 'frost' into pr_sitename 2022-08-01 15:21:56 -05:00
Michael House
2def49ccbd
Merge pull request #147 from zorbathut/pr_welcome
Update welcome message.
2022-08-01 15:14:29 -05:00
painejohn
19385b249f 141 - Comment preview is obviously a preview
This PR reworks the comment preview to include a border and initial
message identifying it as "Comment preview". It also bumps all the
TheMotte.css versions from 56 to 57.
2022-08-01 14:39:03 -05:00
Ben Rog-Wilhelm
800ae8d2dc Split SITE_NAME into computer-readable SITE_ID and human-readable SITE_TITLE. 2022-07-31 18:53:18 -05:00
Ben Rog-Wilhelm
8c818adbd2 Update welcome message. 2022-07-31 18:21:12 -05:00
Julian Rota
850d175563 Fix editing posts 2022-07-31 17:22:43 -05:00
Julian Rota
96563c6d35 Add check for user existing 2022-07-31 16:58:01 -05:00
Ben Rog-Wilhelm
7393013f60 Fix ACX link. 2022-07-29 14:32:27 -05:00
Ben Rog-Wilhelm
7b4a4f21d0 Update sidebar. 2022-07-29 14:30:06 -05:00
Ben Rog-Wilhelm
2948d66a81 Remove the site name from the OpenGraph description. 2022-07-29 10:02:29 -05:00
JulianRota
cc85b28288
Merge pull request #123 from zorbathut/pr_linearvote
Make downvotes actually reduce user karma.
2022-07-29 10:17:18 -04:00