Commit graph

15671 commits

Author SHA1 Message Date
Ben Rog-Wilhelm
e75634f40a Volunteer Janitor: Visual design for Submit page. 2022-12-01 18:53:24 -08:00
Ben Rog-Wilhelm
78cced0c37 Volunteer Janitor: Visual design for Teaser page. 2022-12-01 18:53:24 -08:00
Ben Rog-Wilhelm
b80fe29545 Volunteer Janitor: Initial checkin of images. 2022-12-01 18:53:24 -08:00
Ben Rog-Wilhelm
0f91324603 Volunteer Janitor: Response recording. 2022-12-01 18:53:24 -08:00
Ben Rog-Wilhelm
0a8bbae290 Volunteer Janitor: Record accepted tasks. 2022-12-01 18:53:24 -08:00
Ben Rog-Wilhelm
03b323c7a1 Volunteer Janitor: Initial duty acquisition. 2022-12-01 18:53:24 -08:00
Ben Rog-Wilhelm
e43db0535d Volunteer Janitor: Initial hooks. 2022-12-01 18:53:24 -08:00
TLSM
afe209d5d8
Eager load comments for post rendering.
GET /post/1/clever-unique-post-title-number-0
|----------|--------|--------|--------|--------|--------|------------|
| Database | SELECT | INSERT | UPDATE | DELETE | Totals | Duplicates |
|----------|--------|--------|--------|--------|--------|------------|
| default  |  942   |   0    |   1    |   0    |  943   |    921     |
|----------|--------|--------|--------|--------|--------|------------|
Total queries: 943 in 0.377s # request time in browser 17249ms

GET /post/1/clever-unique-post-title-number-0
|----------|--------|--------|--------|--------|--------|------------|
| Database | SELECT | INSERT | UPDATE | DELETE | Totals | Duplicates |
|----------|--------|--------|--------|--------|--------|------------|
| default  |   58   |   0    |   1    |   0    |   59   |     35     |
|----------|--------|--------|--------|--------|--------|------------|
Total queries: 59 in 0.0423s # request time in browser 544ms

Also, fixes seed_db not populating top_comment_id on generated
comments. If you want to test locally with seed_db test data, you need
to reseed.
2022-11-28 17:47:54 -05:00
TLSM
5aaef144cf
Deduplicate post/comment sorting & time filtering.
Ported in from upstream with adjustments for TheMotte, most notably
universal default to 'new' and fixes to 'hot'. Lumped into this PR
because eager comment loading uses it.
2022-11-28 14:33:24 -05:00
TLSM
4d22d9bce2
Eager load get_posts for submission_listings.
Ported in logic from upstream to use SQLAlchemy eager loading instead
of repeated queries when building a submission_listing. Adjusted
loaded relationships to include only those used on TheMotte.

Using test data from seed_db, before and after:

GET /
|----------|--------|--------|--------|--------|--------|------------|
| Database | SELECT | INSERT | UPDATE | DELETE | Totals | Duplicates |
|----------|--------|--------|--------|--------|--------|------------|
| default  |   83   |   0    |   0    |   0    |   83   |     72     |
|----------|--------|--------|--------|--------|--------|------------|
Total queries: 83 in 0.031s

GET /
|----------|--------|--------|--------|--------|--------|------------|
| Database | SELECT | INSERT | UPDATE | DELETE | Totals | Duplicates |
|----------|--------|--------|--------|--------|--------|------------|
| default  |   14   |   0    |   0    |   0    |   14   |     0      |
|----------|--------|--------|--------|--------|--------|------------|
Total queries: 14 in 0.00718s
2022-11-28 12:55:31 -05:00
TLSM
9953c5763c
Port get.py improvements from upstream.
Generally standardizes the get_* helpers:
 - Adds type hinting.
 - Deduplicates block property addition.
 - Respects `graceful` in more contexts.
 - More resilient to invalid user input / less boilerplate necessary
   at call-sites.
2022-11-28 12:36:04 -05:00
justcool393
8a9e1bc54a
titles: use rdrama's title finding code (#425)
* titles: use rdrama's title finding code
this fixes a potential DoS in some really weird pages (seems to be a bug with BS4)
we're not parsing arbitrary HTML
in addition we make some nice checks

* unescape title to fix bug from upstream

* fix nameerror

* Do not proxy requests, since no proxy available.

On the upstream, the `proxies` dict was intended to use a local SOCKS
proxy running on port 18080 with the express purpose of masking the
server IP address. TheMotte isn't running behind a reverse proxy, so
this purpose is moot. Additionally, we don't have a proxy running in
Docker nor do we appear to have one on prod, which breaks autotitle
and thumbnailing regardless--not sure it matters for TheMotte's
use case, but both codepaths have been inoperative because of it.

* use gevent to timeout the function to prevent a
second theoretical DoS by sending data rly slowly
ref: 816389cf28

