Commit Graph

1771 Commits (a5ec730bb82bd9574c5762e4d38ecbdd0c9ee6b9)

Author SHA1 Message Date
Aevann1 77c1f96383 remove empty anchor tags 2022-07-02 02:54:59 +02:00
Aevann1 28786342dc fix snappy archiving images 2022-07-02 02:25:58 +02:00
Aevann1 f56be06eb8 add hole pinning 2022-07-02 01:11:48 +02:00
Aevann1 9ffc3015e2 testing 2022-07-01 20:09:56 +02:00
Aevann1 e8f5827c5e more testing 2022-07-01 15:34:11 +02:00
Aevann1 1676572f09 test 2022-07-01 15:15:44 +02:00
Aevann1 5bbd14ebd6 testing 2022-07-01 15:11:41 +02:00
Aevann1 2fd8e88ceb try fixing inbound bandwidth 2022-07-01 13:32:01 +02:00
Snakes 1b9237ceaf Add assetcache.asset_siteimg, has_logo.
Commit began by changing the duplicated SITE_NAME conditional in the
header to use a `has_logo` param, much like the recent `has_sidebar`.
From there, a need to include site-specific assets in assetcache was
revealed, adding the `asset_siteimg(...)` macro. This was applied
quite broadly, though not comprehensively.
2022-07-01 01:55:53 -04:00
Snakes 39c945f7ca LGB: Initial sidebar & const. 2022-07-01 01:08:15 -04:00
Aevann1 05aa116a8a cutting down on query volume 2022-07-01 03:18:06 +02:00
Aevann1 461eba7427 fix issue with reddit domain replacement 2022-07-01 01:06:39 +02:00
Aevann1 cba02b9e4b fix issue with code blocks 2022-07-01 01:01:10 +02:00
Aevann1 95dc6bc4f3 fix old.reddit bug 2022-07-01 00:39:48 +02:00
Aevann1 aa53296d07 Revert "remove "filter" from allowed styles"
This reverts commit 14d929623e.
2022-07-01 00:18:05 +02:00
Aevann1 14d929623e remove "filter" from allowed styles 2022-07-01 00:03:32 +02:00
Aevann1 070945d98a cut down on the number of queries 2022-06-29 09:22:18 +02:00
Aevann1 790a814b36 make "show more" button look nicer 2022-06-29 04:35:52 +02:00
Aevann1 e7460874e9 double the timeout duration for sanitize() 2022-06-29 03:39:33 +02:00
Aevann1 b6a5d010ca add "show more..." button 2022-06-29 02:55:44 +02:00
Aevann1 3ed41a0835 remove insane number of line breaks in rendered HTML 2022-06-29 01:53:41 +02:00
Snakes 08c2ec7223 Make pin disabling site-specific. 2022-06-28 02:27:25 -04:00
Aevann1 42a6b5731a sneed 2022-06-28 08:17:21 +02:00
Aevann1 4580cf534d fix strikethrough regex 2022-06-28 08:05:49 +02:00
Aevann1 b873492dd0 fix strikethrough, v2 2022-06-28 07:52:29 +02:00
Aevann1 50121f6960 fixed strikethrough 2022-06-28 07:41:21 +02:00
Aevann1 cd811d7b9d consistent lottershe naming 2022-06-28 02:54:44 +02:00
Aevann1 a0cb5874cc refactor push notifs 2022-06-27 21:02:24 +02:00
Snakes d68f2a604a Check bot award timers more frequently.
Also: change to docker-compose.yml is to see if it'll fix the Github
tests failing. Lumped in here because it's too dumb to make a commit
for by itself.
2022-06-27 02:15:35 -04:00
Aevann1 e527dec36b fix mentions in marquees 2022-06-27 07:14:45 +02:00
Snakes 1d500917ad Improve header currency display style. 2022-06-27 00:09:32 -04:00
Aevann1 52a8a219ae make poorcel-mode device-specific 2022-06-27 05:46:32 +02:00
Aevann1 46c9c719d0 fixed 500 error 2022-06-27 04:22:12 +02:00
Aevann1 b5d993569f embed rework 2022-06-27 03:00:45 +02:00
Snakes e0c3c79902 WPD: Require flairs on all posts. 2022-06-26 03:42:56 -04:00
Snakes 268c23e2f8 WPD: make holes more flair-like in UI. 2022-06-26 03:42:15 -04:00
Snakes cd556b6d8e Refactor UI name of hole/sub to constant. 2022-06-26 03:41:28 -04:00
Aevann1 1367d944da commit only when status code is 200 2022-06-26 07:37:36 +02:00
Aevann1 3b8188fd67 fixed version of d83d47e280 2022-06-26 03:22:05 +02:00
Aevann1 a1b137447e Revert "reduce query volume #1"
This reverts commit d83d47e280.
2022-06-26 03:12:31 +02:00
Aevann1 cff34fb3a4 reducing query volume, #2 2022-06-26 03:11:02 +02:00
Aevann1 d83d47e280 reduce query volume #1 2022-06-26 02:50:47 +02:00
Aevann1 c1d227e2b6 exclude poll bots from "simps for" lists 2022-06-25 22:24:47 +02:00
Snakes aaf718c78c Fix timeout in sanitize from link_fix_regex.
h/t to @official-techsupport for finding and help fixing this bug.
When given certain pathological input, `sanitize` would time out
(notably only on posts, rather than comments, perhaps due to the
longer maximum length of input). For example, using as input the
result of:

    with open("test.txt", "w") as f:
        for i in range(26):
            f.write(f":{chr(ord('a') + i)}: ")
        f.write('x' * 20_000)

