From c6fb0da30b22c6eac74e4b31c7cb9750710e0db7 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 8 Oct 2022 00:00:03 +0000 Subject: [PATCH 1/2] sneed --- seed-db.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/seed-db.sql b/seed-db.sql index ce0418188..0afb1b951 100644 --- a/seed-db.sql +++ b/seed-db.sql @@ -295,6 +295,7 @@ INSERT INTO public.hat_defs VALUES (787, 'Turban', 'Turban with Bindi Dot (Namas INSERT INTO public.hat_defs VALUES (788, 'LGBTUSSR Officer Hat', 'Rule with an iron fist... And use that iron fist for more than ruling ;)', 2, 1000, NULL, 1664994148); INSERT INTO public.hat_defs VALUES (808, 'The Capy 2', 'The drippiest and pimpiest capybara out there.', 2, 500, NULL, 1665104484); + INSERT INTO public.hat_defs VALUES (676, 'Kepi', 'Army cap for those unlucky enough to be French', 2, 500, NULL, 1663303083); INSERT INTO public.hat_defs VALUES (678, 'Turkroach', 'Come on Carp this one''s hilarious. It''s semi transparent to clarify', 2, 500, NULL, 1663305640); INSERT INTO public.hat_defs VALUES (679, 'Judge Dredd', 'THIS USER IS THE LAW', 2, 500, NULL, 1663309533); @@ -335,6 +336,7 @@ INSERT INTO public.hat_defs VALUES (9, 'Dreads', 'Finally, an excuse for poor hy INSERT INTO public.hat_defs VALUES (10, 'The XXXTentacion', 'Pay homage to your favorite dead criminal!', 2, 500, NULL, 1662167687); INSERT INTO public.hat_defs VALUES (12, 'The Elvis', 'Remember when this dude nailed a 13-year-old?', 2, 500, NULL, 1662167687); INSERT INTO public.hat_defs VALUES (13, 'Gussy Hat', 'Let everyone know that you''re NOT a rapist. Honest.', 2, 500, NULL, 1662167687); + INSERT INTO public.hat_defs VALUES (14, 'Riveter', 'Can you do it? Really?', 2, 500, NULL, 1662167687); INSERT INTO public.hat_defs VALUES (15, 'Top Hat (leprechaun)', 'LLM but Irish', 2, 500, NULL, 1662167687); INSERT INTO public.hat_defs VALUES (16, 'Drinky Beer Hat', 'I actually didn''t know these were real things until I made this', 2, 500, NULL, 1662167687); @@ -940,7 +942,7 @@ INSERT INTO public.hat_defs VALUES (504, 'Iron Crown of Lombardy', 'This isn''t -- Name: hat_defs_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - -- -SELECT pg_catalog.setval('public.hat_defs_id_seq', 810, true); +SELECT pg_catalog.setval('public.hat_defs_id_seq', 812, true); -- From 7ea61f423d3466e2ffac8f19ba59e57e70c859a1 Mon Sep 17 00:00:00 2001 From: TLSM Date: Fri, 7 Oct 2022 20:31:46 -0400 Subject: [PATCH 2/2] PCM: disable gambling; extend FEATURES['GAMBLING']. --- files/helpers/const.py | 2 ++ files/helpers/cron.py | 5 ++-- files/routes/casino.py | 52 +++++++++++++++++++++++++++---------- files/templates/header.html | 4 +-- 4 files changed, 45 insertions(+), 18 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 262876cf5..1460bd032 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -338,6 +338,7 @@ if SITE == 'rdrama.net': elif SITE == 'pcmemes.net': PIN_LIMIT = 10 FEATURES['REPOST_DETECTION'] = False + FEATURES['GAMBLING'] = False POST_RATE_LIMIT = '1/second;4/minute;20/hour;100/day' HOLE_COST = 2000 @@ -356,6 +357,7 @@ elif SITE == 'pcmemes.net': WELCOME_MSG = "Welcome to pcmemes.net! Don't forget to turn off the slur filter [here](/settings/content#slurreplacer)" + CASINO_ENABLED = False LOTTERY_TICKET_COST = 12 LOTTERY_SINK_RATE = -8 diff --git a/files/helpers/cron.py b/files/helpers/cron.py index 10c9ca52e..2dd3a8918 100644 --- a/files/helpers/cron.py +++ b/files/helpers/cron.py @@ -28,8 +28,9 @@ def cron(every_5m, every_1h, every_1d, every_1mo): g.db = db_session() if every_5m: - lottery.check_if_end_lottery_task() - spin_roulette_wheel() + if FEATURES['GAMBLING']: + lottery.check_if_end_lottery_task() + spin_roulette_wheel() offsitementions.offsite_mentions_task() if SITE == 'pcmemes.net': route_static.live_cached() diff --git a/files/routes/casino.py b/files/routes/casino.py index 99c58a03c..7053de0f5 100644 --- a/files/routes/casino.py +++ b/files/routes/casino.py @@ -15,7 +15,9 @@ from files.helpers.lottery import * @limiter.limit("100/minute;2000/hour;12000/day") @auth_required def casino(v): - if v.rehab: + if not FEATURES['GAMBLING']: + abort(404) + elif v.rehab: return render_template("casino/rehab.html", v=v) return render_template("casino.html", v=v) @@ -25,9 +27,11 @@ def casino(v): @limiter.limit("100/minute;2000/hour;12000/day") @auth_required def casino_game_page(v, game): - if v.rehab: + if not FEATURES['GAMBLING']: + abort(404) + elif v.rehab: return render_template("casino/rehab.html", v=v) - if game not in CASINO_GAME_KINDS: + elif game not in CASINO_GAME_KINDS: abort(404) feed = json.dumps(get_game_feed(game)) @@ -52,9 +56,11 @@ def casino_game_page(v, game): @limiter.limit("100/minute;2000/hour;12000/day") @auth_required def casino_game_feed(v, game): - if v.rehab: + if not FEATURES['GAMBLING']: + abort(404) + elif v.rehab: return {"error": "You are under Rehab award effect!"}, 400 - if game not in CASINO_GAME_KINDS: + elif game not in CASINO_GAME_KINDS: abort(404) feed = get_game_feed(game) @@ -66,7 +72,9 @@ def casino_game_feed(v, game): @limiter.limit("100/minute;2000/hour;12000/day") @auth_required def lottershe(v): - if v.rehab: + if not FEATURES['GAMBLING']: + abort(404) + elif v.rehab: return render_template("casino/rehab.html", v=v) participants = get_users_participating_in_lottery() @@ -77,7 +85,9 @@ def lottershe(v): @limiter.limit("100/minute;2000/hour;12000/day") @auth_required def pull_slots(v): - if v.rehab: + if not FEATURES['GAMBLING']: + abort(404) + elif v.rehab: return {"error": "You are under Rehab award effect!"}, 400 try: @@ -106,7 +116,9 @@ def pull_slots(v): @limiter.limit("100/minute;2000/hour;12000/day") @auth_required def blackjack_deal_to_player(v): - if v.rehab: + if not FEATURES['GAMBLING']: + abort(404) + elif v.rehab: return {"error": "You are under Rehab award effect!"}, 400 try: @@ -125,7 +137,9 @@ def blackjack_deal_to_player(v): @limiter.limit("100/minute;2000/hour;12000/day") @auth_required def blackjack_player_hit(v): - if v.rehab: + if not FEATURES['GAMBLING']: + abort(404) + elif v.rehab: return {"error": "You are under Rehab award effect!"}, 400 try: @@ -140,7 +154,9 @@ def blackjack_player_hit(v): @limiter.limit("100/minute;2000/hour;12000/day") @auth_required def blackjack_player_stay(v): - if v.rehab: + if not FEATURES['GAMBLING']: + abort(404) + elif v.rehab: return {"error": "You are under Rehab award effect!"}, 400 try: @@ -155,7 +171,9 @@ def blackjack_player_stay(v): @limiter.limit("100/minute;2000/hour;12000/day") @auth_required def blackjack_player_doubled_down(v): - if v.rehab: + if not FEATURES['GAMBLING']: + abort(404) + elif v.rehab: return {"error": "You are under Rehab award effect!"}, 400 try: @@ -170,7 +188,9 @@ def blackjack_player_doubled_down(v): @limiter.limit("100/minute;2000/hour;12000/day") @auth_required def blackjack_player_bought_insurance(v): - if v.rehab: + if not FEATURES['GAMBLING']: + abort(404) + elif v.rehab: return {"error": "You are under Rehab award effect!"}, 400 try: @@ -185,7 +205,9 @@ def blackjack_player_bought_insurance(v): @limiter.limit("100/minute;2000/hour;12000/day") @auth_required def roulette_get_bets(v): - if v.rehab: + if not FEATURES['GAMBLING']: + abort(404) + elif v.rehab: return {"error": "You are under Rehab award effect!"}, 400 bets = get_roulette_bets() @@ -197,7 +219,9 @@ def roulette_get_bets(v): @limiter.limit("100/minute;2000/hour;12000/day") @auth_required def roulette_player_placed_bet(v): - if v.rehab: + if not FEATURES['GAMBLING']: + abort(404) + elif v.rehab: return {"error": "You are under Rehab award effect!"}, 400 try: diff --git a/files/templates/header.html b/files/templates/header.html index 4a574bb47..6d6ad1341 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -128,7 +128,7 @@ - {% if v and CASINO_ENABLED %} + {% if v and CASINO_ENABLED and FEATURES['GAMBLING'] %} @@ -194,7 +194,7 @@ - {% if CASINO_ENABLED %} + {% if CASINO_ENABLED and FEATURES['GAMBLING'] %}