accomodate rdrama.com users

master
Aevann1 2022-11-02 08:31:04 +02:00
parent 086643bf79
commit f73c6d46df
15 changed files with 20 additions and 20 deletions

View File

@ -89,7 +89,7 @@ class Comment(Base):
@lazy @lazy
def can_see(self, v): def can_see(self, v):
if SITE != 'rdrama.net': return True if SITE not in ('rdrama.net','rdrama.com'): return True
if not self.parent_submission: return True if not self.parent_submission: return True
if self.post.sub != 'chudrama': return True if self.post.sub != 'chudrama': return True
if v: if v:

View File

@ -79,7 +79,7 @@ class Submission(Base):
@lazy @lazy
def can_see(self, v): def can_see(self, v):
if SITE != 'rdrama.net': return True if SITE not in ('rdrama.net','rdrama.com'): return True
if self.sub != 'chudrama': return True if self.sub != 'chudrama': return True
if v: if v:
if v.can_see_chudrama: return True if v.can_see_chudrama: return True

View File

@ -402,7 +402,7 @@ ANTISPAM_BYPASS_IDS = ()
PAGE_SIZE = 25 PAGE_SIZE = 25
LEADERBOARD_LIMIT = PAGE_SIZE LEADERBOARD_LIMIT = PAGE_SIZE
if SITE == 'rdrama.net': if SITE in ('rdrama.net','rdrama.com'):
FEATURES['PRONOUNS'] = True FEATURES['PRONOUNS'] = True
FEATURES['HOUSES'] = True FEATURES['HOUSES'] = True
PERMS['ADMIN_ADD'] = 4 PERMS['ADMIN_ADD'] = 4
@ -1228,7 +1228,7 @@ if len(SITE_NAME) > 5:
if SITE != 'localhost': if SITE != 'localhost':
REDDIT_NOTIFS_SITE.add(SITE) REDDIT_NOTIFS_SITE.add(SITE)
if SITE == 'rdrama.net': if SITE in ('rdrama.net','rdrama.com'):
REDDIT_NOTIFS_SITE.add('marsey') REDDIT_NOTIFS_SITE.add('marsey')
REDDIT_NOTIFS_SITE.add('"r/Drama"') REDDIT_NOTIFS_SITE.add('"r/Drama"')
REDDIT_NOTIFS_SITE.add('justice4darrell') REDDIT_NOTIFS_SITE.add('justice4darrell')

View File

@ -24,7 +24,7 @@ def chart(kind, site):
now.tm_wday, now.tm_yday, 0)) now.tm_wday, now.tm_yday, 0))
today_cutoff = calendar.timegm(midnight_this_morning) today_cutoff = calendar.timegm(midnight_this_morning)
if SITE == 'rdrama.net': if SITE in ('rdrama.net','rdrama.com'):
time_diff = time.time() - 1619827200 time_diff = time.time() - 1619827200
num_of_weeks = int(time_diff / 604800) num_of_weeks = int(time_diff / 604800)
chart_width = int(num_of_weeks/1.4) chart_width = int(num_of_weeks/1.4)

View File

@ -159,7 +159,7 @@ def merge_all(v, id):
@app.post("/@<username>/make_admin") @app.post("/@<username>/make_admin")
@admin_level_required(PERMS['ADMIN_ADD']) @admin_level_required(PERMS['ADMIN_ADD'])
def make_admin(v, username): def make_admin(v, username):
if SITE == 'rdrama.net': abort(403) if SITE in ('rdrama.net','rdrama.com'): abort(403)
user = get_user(username) user = get_user(username)

View File

@ -158,7 +158,7 @@ def award_thing(v, thing_type, id):
author = thing.author author = thing.author
if author.shadowbanned: abort(404) if author.shadowbanned: abort(404)
if SITE == 'rdrama.net' and author.id in (PIZZASHILL_ID, CARP_ID): if SITE in ('rdrama.net','rdrama.com') and author.id in (PIZZASHILL_ID, CARP_ID):
abort(403, "This user is immune to awards.") abort(403, "This user is immune to awards.")
if kind == "benefactor" and author.id == v.id: if kind == "benefactor" and author.id == v.id:

View File

@ -56,7 +56,7 @@ def speak(data, v):
global messages, total global messages, total
if SITE == 'rdrama.net': text = data['message'][:200].strip() if SITE in ('rdrama.net','rdrama.com'): text = data['message'][:200].strip()
else: text = data['message'][:1000].strip() else: text = data['message'][:1000].strip()
if not text: return '', 403 if not text: return '', 403

View File

@ -22,7 +22,7 @@ def rdrama(id, title):
@app.get("/marseys") @app.get("/marseys")
@auth_required @auth_required
def marseys(v): def marseys(v):
if SITE == 'rdrama.net': if SITE in ('rdrama.net','rdrama.com'):
marseys = g.db.query(Marsey, User).join(User, Marsey.author_id == User.id).filter(Marsey.submitter_id==None) marseys = g.db.query(Marsey, User).join(User, Marsey.author_id == User.id).filter(Marsey.submitter_id==None)
sort = request.values.get("sort", "usage") sort = request.values.get("sort", "usage")
if sort == "usage": if sort == "usage":
@ -56,7 +56,7 @@ def marsey_list():
if EMOJI_MARSEYS: if EMOJI_MARSEYS:
emojis = [{ emojis = [{
"name": emoji.name, "name": emoji.name,
"author": author if SITE == 'rdrama.net' or author == "anton-d" else None, "author": author if SITE in ('rdrama.net','rdrama.com') or author == "anton-d" else None,
# yikes, I don't really like this DB schema. Next time be better # yikes, I don't really like this DB schema. Next time be better
"tags": emoji.tags.split(" ") + [emoji.name[len("marsey"):] \ "tags": emoji.tags.split(" ") + [emoji.name[len("marsey"):] \
if emoji.name.startswith("marsey") else emoji.name], if emoji.name.startswith("marsey") else emoji.name],

View File

@ -422,7 +422,7 @@ def message2(v, username):
body_html = sanitize(message) body_html = sanitize(message)
if not (SITE == 'rdrama.net' and user.id == BLACKJACKBTZ_ID): if not (SITE in ('rdrama.net','rdrama.com') and user.id == BLACKJACKBTZ_ID):
existing = g.db.query(Comment.id).filter(Comment.author_id == v.id, existing = g.db.query(Comment.id).filter(Comment.author_id == v.id,
Comment.sentto == user.id, Comment.sentto == user.id,
Comment.body_html == body_html, Comment.body_html == body_html,

View File

@ -399,7 +399,7 @@
<a class="btn caction nobackground px-1 text-muted" href="{{c.permalink}}"><i class="fas fa-book-open"></i>Context</a> <a class="btn caction nobackground px-1 text-muted" href="{{c.permalink}}"><i class="fas fa-book-open"></i>Context</a>
<button type="button" class="btn caction py-0 nobackground px-1 text-muted copy-link" data-clipboard-text="{% if SITE == 'rdrama.net' %}https://{{BAN_EVASION_DOMAIN}}{{c.shortlink}}{% else %}{{c.permalink}}{% endif %}"><i class="fas fa-copy"></i>Copy link</button> <button type="button" class="btn caction py-0 nobackground px-1 text-muted copy-link" data-clipboard-text="{% if SITE in ('rdrama.net','rdrama.com') %}https://{{BAN_EVASION_DOMAIN}}{{c.shortlink}}{% else %}{{c.permalink}}{% endif %}"><i class="fas fa-copy"></i>Copy link</button>
{% if v %} {% if v %}
{% if not c.deleted_utc %} {% if not c.deleted_utc %}
@ -608,7 +608,7 @@
<a class="list-group-item" href="{{c.permalink}}"><i class="fas fa-book-open mr-2"></i>Context</a> <a class="list-group-item" href="{{c.permalink}}"><i class="fas fa-book-open mr-2"></i>Context</a>
<button type="button" class="list-group-item copy-link" data-bs-dismiss="modal" data-clipboard-text="{% if SITE == 'rdrama.net' %}https://{{BAN_EVASION_DOMAIN}}{{c.shortlink}}{% else %}{{c.permalink}}{% endif %}"><i class="fas fa-copy mr-2"></i>Copy link</button> <button type="button" class="list-group-item copy-link" data-bs-dismiss="modal" data-clipboard-text="{% if SITE in ('rdrama.net','rdrama.com') %}https://{{BAN_EVASION_DOMAIN}}{{c.shortlink}}{% else %}{{c.permalink}}{% endif %}"><i class="fas fa-copy mr-2"></i>Copy link</button>
{% if v %} {% if v %}
<button type="button" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#reportCommentModal" onclick="report_commentModal('{{c.id}}','{{c.author_name}}')" class="list-group-item"><i class="fas fa-flag mr-2"></i>Report</button> <button type="button" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#reportCommentModal" onclick="report_commentModal('{{c.id}}','{{c.author_name}}')" class="list-group-item"><i class="fas fa-flag mr-2"></i>Report</button>

View File

@ -84,7 +84,7 @@
<th scope="col">Hat</th> <th scope="col">Hat</th>
<th scope="col">Name</th> <th scope="col">Name</th>
<th scope="col">Description</th> <th scope="col">Description</th>
{% if SITE == 'rdrama.net' %} {% if SITE in ('rdrama.net','rdrama.com') %}
{% if request.values.get("sort") == 'author_asc' %} {% if request.values.get("sort") == 'author_asc' %}
<th scope="col"><a href="?sort=author_desc">Author</a></th> <th scope="col"><a href="?sort=author_desc">Author</a></th>
{% else %} {% else %}
@ -114,7 +114,7 @@
</td> </td>
<td>{{hat.name}}</td> <td>{{hat.name}}</td>
<td style="word-break:break-word">{{hat.censored_description(v)}}</td> <td style="word-break:break-word">{{hat.censored_description(v)}}</td>
{% if SITE == 'rdrama.net' %} {% if SITE in ('rdrama.net','rdrama.com') %}
<td>{% include "user_in_table.html" %}</td> <td>{% include "user_in_table.html" %}</td>
{% endif %} {% endif %}
<td><a href="/hat_owners/{{hat.id}}">{{hat.number_sold}}</a></td> <td><a href="/hat_owners/{{hat.id}}">{{hat.number_sold}}</a></td>

View File

@ -35,7 +35,7 @@
{% endmacro %} {% endmacro %}
{% macro cf_2fa_verify() %} {% macro cf_2fa_verify() %}
{% if SITE == 'rdrama.net' %} {% if SITE in ('rdrama.net','rdrama.com') %}
<meta name="cf-2fa-verify" content="4f40ca1ca249313"> <meta name="cf-2fa-verify" content="4f40ca1ca249313">
{% elif SITE == 'watchpeopledie.tv' %} {% elif SITE == 'watchpeopledie.tv' %}
<meta name="cf-2fa-verify" content="372aba5b9338e00"> <meta name="cf-2fa-verify" content="372aba5b9338e00">

View File

@ -7,7 +7,7 @@
<th>Name</th> <th>Name</th>
<th>Marsey</th> <th>Marsey</th>
<th>Usage</th> <th>Usage</th>
{% if SITE == 'rdrama.net' %} {% if SITE in ('rdrama.net','rdrama.com') %}
<th><a href="?sort=author">Author</a></th> <th><a href="?sort=author">Author</a></th>
<th><a href="?sort=added">Added on</a></th> <th><a href="?sort=added">Added on</a></th>
<th>Original File</th> <th>Original File</th>
@ -15,7 +15,7 @@
</tr> </tr>
</thead> </thead>
<tbody id="marseys-table"> <tbody id="marseys-table">
{% if SITE == 'rdrama.net' %} {% if SITE in ('rdrama.net','rdrama.com') %}
{% for marsey, user in marseys %} {% for marsey, user in marseys %}
<tr> <tr>
<td>{{loop.index}}</td> <td>{{loop.index}}</td>

View File

@ -12,7 +12,7 @@
<button type="button" class="list-inline-item text-muted d-none d-md-inline-block" data-bs-toggle="modal" data-bs-target="#awardModal" data-url='/award/post/{{p.id}}' onclick="document.getElementById('giveaward').dataset.action = this.dataset.url"><i class="fas fa-gift fa-fw"></i>Give Award</button> <button type="button" class="list-inline-item text-muted d-none d-md-inline-block" data-bs-toggle="modal" data-bs-target="#awardModal" data-url='/award/post/{{p.id}}' onclick="document.getElementById('giveaward').dataset.action = this.dataset.url"><i class="fas fa-gift fa-fw"></i>Give Award</button>
{% endif %} {% endif %}
<button type="button" class="list-inline-item copy-link" data-clipboard-text="{% if SITE == 'rdrama.net' %}https://{{BAN_EVASION_DOMAIN}}{{p.shortlink}}{% else %}{{p.permalink}}{% endif %}"><i class="fas fa-copy"></i>Copy link</button> <button type="button" class="list-inline-item copy-link" data-clipboard-text="{% if SITE in ('rdrama.net','rdrama.com') %}https://{{BAN_EVASION_DOMAIN}}{{p.shortlink}}{% else %}{{p.permalink}}{% endif %}"><i class="fas fa-copy"></i>Copy link</button>
{% if v %} {% if v %}
<button type="button" id="subscribe-{{p.id}}" class="{% if p.id in v.subscribed_idlist %}d-none{% endif %} list-inline-item" data-click="postToast(this,'/subscribe/{{p.id}}','subscribe-{{p.id}}','unsubscribe-{{p.id}}','d-none')" onclick="areyousure(this)"><i class="fas fa-eye"></i>Subscribe</button> <button type="button" id="subscribe-{{p.id}}" class="{% if p.id in v.subscribed_idlist %}d-none{% endif %} list-inline-item" data-click="postToast(this,'/subscribe/{{p.id}}','subscribe-{{p.id}}','unsubscribe-{{p.id}}','d-none')" onclick="areyousure(this)"><i class="fas fa-eye"></i>Subscribe</button>

View File

@ -8,7 +8,7 @@
{% if v and ((not p.ghost and v.admin_level >= PERMS['VOTES_VISIBLE']) or v.id == AEVANN_ID) %}<a class="btn-block" href="/votes/{{p.fullname}}"><button type="button" class="nobackground btn btn-link btn-block btn-lg text-left text-muted"><i class="fas fa-arrows-v text-center text-muted mr-2"></i>Votes</button></a>{% endif %} {% if v and ((not p.ghost and v.admin_level >= PERMS['VOTES_VISIBLE']) or v.id == AEVANN_ID) %}<a class="btn-block" href="/votes/{{p.fullname}}"><button type="button" class="nobackground btn btn-link btn-block btn-lg text-left text-muted"><i class="fas fa-arrows-v text-center text-muted mr-2"></i>Votes</button></a>{% endif %}
<button type="button" data-bs-dismiss="modal" class="copy-link nobackground btn btn-link btn-block btn-lg text-left text-muted" data-clipboard-text="{% if SITE == 'rdrama.net' %}https://{{BAN_EVASION_DOMAIN}}{{p.shortlink}}{% else %}{{p.permalink}}{% endif %}"><i class="far fa-copy text-center text-muted mr-2"></i>Copy link</button> <button type="button" data-bs-dismiss="modal" class="copy-link nobackground btn btn-link btn-block btn-lg text-left text-muted" data-clipboard-text="{% if SITE in ('rdrama.net','rdrama.com') %}https://{{BAN_EVASION_DOMAIN}}{{p.shortlink}}{% else %}{{p.permalink}}{% endif %}"><i class="far fa-copy text-center text-muted mr-2"></i>Copy link</button>
<button type="button" class="nobackground btn btn-link btn-block btn-lg text-left text-muted" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#reportPostModal" onclick="report_postModal('{{p.id}}')"><i class="far fa-flag text-center text-muted mr-2"></i>Report</button> <button type="button" class="nobackground btn btn-link btn-block btn-lg text-left text-muted" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#reportPostModal" onclick="report_postModal('{{p.id}}')"><i class="far fa-flag text-center text-muted mr-2"></i>Report</button>