forked from rDrama/rDrama
1
0
Fork 0

Merge branch 'frost' of https://github.com/Aevann1/Drama into frost

master
Aevann1 2022-07-09 13:14:24 +02:00
commit 4a3aec0859
7 changed files with 102 additions and 30 deletions

View File

@ -21,6 +21,7 @@ app = Flask(__name__, template_folder='templates')
app.url_map.strict_slashes = False
app.jinja_env.cache = {}
app.jinja_env.auto_reload = True
app.jinja_env.add_extension('jinja2.ext.do')
faulthandler.enable()
app.config['SECRET_KEY'] = environ.get('MASTER_KEY')

View File

@ -7,13 +7,6 @@ from files.helpers.sanitize import *
import random
from urllib.parse import quote
if SITE_NAME == 'PCM': snappyquotes = []
else: snappyquotes = [f':#{x}:' for x in marseys_const2]
if path.exists(f'snappy_{SITE_NAME}.txt'):
with open(f'snappy_{SITE_NAME}.txt', "r", encoding="utf-8") as f:
snappyquotes += f.read().split("\n{[para]}\n")
def badge_grant(user, badge_id, description=None, url=None):
assert user != None
if user.has_badge(badge_id):
@ -49,8 +42,10 @@ def execute_snappy(post, v):
elif v.id == LAWLZ_ID:
if random.random() < 0.5: body = "wow, this lawlzpost sucks!"
else: body = "wow, a good lawlzpost for once!"
elif len(SNAPPY_QUOTES) == 0:
body = ""
else:
body = random.choice(snappyquotes).strip()
body = random.choice(SNAPPY_QUOTES).strip()
if body.startswith(''):
body = body[1:]
vote = Vote(user_id=SNAPPY_ID,
@ -122,9 +117,11 @@ def execute_snappy(post, v):
gevent.spawn(archiveorg, href)
body = body.strip()
body_html = sanitize(body)
if len(body_html) == 0:
return
if len(body_html) < 40000:
c = Comment(author_id=SNAPPY_ID,
distinguish_level=6,
@ -156,4 +153,4 @@ def execute_snappy(post, v):
c.top_comment_id = c.id
post.comment_count += 1
post.replies = [c]
post.replies = [c]

View File

@ -139,12 +139,6 @@ AGENDAPOSTER_MSG_HTML = """<p>Hi <a href="/id/{id}"><img loading="lazy" src="/pp
### SITE SPECIFIC CONSTANTS
################################################################################
HOLE_NAME = 'hole'
HOLE_STYLE_FLAIR = False
HOLE_REQUIRED = False
HOLE_COST = 0
HOLE_INACTIVITY_DELETION = False
PERMS = { # Minimum admin_level to perform action.
'HOLE_CREATE': 0,
'FLAGS_VISIBLE': 0,
@ -155,10 +149,18 @@ PERMS = { # Minimum admin_level to perform action.
EMOJI_MARSEYS = True
EMOJI_SRCS = ['files/assets/emojis.json']
PROCOINS_ENABLED = True
PIN_ENABLED = True
PIN_LIMIT = 3
POST_RATE_LIMIT = '1/second;2/minute;10/hour;50/day'
LOGGEDIN_ACTIVE_TIME = 15 * 60
PFP_DEFAULT_MARSEY = False#True
HOLE_NAME = 'hole'
HOLE_STYLE_FLAIR = False
HOLE_REQUIRED = False
HOLE_COST = 0
HOLE_INACTIVITY_DELETION = False
AUTOJANNY_ID = 1
SNAPPY_ID = 2
@ -192,7 +194,6 @@ BUG_THREAD = 0
POLL_THREAD = 0
WELCOME_MSG = f"Welcome to {SITE_NAME}!"
ROLES={}
PROCOINS_ENABLED = True
LOTTERY_ENABLED = True
LOTTERY_TICKET_COST = 12
@ -247,9 +248,11 @@ if SITE in {'rdrama.net', 'devrama.xyz'}:
"7": "886781932430565418",
}
elif SITE == 'pcmemes.net':
HOLE_COST = 2000
PIN_LIMIT = 6
POST_RATE_LIMIT = '1/second;4/minute;20/hour;100/day'
HOLE_COST = 2000
AUTOJANNY_ID = 1046
SNAPPY_ID = 261
LONGPOSTBOT_ID = 1832
@ -267,9 +270,14 @@ elif SITE == 'pcmemes.net':
LOTTERY_TICKET_COST = 12
LOTTERY_SINK_RATE = -8
elif SITE == 'cringetopia.org':
EMOJI_SRCS = ['files/assets/emojis.json', 'files/assets/emojis.cringetopia.json']
HOLE_COST = 10000
EMOJI_SRCS = ['files/assets/emojis.json', 'files/assets/emojis.cringetopia.json']
AUTOJANNY_ID = 2
SNAPPY_ID = 3
LONGPOSTBOT_ID = 4
ZOZBOT_ID = 5
GIFT_NOTIF_ID = 18
CARP_ID = 18
@ -291,19 +299,23 @@ elif SITE == 'cringetopia.org':
}
PROCOINS_ENABLED = False
elif SITE == 'watchpeopledie.co':
PERMS['HOLE_CREATE'] = 2
PERMS['FLAGS_VISIBLE'] = 2
PROCOINS_ENABLED = False
HOLE_NAME = 'flair'
HOLE_STYLE_FLAIR = True
HOLE_REQUIRED = True
PERMS['HOLE_CREATE'] = 2
PERMS['FLAGS_VISIBLE'] = 2
AUTOJANNY_ID = 2
SNAPPY_ID = 3
LONGPOSTBOT_ID = 4
ZOZBOT_ID = 5
GIFT_NOTIF_ID = 13
CARP_ID = 13
AEVANN_ID = 9
SNAKES_ID = 32
PROCOINS_ENABLED = False
elif SITE == 'lgbdropthet.com':
PERMS['HOLE_CREATE'] = 3
PERMS['FLAGS_VISIBLE_REPORTER'] = 2
@ -311,10 +323,17 @@ elif SITE == 'lgbdropthet.com':
EMOJI_MARSEYS = False
EMOJI_SRCS = ['files/assets/emojis.lgbdropthet.json']
PROCOINS_ENABLED = False
PFP_DEFAULT_MARSEY = False
AUTOJANNY_ID = 1
SNAPPY_ID = 3
LONGPOSTBOT_ID = 4
ZOZBOT_ID = 5
AEVANN_ID = 10
SNAKES_ID = 9
PROCOINS_ENABLED = False
LOTTERY_ENABLED = False
else: # localhost or testing environment implied
pass
@ -855,6 +874,14 @@ marseys_const = [x[0] for x in db.query(Marsey.name).filter(Marsey.name!='chudse
marseys_const2 = marseys_const + ['chudsey','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','exclamationpoint','period','questionmark']
db.close()
SNAPPY_QUOTES = []
if not SITE_NAME in ['PCM', 'LGBDropTheT']:
SNAPPY_QUOTES = [f':#{x}:' for x in marseys_const2]
if path.exists(f'snappy_{SITE_NAME}.txt'):
with open(f'snappy_{SITE_NAME}.txt', "r", encoding="utf-8") as f:
SNAPPY_QUOTES += f.read().split("\n{[para]}\n")
YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip()
ADMIGGERS = (37696,37697,37749,37833,37838,39413)

View File

@ -311,7 +311,9 @@ def sign_up_post(v):
session["history"] = []
else: admin_level=0
profileurl = '/e/' + random.choice(marseys_const) + '.webp'
profileurl = None
if PFP_DEFAULT_MARSEY:
profileurl = '/e/' + random.choice(marseys_const) + '.webp'
new_user = User(
username=username,

View File

@ -2,8 +2,10 @@
{# Title (~25char max), Description (~80char max),
Icon (fa-foo-bar), Color (#ff0000), URL (/post/12345/) #}
{%-
set MEGATHREAD_INDEX = [
{%- set MEGATHREAD_INDEX = [] -%}
{%- if SITE_NAME == 'rDrama' -%}
{%- do MEGATHREAD_INDEX.extend([
(
'Bugs / Suggestions',
'Something broken? Improvements?',
@ -46,8 +48,47 @@ set MEGATHREAD_INDEX = [
'fa-dice-six', '#c9d1d9',
'/post/39413',
),
]
-%}
])-%}
{%- elif SITE_NAME == 'LGBDropTheT' -%}
{%- do MEGATHREAD_INDEX.extend([
(
'Rules & FAQs',
'Commonly-Asked Questions',
'fa-circle-info', '#4bc2ea',
'/kb/rulesfaqs',
),
(
'Help & Support',
'User Guides, Suggestions, Tech Issues',
'fa-comment-question', '#70e572',
'/h/help_and_support',
),
(
'Resources & Organizations',
'LGB and "Drop The T" Support',
'fa-sitemap', '#4bc2ea',
'/kb/resourcesorgs',
),
(
'Artwork & Design Suggestions',
'Emotes, Icons, Banners, and More',
'fa-panorama', '#e9ef2f',
'/h/off_topic_social/post/40/artwork-design-suggestions-megathread',
),
(
'Banned From / Censorship',
'Megathread: Share Your Woes & Commiserate',
'fa-ban', '#ed3d2d',
'/post/27/banned-from-and-censorship-megathread',
),
(
'Gambling Mega-Thread',
'Goomble without bothering people.',
'fa-dice-six', '#c9d1d9',
'/h/off_topic_social/post/25/gambling-megathread',
),
])-%}
{%- endif -%}
{% block content %}
<div id="directory--wrapper">

View File

@ -29,6 +29,10 @@
{% endif %}
<a class="btn btn-primary btn-block mb-3" href="/h/{{sub.name}}/mods">{{HOLE_NAME|upper}} MODS</a>
{% endif %}
<a id="sidebar--directory--btn" class="btn btn-primary btn-block mb-3" href="/directory">
<span id="sidebar--directory--head">DIRECTORY</span>
<span id="sidebar--directory--subhead">Resources | Site Help | Megathreads</span>
</a>
<div id="sidebar--rules">
<h3 id="sidebar--rules--head">Rules</h3>

View File

@ -1,6 +1,6 @@
{%-
set CACHE_VER = {
'css/main.css': 382,
'css/main.css': 383,
'css/4chan.css': 61,
'css/classic.css': 61,