We believe this to be because of some combination of the greedy
quantifiers and the negative lookahead before the match. The regex
was rewritten to (in theory) have much more linear performance.
2022-06-25 01:28:43 -04:00
Aevann1 c5c21da76f validate colors 2022-06-24 19:32:31 +02:00
Aevann1 f34c4e1196 stop using app.config for our own stuff 2022-06-24 17:08:57 +02:00
Aevann1 fcf600cb35 fix this https://chapotraphouse.club/post/79771/workaholics-are-worse-for-society-than/2183396?context=8#context 2022-06-24 16:45:19 +02:00
Aevann1 9593dc58dd move regex from helpers.const into its own helper file 2022-06-24 16:30:59 +02:00
Aevann1 6f6d01c1c6 actually use the get functions 2022-06-24 15:19:53 +02:00
Snakes ce79b1d84b PCM: lottery duration back to 1wk. 2022-06-23 22:40:51 -04:00
Aevann1 6463cbd1f4 "kike" slur filter modification 2022-06-24 00:33:39 +02:00
Aevann1 cff28b2070 add i.reddit.com to reddit_domain_regex 2022-06-23 22:00:49 +02:00
Aevann1 2c1d1aceff fix this https://chapotraphouse.club/post/18459/marseycapywalking-megathread-for-bugs-and-suggestions/2178607?context=8#context 2022-06-23 21:43:49 +02:00
Aevann1 810e80c010 fix issue with snappy url archival 2022-06-23 21:41:23 +02:00
Aevann1 39cf7fc48b refactor normalizing urls at runtime (I put the function in comment.py cuz there were weird import errors that i didnt wanna fix) 2022-06-23 17:47:57 +02:00
gooseman 6fec7d51d9 make me notified (#308) 2022-06-22 21:37:27 -04:00
Aevann1 e42227ab67 add glowie marseys 2022-06-23 02:34:37 +02:00
Aevann1 233f24c0c4 make reddit notifs look neater (again) 2022-06-23 01:45:09 +02:00
Aevann1 262138b542 make reddit notifications look neater 2022-06-23 01:16:59 +02:00
Aevann1 8f2c2885d2 include psot body in reddit mentions too 2022-06-23 00:40:53 +02:00
Aevann1 0e1177843e remove the need for alert flag on sanitize() 2022-06-23 00:12:47 +02:00
Snakes 26273d0997 Revert "delete empty <a> tags to prevent exploits"
This reverts commit 5f78b4e365.

This commit is breaking @-mentions in a great many contexts and
I'm not quite sure how to fix it right now.
2022-06-22 18:00:23 -04:00
Aevann1 5f78b4e365 delete empty <a> tags to prevent exploits 2022-06-22 23:12:02 +02:00
Aevann1 365d21ff9c fix this https://i.imgur.com/F0OiGKH.png 2022-06-22 23:00:09 +02:00
Aevann1 e1d0269a81 fix 413 error for patrons 2022-06-22 21:12:12 +02:00
Aevann1 ebdda8c412 add poll_thread (fix) 2022-06-22 20:01:22 +02:00
Aevann1 414eb12410 add poll_thread 2022-06-22 20:01:00 +02:00
Aevann1 71d892a8a9 get file extension 2022-06-22 19:44:43 +02:00
Aevann1 20585ca543 add a shortened endpoint for static images and rename loading.webp to l.webp (to save bytes) 2022-06-22 17:51:19 +02:00
Snakes e2cd25db67 WPD: limit hole creation to JL2+. 2022-06-21 01:20:21 -04:00
Snakes 4166b2d2f0 Content: chadsoy x2, more neo-gTLDs. 2022-06-21 01:03:33 -04:00
Marco Rebhan 3c5e2c9455 Include message text in off-site mentions 2022-06-20 18:32:46 -04:00
Snakes f59556cac3 stats: add WAU based on activity timestamp. 2022-06-20 16:33:47 -04:00
Snakes f6b6997f61 Persist activity timestamp to users. 2022-06-20 16:25:03 -04:00
Snakes dee8eb5154 Replace loading.webp with new marseyloading. 2022-06-19 22:15:33 -04:00
Aevann1 7c5e8c04b0 add .dev tld 2022-06-19 22:32:12 +02:00
Aevann1 ef3fbbf520 adjusting greentext regex 2022-06-19 22:22:36 +02:00
Aevann1 f77a7b7cfc fixed double quoting and triple quoting, etc 2022-06-19 20:21:25 +02:00
Aevann1 3eb788103c allow only ascii characters in links (https://rdrama.net/comment/2150032) 2022-06-19 19:25:55 +02:00
Aevann1 d9cdbd0015 return to only allowing images/videos/audio 2022-06-19 18:56:45 +02:00
Aevann1 5ddde69ac9 greentext fix 2022-06-19 17:22:06 +02:00
Aevann1 45b1b61760 added greentext 2022-06-19 17:05:50 +02:00
Aevann1 06677d269e refactor process_video 2022-06-19 16:49:44 +02:00
Aevann1 5d74693c22 try converting webm to mp4 2022-06-19 15:03:14 +02:00
Snakes e5193cbd46 Fix mention sanitize when `g.v` not present.
This bug was discovered when lottery.check_if_end_lottery_task was
failing due to a stack trace thru end_lottery session < badge_grant
< send_repeatable_notifications < sanitize L208. In particular, when
`flask cron` (helpers/cron.py) executes, it does not set g.v, whereas
this code previously assumed that g.v : (None + User) and did not
check for its presence.
2022-06-18 21:22:04 -04:00
Aevann1 193615a441 make sure thumbnails are always lower than 8 MB 2022-06-18 23:11:53 +02:00
Aevann1 eba4452d79 fix 500 error 2022-06-18 22:41:00 +02:00
Aevann1 b34dd88560 remove legacy code in video upload (thx @everyone) 2022-06-18 18:23:10 +02:00
Aevann1 453d83856e add .press tld 2022-06-18 18:07:57 +02:00
Aevann1 ccdabcba29 allow uploading of all types of files (using lain.la)
+ allow multiple file upload in bios and messaging admins
2022-06-18 17:53:34 +02:00
Aevann1 56f8cf793e give visible bots a body column (so their comments are searchable)
+ don't sanitize zoz/longpostbot/aj comments
2022-06-18 17:37:01 +02:00
Aevann1 f60db1598d replace "g.db.query" on pkeys with the much more efficient "g.db.get" 2022-06-18 02:57:23 +02:00
Aevann1 c01d53aa0d make mentioning case-insensitive again 2022-06-18 00:03:23 +02:00
Aevann1 fae0bee0d9 Refactored mention sanitization (stolen commit from themotte) 2022-06-17 22:37:27 +02:00
Aevann1 a771596d25 videos bullshit 2022-06-17 22:23:04 +02:00
Aevann1 38c12209fb move from os.sytem to subprocess.run, and fix bug 2022-06-17 22:16:22 +02:00
Snakes a0d923e759 Use subprocess.check_call in media.py 2022-06-17 16:15:42 -04:00
Aevann1 30ed6daa26 fix RCE, thank you @Camas 2022-06-17 20:36:34 +02:00
Aevann1 35875d69f6 stop replacing "nitter.net" with "twitter.com" (to fix this shit https://chapotraphouse.club/post/77517/xueen-ezra-is-taunting-the-pigs/2132884?context=8#context) 2022-06-16 18:46:32 +02:00
Aevann1 0fb48bc380 make reddit_notifs_jl_min default to be 1 2022-06-16 16:15:24 +02:00
Aevann1 cab92d3c24 add marsey.cat to safe list 2022-06-16 14:36:43 +02:00
Snakes 46520a9f8c Site-specific: change lotto for PCM. 2022-06-15 22:23:21 -04:00
Snakes a8155d964a Kitchen sink: emoji content, assert, assetcache.
These are all minor and uncontroversial enough it just felt gross
making multiple commits.
  - Adds marseymummified.
  - Changes the new `raise ValueError(...)` in badge_grant to
    an `assert`.
  - Expands assetcache to a convenient grab bag of JS files.
2022-06-15 17:17:31 -04:00
Snakes 7e54f858d3 Amend f8ae2a3d17c6: revert >= logic, fail loudly.
First, the apparent errors with >= 9 and 99 in the Marseys and
referrals code after the refactor are not actually bugs: they were
bug fixes mixed in with the refactor to fix an off-by-one.

Next, instead of failing silently on the `not user` branch in
badge_grant, we throw a ValueError. This retains the current
behavior where users get 500s to report while also enforcing the
assertion near the edge of the function.
2022-06-15 16:32:25 -04:00
Snakes f8ae2a3d17 Amend 3bc98f0a6b84: minor logic, style. 2022-06-15 16:08:26 -04:00
Aevann1 3bc98f0a6b extend TLSM's badge_grant() to almost all instanes where badges are granted 2022-06-15 21:33:21 +02:00
Aevann1 cdcef7d01d Merge branch 'frost' of https://github.com/Aevann1/Drama into frost 2022-06-15 15:32:55 +02:00
Aevann1 ff9c7c17fb readjust prophet muhammed (ï·º) slur filter 2022-06-15 15:32:52 +02:00
Snakes dfe0c64d99 Deduplicate site-specific constants, add SNAKES_ID. 2022-06-14 23:39:37 -04:00
Snakes 3301e238d6 Content: alphabet emoji, christian list. 2022-06-14 14:37:45 -04:00
Snakes c61375288f Content: add TLD to sanitize. 2022-06-14 03:48:02 -04:00
Aevann1 0f49c8e32f replace spaces with tabs 2022-06-13 20:33:25 +02:00
Aevann1 d8fff0bc72 Revert "Fix giant patting hand UI bug."
This reverts commit 7915eb8390.
2022-06-13 20:31:28 +02:00
Aevann1 f4aa70cc74 Revert "Add user title coin cost parameter."
This reverts commit dece3fd460.
2022-06-13 20:10:53 +02:00
Aevann1 07f2c0d2ca make marsey counter work everywhere (not just comments) 2022-06-13 20:05:24 +02:00
Aevann1 6d1f7646ba elaborate in lottershe message 2022-06-13 18:30:27 +02:00
Snakes acde2c856b Enable JL2 viewing shadowbanned comments. 2022-06-12 05:48:27 -04:00
Snakes 7915eb8390 Fix giant patting hand UI bug.
Despite being very fun, this fixes the recently discovered bug where
placing '#' or '!' within the 'pat:' suffix of a patted emoji causes
the enclosing <span> to not be given the proper CSS `display` or
`position`, leading to the hand being sized relative to the comment
bounding box rather than the emoji box.

This should be backward compatible. The only posts it wont fix are
existing ones with the giant hands. Main example being:
https://rdrama.net/h/slackernews/post/76302/
2022-06-12 02:22:38 -04:00
Snakes f76b94b58d Content: keywords updates. 2022-06-11 22:08:48 -04:00
Aevann1 85b4158d5b "1 lottery tickets" -> "1 lottery ticket" 2022-06-11 16:52:20 +02:00
Aevann1 adefc09ae9 rename "dramacoins" to "coins", so that it works on other sites 2022-06-11 16:40:53 +02:00
Aevann1 cf83a996bd let losers know how much coins the winner won 2022-06-11 16:40:14 +02:00
Aevann1 831344b723 small image embed improvements 2022-06-11 14:21:59 +02:00
Aevann1 a082105ab8 remove weird trailing tabs 2022-06-11 11:56:16 +02:00
Aevann1 1f42d228c1 remove 'apnic' from word list 2022-06-11 11:27:55 +02:00
Snakes 28002844e4 offsitementions: Fix notif logic. 2022-06-10 22:04:17 -04:00
Aevann1 d84a4c7ce9 convert monthly marseybux into a cron task 2022-06-10 22:23:01 +02:00
Aevann1 654ddc4157 re-refactor normalize_url 2022-06-10 22:02:15 +02:00
Aevann1 36a1797276 escape / in imgur_regex 2022-06-10 21:04:25 +02:00
Aevann1 4910681c6f make the default HOLE_COST 0 (for testing purposes) 2022-06-10 20:14:24 +02:00
Aevann1 6a18c31ced exclude localhost from reddit notifs 2022-06-10 17:30:30 +02:00
Aevann1 774e079942 extend reddit notifs to ALL SITES 2022-06-10 17:25:03 +02:00
Snakes 78d784533c Fix syntax & imports in offsitementions.py 2022-06-10 11:13:32 -04:00
Aevann1 05d6a24535 Tell ppl who won the lottery in loss messages 2022-06-10 16:53:29 +02:00
Aevann1 5db4bd1023 made CARP_ID to be 0 on new sites 2022-06-10 16:44:05 +02:00
Aevann1 6800d33019 replace streamable links with full-size version 2022-06-10 16:35:09 +02:00
Aevann1 22f3749df3 Merge branch 'frost' of https://github.com/Aevann1/Drama into frost 2022-06-10 16:04:52 +02:00
Aevann1 dcf5207e83 all 'app' tld (for discussions.app) 2022-06-10 16:04:49 +02:00
Snakes 2f1761330c Lottery: remove manager, make cronjob friendly. 2022-06-10 09:50:03 -04:00
Aevann1 3e365484fd refactor lottery a little bit + expand it to all of marsey's empire 2022-06-10 15:30:25 +02:00
Snakes 4db48a6ec9 Separate modaction notifs from inbox. 2022-06-10 08:28:46 -04:00
Snakes 8709ca816d Add Y'all Seein' Eye award v2 for offsitementions.
Reusing the assets and design for the ill-fated YSE in a0f441a67d.
This time, the award provides access to our offsite mentions (reddit
notifs).
2022-06-10 07:12:19 -04:00
Snakes bea6d82b61 Lottery: fix granted value, zero royalty.
grant_lottery_tickets_to_user incorrectly deposited the full ticket
value into manager account, not just the net value.

Additionally, royalty rate has been set to zero because Chapose won
the first lottery and grifting 8% that could instead go into the
prize pool seems unwarranted given that.
2022-06-10 06:15:37 -04:00
Snakes 5f7b38b477 Refactor stat timers, award timers.
Prior to this comment, the every-1d cron.py command was broken due
to lack of proper stats import. However, while refactoring this, it
was convenient to move other recurring tasks that had been stuffed in
odd places--not least `stats(...)`--into the new cron system. This
entailed a number of refactorings of other things.

1. Move stats(...) from static.py to helpers/stats.py.
2. Move hole inactivity purge task from stats(...) to routes/subs.py.
3. Move bot award timer checks from stats(...) to helpers/awards.py.
4. Unify award timer logic formerly in routes/front.py into the new
   helpers/awards.py.
2022-06-10 05:47:41 -04:00
Snakes dc7f13304e Add following holes for notifications. 2022-06-09 16:24:24 -04:00
Aevann1 39e0e6d017 make cron also calculate stats (based and cronpilled) 2022-06-09 20:09:49 +02:00
Snakes ed240735fb Improve slur replacer performance, part deux.
h/t @official-techsupport again for finding another optimization.
We are now cumulatively at about 70% speedup over original.
It remains one of the hottest paths of the codebase in relative
terms, but its absolute performance demands have decreased enough
to buy us potentially substantial time on it.
2022-06-07 21:56:14 -04:00
Snakes da82ea81d8 Improve slur replacer performance.
h/t @official-techsupport for digging into the regex performance and
coming up with one that greatly reduces backtracking. We see an
approximately 2x speedup under typical loads, which proves to be a
major overall savings in performance. Previously, censor_slurs was,
second to ORM DB accesses, by far the most time-consuming function
in the codebase under typical loads. It's still not ideal, but it is
much better.

Future options to improve this critical path further would be:
  1) Precompute a slur-replaced HTML, rather than recomputing
     each pageload. Storage is cheap.
  2) Tokenize the HTML and replace plaintext words using O(1)
     exact-match lookups to a dict.
2022-06-07 21:16:58 -04:00
Snakes e85d76947a Lottery: fix negative ticket quantity exploit. 2022-06-07 17:50:31 -04:00
Snakes 995375decc Refactor reddit mentions, move to cron.
The reddit mentions system contained much duplicated code and was
grafted onto the post thumbnail pipeline to achieve semi-regular
invocation. Instead, we now run it through the new cron system,
and the duplicate code has been refactored out.
2022-06-07 10:42:24 -04:00
Snakes 152315f73e cron: Move charts from static to helper. 2022-06-07 08:31:24 -04:00
Snakes ace0a62f69 cron: Add lottery as scheduled task. 2022-06-07 07:36:55 -04:00
Snakes acb3a0b338 Enable flask command, add cron target.
Adding an empty __init__.py, the imports-only cli.py, and setting
FLASK_APP in the environment are enough to get the `flask` command
to work. This will enable future changes, including database
migrations.

The proximate reason for the fix is to add a `flask cron` command
to run scheduled tasks within the application from cron. Specifically,
the lottery should be run from cron.
2022-06-07 06:57:26 -04:00
Aevann1 4a98c2a639 don't whitelist fagmins 2022-06-07 12:34:46 +02:00
Aevann1 4a1e6cc726 a 500 error is much better than an XSS, bro 2022-06-07 12:03:51 +02:00
Snakes dece3fd460 Add user title coin cost parameter. 2022-06-06 19:02:23 -04:00
Snakes 7556fe8988 Add lottershe badge logic, badge helper. 2022-06-06 00:07:38 -04:00
Snakes 5fb358a32a Add more TLDs to sanitize. 2022-06-03 17:01:32 -04:00
Snakes b306d113ad Lottery: Fix treasure adding coins to manager.
It was observed in prod that the lottery prize as tracked by the DB
had diverged from the amount held in the Lottershe manager account.
This appears to be the result of grant_lottery_tickets_to_user
adding the # of _tickets_ rather than the value of those tickets to
the manager.
2022-06-03 02:24:32 -04:00
Snakes 843ff51ace Make post rate limit site-specific. 2022-06-02 22:10:59 -04:00
Snakes 379ae664a3 Make PIN_LIMIT a per-site constant. 2022-06-02 19:45:33 -04:00
Snakes 6b9a133204 Kitchen sink commit, misc. content updates.
- Increment cache version on popover badges.
- Add comments+submission_listing.js to assetcache to support ^.
- Append new words to wordle list.
- Cache bust assorted assets for recent PRs.
2022-06-02 19:32:13 -04:00
outruncolors dfd521b652 Add quantity field to purchasing tickets / Make Chapose the beneficiary (#302)
* Add quantity field to purchasing tickets

* Remove height requirement for div (manlets  seething)
2022-06-02 19:19:49 -04:00
float-trip 58c4b62163 Some fixes (#300)
* Narrow emoji_regex

* Fix mirrored pat emojis

* Fix ban icon on posts/comments
2022-06-02 19:18:10 -04:00
Snakes 2008c09136 Add 'filter' to allowed_styles. 2022-06-02 06:14:20 -04:00
Snakes 227ddbec0e Truncate notifs with too-long bodies.
In general, we don't do a great job of length validating body_html
fields. Lots of ways to get 500 errors by providing too long of
input. Really ought to find a way to fix it in the classes/comment.py
and classes/submission.py classes. In the interim, the recent gifts
messages change is salient because the notification can 500 out
mid-way through performing coin transactions.

Recommended to find a better way of truncating or safely bubbling
the exception up. Truncating probably not best long-term solution
because it could hypothetically permit strings that would otherwise
be considered unsanitized.
2022-06-01 00:54:05 -04:00
Snakes 49622b3268 Lottery: add admin participants listing. 2022-05-31 23:20:39 -04:00
Snakes 79e338de38 Treasure: raise minimum reward 10 -> 12.
A rare case where users receive 0 lotto tickets from a treasure chest
occurs when they received 10 or 11 coins from a chest pre-conversion
to lotto tickets. Rather than change ticket_count to the ceil of
dividing coins by ticket cost, it seems less distortionary to instead
imperceptibly raise the minimum to avoid this case.
2022-05-31 20:23:19 -04:00
Snakes 5d56e71cc9 Rate limiter: fix 81e2a5a for logged-out. 2022-05-30 23:50:56 -04:00
Snakes 4ba2098612 Rate limiter: whitelist admins.
Due to presently hitting perpetual 429s after a mishap with lottery
polling on production, among past events where admins have gotten
rate-limited for doing otherwise normal admin behavior, the
flask_limiter.Limiter now has a request filter to whitelist JL2+.
Despite running on every request, I don't anticipate this undermining
the DoS prevention power of the Limiter.

It is yet unknown whether there are edge cases where running
get_logged_in_user in a different spot in the request pipeline might
e.g. subtly break the logged-in counters. This is not expected at
present, however.
2022-05-30 23:01:18 -04:00
Snakes 81e19b1aed Add can_gamble user setting.
Users now have a toggleable can_gamble setting which disables their
ability to use all chance-based gains on the site: viz. slots,
blackjack, the lottery, and treasure chests.

This only applies on invocation of commands that start gambling
games, so it should cause no bugs when toggled with e.g. active
blackjack games.

This was added for the benefit of users with actual problems with
gambling, be they past addiction or religious conviction. All future
gambling features are humbly requested to respect it.
2022-05-30 05:32:45 -04:00
outruncolors 0abf890575 Make a few styling changes for mobile lottery modal (#293) 2022-05-30 01:40:55 -04:00
Snakes cf46b8b3fe Refactor e81edb711d for modularity. 2022-05-30 00:30:10 -04:00
Aevann1 e81edb711d fixed this https://rdrama.net/post/72013/-/2010109?context=8#context 2022-05-30 06:12:51 +02:00
Outrun Colors, LLC ef7da60432 Remove new schema changes from file and replace account ids for lottery system 2022-05-29 22:17:31 -05:00
Outrun Colors, LLC db13e0976c Have tickets show up in treasure chests 2022-05-29 21:59:22 -05:00
Outrun Colors, LLC b9dc28e6d1 Don't show lotteries on the sister sites 2022-05-29 20:43:16 -05:00
Outrun Colors, LLC a0cc7e1cf6 Move more stuff to proper location 2022-05-29 19:49:14 -05:00
Outrun Colors, LLC 562202b38d Reorganize route logic 2022-05-29 01:06:39 -05:00
Outrun Colors, LLC bef0b0ff6d Add participants and field updating 2022-05-29 01:01:45 -05:00
Outrun Colors, LLC 1a55a7670e Send notifications to winners and losers 2022-05-28 23:23:20 -05:00
Outrun Colors, LLC 469c39dca6 Configure admin section and purchasing a ticket full flow 2022-05-28 22:33:44 -05:00
Aevann1 709c756660 fds 2022-05-28 16:55:22 +02:00
Aevann1 cd2380fb33 fds 2022-05-28 04:20:31 +02:00
Aevann1 3f04c69cb8 fds 2022-05-28 01:50:33 +02:00
Aevann1 6b6e2e8253 sfd 2022-05-27 20:28:54 +02:00
Aevann1 db98b4e140 sfd 2022-05-27 19:19:12 +02:00
Aevann1 384afb125a fsd 2022-05-27 17:28:30 +02:00
Snakes 2bde3650d4 Awards: enable lootbox on WPD, refactor AWARDS2 logic. 2022-05-26 22:12:53 -04:00
Aevann1 758a30e166 fsd 2022-05-26 22:53:24 +02:00
Aevann1 d4f7f5497b fds 2022-05-26 22:49:36 +02:00
Aevann1 630996faee gfd 2022-05-26 22:31:08 +02:00
Aevann1 f72015382a crgd is a king 2022-05-26 22:04:39 +02:00
Aevann1 64c3b489e3 fds 2022-05-26 20:37:10 +02:00
Aevann1 2595706b49 fsd 2022-05-26 20:36:37 +02:00
Aevann1 e4893c617e fd 2022-05-26 02:54:05 +02:00
Aevann1 163267c88c Revert "Add Y'all Seein' Eye award."
This reverts commit a0f441a67d.
2022-05-26 02:51:42 +02:00
Snakes a0f441a67d Add Y'all Seein' Eye award.
Adds award to enable viewing profile visitors for non-mops and
non-patrons. This commit should encompass all frontend, backend, and
database changes necessary. Perhaps usable as a model for other
user upgrade flag awards.
2022-05-25 19:44:34 -04:00
Aevann1 50b995d3a0 fds 2022-05-25 22:16:26 +02:00
Aevann1 49c53cb2ff fds 2022-05-25 20:59:24 +02:00
Aevann1 c213451722 fdsfdsxc 2022-05-25 20:44:43 +02:00
Aevann1 386db76c10 crgd is a king 2022-05-25 20:29:22 +02:00
Aevann1 5b1477acfc certified good commit 2022-05-25 19:01:29 +02:00
Aevann1 de176280c8 e 2022-05-25 17:42:30 +02:00
Aevann1 162bf9dad7 no more g.timestamp y'all couldn't behave 2022-05-25 17:42:04 +02:00
Snakes 67796acc11 Fix chat by setting g.timestamp.
The users online count recently added to wrappers.py:get_logged_in_user
uses g.timestamp for its calculations. This is primarily set in
__main__.py:before_request. However, chat has requests which do not
trigger @app.before_request. To resolve this, we now set g.timestamp
in the auth_required wrapper before calling get_logged_in_user().

I think this is safe in general; there's no particular harm to setting
the timestamp _more_ frequently.
2022-05-25 06:49:02 -04:00
Snakes 1c7458e111 Sanitize: modularize normalize_url, fix streamable.
Originally prompted by https://rdrama.net/post/18459/-/1984609 which
noticed that streamable.com/e/ links as posts would have another e/
added to them. This was in spite of logic in posts.py api_is_repost
and submit_post designed to specifically counteract this.
Proximal cause was a copypasta'd url.replace(...) chain which
caused the mistake before the streamable-specific logic had a chance
to avoid making it.

Solution: remove the streamable replacement from the chained statement
and create `helpers.normalize_url(url)` to get rid of the copypasta.
2022-05-25 04:43:16 -04:00
Snakes 7ead30014c Upgrade bleach to 5.0.0. 2022-05-24 20:28:36 -04:00
Aevann1 826f137a5e fsd 2022-05-25 02:22:09 +02:00
Snakes 8c3b6cece1 Add 8-ball answers, like fortune & factcheck. 2022-05-24 19:08:41 -04:00
Aevann1 4f02a72d29 fd 2022-05-25 00:43:49 +02:00
Aevann1 1734137dcd sfddsa 2022-05-25 00:29:15 +02:00
Aevann1 6631777f76 fds 2022-05-24 22:45:34 +02:00
Aevann1 e1f298deb8 sfd 2022-05-24 22:27:27 +02:00
Aevann1 2b9dcb0c6a users here now 2022-05-24 22:19:18 +02:00
Aevann1 ca18dc8bdd webm2 2022-05-24 22:09:45 +02:00
Aevann1 67b4f13d98 webm 2022-05-24 22:07:04 +02:00
Snakes d0d029a78a sanitize: Add more neo-gTLDs to TLDs tuple-list.
Per https://rdrama.net/post/70341/-/1976650 added more gTLDs that
are actually desired by site users.

Also, hard wrapped the `TLDS` and `allowed_tags` tuple-lists at a
100char hard ruler for my sanity.
2022-05-24 15:16:55 -04:00
Aevann1 bbd851210e fds 2022-05-24 17:32:49 +02:00
Aevann1 dcf1c794cc fds 2022-05-24 04:48:50 +02:00
Snakes a56ebc39dd Add 'moe' to sanitize TLDS for linkifier. 2022-05-23 16:06:01 -04:00
Aevann1 15418ec1e6 sfd 2022-05-23 21:20:58 +02:00
Aevann1 9599a7e96d fds 2022-05-23 21:13:33 +02:00
Aevann1 0bd15d3914 burgers? 2022-05-23 21:00:14 +02:00
Aevann1 89c27efd79 booba 2022-05-23 20:03:59 +02:00
Aevann1 c5413e9e53 sdf 2022-05-23 17:28:23 +02:00
Snakes cc75375c82 Un-deploy Birthgay event.
Removes temporary changes for the Birthgay 2022 event, ending
approximately at 2022-05-23 0600Z. Changes:
 - Double XP disabled.
 - Lootboxes disabled.
 - Three event awards given real descriptions and colors.
 - Partyhats: restored to cakeday-only condition and tooltip.
 - Header UI: balloons removed, text visibility outline removed,
   journoid banner reverted, marseyjam as header icon.
 - Birthgay banners: removed from template, moved to new storage dir.

Confetti, though remaining as a permanent award, has been temporarily
removed pending a less performance-intensive implementation and one
that doesn't require maintaining a third-party package in the codebase.
2022-05-23 01:48:25 -04:00
Aevann1 649f8d5323 vdffsd 2022-05-23 00:45:04 +02:00
Aevann1 0805b41394 fds 2022-05-23 00:37:59 +02:00
Aevann1 0a74a98ec5 big ass commit 2022-05-23 00:15:29 +02:00
Aevann1 3741b6caa2 fds 2022-05-22 22:14:51 +02:00
Aevann1 112a2679cc fsd 2022-05-22 22:05:44 +02:00
official-techsupport 36e0ce6e0a Handle invalid video formats better (#283) 2022-05-22 22:01:10 +02:00
Aevann1 3ae131f5d6 fds 2022-05-22 20:04:22 +02:00
Aevann1 d712b8cf94 fds 2022-05-22 20:04:11 +02:00
Aevann1 c41f6977e7 sdf 2022-05-22 20:03:54 +02:00
Aevann1 a4ca9fc1aa fds 2022-05-22 18:19:57 +02:00
Aevann1 10723940d1 sfd 2022-05-22 18:19:49 +02:00
Aevann1 969d1898b5 vid refactor 2022-05-22 18:13:19 +02:00
Aevann1 37a6ce39f5 fixing https://rdrama.net/post/69817/tfw-you-will-never-troll-harder/1961118?context=8#context 2022-05-22 12:20:11 +02:00
Snakes 3d9c302fae Blackjack: add five card charlie rule. 2022-05-20 23:08:20 -04:00
Snakes 9a23c195ed Fix overpermissive email regex. 2022-05-20 18:49:00 -04:00
Aevann1 2737a6ca47 sfd 2022-05-20 23:41:08 +02:00
Snakes 76fd1342f3 Fix @mention replacement.
Comments of the style e.g. "@TLSM / @TLSM2" would mistakenly be
`sanitize`d to have identical links only on "@TLSM", the latter
instance having a dangling 2 on the end. It seems this is purely an
issue with text formatting; alerts.py @ NOTIF_USERS had no such
issues. The root cause appears to be partly an optimization and
partly the use of str.replace without a count limit.
2022-05-20 17:04:36 -04:00
Aevann1 4a6545ef5d dfsfds 2022-05-20 16:39:46 +02:00
Aevann1 eead5570e5 fsd 2022-05-20 16:17:09 +02:00
Snakes c789f6923e Merge remote-tracking branch 'upstream/frost' into birthgay-staging 2022-05-19 17:59:35 -04:00
Snakes 5e85f34d3c Double XP enabled: actual launch timestamp. 2022-05-19 17:22:55 -04:00
Snakes 39c354c3fd Enable DXP at 2022-05-19 2200Z. 2022-05-19 17:15:39 -04:00
Snakes 69dec16f55 Shop badge discount: fix Spender, add Roller disc.
The shop discount from Big Spender badges was incorrectly implemented:
intended behavior was for 2pp per badge. However, the values in
const.py were set as if a user could only have one Spender badge at
once, while user.py @ discount was implemented as if they were
additive. Since users factually do have multiple big spender badges,
the values in const were adjusted to reflect this fact.

Also, lootbox Roller badges now each offer a 1pp discount.
users.py @ discount was improved to check against the `discounts`
keys for appropriate badges, rather than a hardcoded list.
2022-05-19 13:41:04 -04:00