Co-authored-by: TLSM <duolsm@outlook.com>
2022-11-28 07:52:15 -08:00
Ben Rog-Wilhelm
c3f4b540d0 Disable file caching in debug mode. 2022-11-28 07:48:14 -08:00
justcool393
6b832aba99 admin: remove unused admin pages 2022-11-21 13:06:29 -06:00
justcool393
23e64d176d
discord: remove 2022-11-21 12:39:27 -06:00
Ben Rog-Wilhelm
dc50d4f1cc Fix: Bad Readme editing job by yours truly. 2022-11-21 10:25:28 -06:00
Ben Rog-Wilhelm
7e25af2fa0 Fix: Changes to the User table cause unavoidable breakages in the Leaderboard system. 2022-11-21 10:09:17 -06:00
Ben Rog-Wilhelm
18437003cf Beef up the Production check a little and do true comparison correctly. 2022-11-21 09:43:07 -06:00
justcool393
2067875c6a themes: remove /r/Drama theme ("classic" and "classic_dark") 2022-11-21 06:13:12 -06:00
justcool393
86c0eea85a security: add ENFORCE_PRODUCTION
can provide a safety check so debug mode never gets enabled on production environments by accident
2022-11-21 06:11:03 -06:00
Ben Rog-Wilhelm
0db174b90b Fix: An unfortunately-placed linebreak. 2022-11-21 06:10:10 -06:00
justcool393
65fada8155 awards: remove grass 2022-11-19 10:21:30 -06:00
Ben Rog-Wilhelm
377d51c2f8 Support full Flask debug mode. 2022-11-19 03:34:52 -06:00
Ben Rog-Wilhelm
cd74a5cd6c Add a little extra text to tests so that long waits are less unexpected 2022-11-19 02:55:59 -06:00
Ben Rog-Wilhelm
12881b02e2 Fix: Users with underscores in their name can't log in by underscore. 2022-11-13 18:20:24 -06:00
Ben Rog-Wilhelm
060e3967fd Minor tweak to usernote click handle. 2022-11-13 14:44:20 -06:00
Ben Rog-Wilhelm
dcf11531c1 Fix: One more spot with usernote leakage. 2022-11-13 14:38:23 -06:00
Ben Rog-Wilhelm
db1d346b21 Fix: Email regex pattern is inconsistent. 2022-11-13 14:37:18 -06:00
Ben Rog-Wilhelm
808eb256ac Fix: One more spot that I missed! 2022-11-11 16:21:21 -06:00
Ben Rog-Wilhelm
127aed8dd0 Fix: Usernotes no longer actually work. 2022-11-11 16:17:37 -06:00
Ben Rog-Wilhelm
583f4131dc Fix: Mod usernotes leaked to the public. 2022-11-11 15:08:01 -06:00
Ben Rog-Wilhelm
2c0124d4a1 Update lockfile. 2022-11-11 09:43:30 -06:00
Ben Rog-Wilhelm
965d9b30b3 Make proper use of defaultdict. 2022-11-11 09:43:15 -06:00
Ben Rog-Wilhelm
1437bc3092 Rig up a query-frequency analyzer with the most commonly seen callstack, including Jinja demangling. 2022-11-11 09:43:15 -06:00
Ben Rog-Wilhelm
6b55cc1f5b Initial checkin of customizable sqlalchemy-easy-profile. 2022-11-11 09:43:15 -06:00
Ben Rog-Wilhelm
937d36de31
A large number of small tooling and README updates. 2022-11-10 16:43:26 -06:00
Ben Rog-Wilhelm
adc24ec91e
Add Dev Mode and fix test race conditions. 2022-11-09 21:29:18 -06:00
Ben Rog-Wilhelm
947453869e
Merge pull request #405 from justcool393/remove-more-dramaisms
Remove more dramaisms
2022-11-09 20:51:18 -06:00
Ben Rog-Wilhelm
7c72815dcc
Merge branch 'frost' into remove-more-dramaisms 2022-11-09 20:45:31 -06:00
TLSM
8949b57609 Remove unused ADMINISTRATORS content upload posts.
The ADMINISTRATORS list contained hardcoded post IDs (in the 30000s)
intended to be used for uploading graphical assets onto a production
instance of the site. This functionality is not needed here, and the
special logic to bypass awards when commenting on those posts was
largely removed in 9d4195a89f.
2022-11-09 20:37:04 -06:00
TLSM
3f360bb457 Remove special cases for unused awards.
Removes the following awards / fields on User:
 - flairlock
 - progressivestack
 - bird
 - longpost (pizzashill)
 - marseyawarded
 - rehab
 - deflector
 - mute
 - unmutable
 - eye (All-Seeing Eye)
 - alt (Alt-Seeing Eye)

Primarily motivated by starting to remove some un-Mottelike cruft
from core commenting/posting routes. Cleared out other inapplicable
awards while in the process.
2022-11-09 20:37:04 -06:00
TLSM
9de6f20dea Remove vestigial user ID special cases. 2022-11-09 20:37:04 -06:00
TLSM
010c56a35e Implement #380: remove signatures feature. 2022-11-09 20:37:04 -06:00
TLSM
c85cd469a1 Move post/comment ID boilerplate inside getters.
Borrows code from the upstream which has been working in production
reliably for ~months. Also, most of it was literally copy-pasted,
and the casted ID values aren't used later in the route functions.
2022-11-09 20:37:04 -06:00
justcool393
793273f638 remove beano award (doesn't conflict with @TLSM's commit ☺) 2022-11-07 04:36:41 -06:00
justcool393
37841c9b0f admins are friends not food
paypigs is a bit... lol
2022-11-07 03:56:27 -06:00
justcool393
79b9c08f6c delete marseys route (just 500s) 2022-11-07 03:48:47 -06:00
justcool393
2fabe6d010 remove "meme admin" functionality
(JL1, which doesn't actually have any real use on the site, and their "meme" status is hidden to non-admins anyway)
2022-11-07 03:33:56 -06:00
justcool393
51ef10d7c3 remove vestiges of fart mode 2022-11-07 03:30:31 -06:00
TLSM
1018cf3412 Fix #261: only show lineal parents in contexts. 2022-11-06 03:13:10 -06:00