Commit graph

13633 commits

Author SHA1 Message Date
TLSM
129d644a3f Add active user counter logic; add to admin tools.
Ports in lightly modified logic from the upstream which tracks active
sessions to provide counters and listings to understand site traffic
in the admin panel.
2022-09-05 00:44:13 -05:00
TLSM
ecbd8179b9 Fix #238: remove "Get Them Help" button. 2022-09-05 00:44:13 -05:00
TLSM
2077ac4f83 Port in valid RSS feed creation from upstream. 2022-09-05 00:44:13 -05:00
TLSM
e12b0eea1a Remove treasure rewards for comments.
Given that coins are not visible in many contexts, the conspicuous
appearance of treasure chests (random coin rewards on 1% of comments)
seems out of place. This removes the logic which rewards treasure,
the visible display of treasure, and drops the column containing
treasure information which has already been awarded to at least one
comment on prod.
2022-09-04 19:12:30 -05:00
TLSM
cccb26cb3f Fix contrast: blockquotes, prev/next, new comments.
Style changes in three contexts, especially for contrast/visibility:
  - Highlighting for new comments is now _much_ lighter.
  - Blockquotes display similarly to reddit-style: slightly muted
    text with a grey bar to the left but no background otherwise.
  - Prev/Next pagination for listings now readable and distinct.

Only applied to TheMotte.css, since it seems the one with complaints.
2022-09-04 19:12:30 -05:00
TLSM
b31e1874dd Fix #230: present pinned posts first in all sorts. 2022-09-04 19:11:42 -05:00
TLSM
fd3fd7e04e Fix Limiter not using remote address as key. 2022-09-04 19:11:24 -05:00
JulianRota
9657adbebf
Merge pull request #227 from TLSM/rework-assets
Rework assets to use automatic cachebusting (#127).
2022-09-01 00:28:39 -04:00
TLSM
a35697e55e
Replace nearly all ?v= cachebusts with assetcache.
Using the new assetcache module, we replace (almost) all instances
of `?v=` cachebusting query parameters in Python and in Jinja templates.
The primary exceptions were: user site backgrounds, and some
infrequently changed graphics referenced literally from .js files.
2022-08-30 17:02:46 -04:00
TLSM
6f3b995455
assetcache: add interface for non-Jinja consumers.
Rather than generating the URL in helpers/jinja2.py, we move the logic
to helpers/assetcache.py because there are consumers of asset URLs
in Python code (for better or for worse).
2022-08-30 16:23:09 -04:00
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
b2773cbb40
Clarify permabanned forbidden messages.
Fixes #221. Provides custom message behavior for the user DM route
and slightly refactors the `@is_not_permabanned` wrapper to not be
deliberately misleading to users.
2022-08-30 13:35:02 -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