Remove special cases based on request.host

This commit is contained in:
iro84657 2022-05-09 01:37:25 -04:00
parent 4341e2d980
commit 193ff08a3d
12 changed files with 18 additions and 88 deletions

View file

@ -382,16 +382,6 @@ def monthly(v):
send_repeatable_notification(u.id, f"@{v.username} has given you {procoins} Marseybux for the month of {month}! You can use them to buy awards in the [shop](/shop).") send_repeatable_notification(u.id, f"@{v.username} has given you {procoins} Marseybux for the month of {month}! You can use them to buy awards in the [shop](/shop).")
else: print(u.username) else: print(u.username)
if request.host == 'pcmemes.net':
u = g.db.query(User).filter_by(id=KIPPY_ID).one()
u.procoins += 50000
g.db.add(u)
if request.host == 'rdrama.net':
u = g.db.query(User).filter_by(id=A_ID).one()
u.procoins += 25000
g.db.add(u)
ma = ModAction( ma = ModAction(
kind="monthly", kind="monthly",
user_id=v.id user_id=v.id

View file

@ -597,8 +597,6 @@ def award_comment(cid, v):
@app.get("/admin/awards") @app.get("/admin/awards")
@admin_level_required(2) @admin_level_required(2)
def admin_userawards_get(v): def admin_userawards_get(v):
if request.host == 'pcmemes.net' and v.admin_level < 3: abort(403)
if v.admin_level != 3: if v.admin_level != 3:
return render_template("admin/awards.html", awards=list(AWARDS3.values()), v=v) return render_template("admin/awards.html", awards=list(AWARDS3.values()), v=v)
@ -608,8 +606,6 @@ def admin_userawards_get(v):
@limiter.limit("1/second;30/minute;200/hour;1000/day") @limiter.limit("1/second;30/minute;200/hour;1000/day")
@admin_level_required(2) @admin_level_required(2)
def admin_userawards_post(v): def admin_userawards_post(v):
if request.host == 'pcmemes.net' and v.admin_level < 3: abort(403)
try: u = request.values.get("username").strip() try: u = request.values.get("username").strip()
except: abort(404) except: abort(404)

View file

@ -82,7 +82,6 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
if not pid: if not pid:
if comment.parent_submission: pid = comment.parent_submission if comment.parent_submission: pid = comment.parent_submission
elif request.host == 'pcmemes.net': pid = 2487
else: pid = 1 else: pid = 1
try: pid = int(pid) try: pid = int(pid)
@ -420,39 +419,6 @@ def api_comment(v):
g.db.add(c_choice) g.db.add(c_choice)
if request.host == 'pcmemes.net' and c.body.lower().startswith("based"):
pill = based_regex.match(body)
if level == 1: basedguy = get_account(parent_post.author_id)
else: basedguy = get_account(c.parent_comment.author_id)
basedguy.basedcount += 1
if pill:
if basedguy.pills: basedguy.pills += f", {pill.group(1)}"
else: basedguy.pills += f"{pill.group(1)}"
g.db.add(basedguy)
body2 = f"@{basedguy.username}'s Based Count has increased by 1. Their Based Count is now {basedguy.basedcount}."
if basedguy.pills: body2 += f"\n\nPills: {basedguy.pills}"
body_based_html = sanitize(body2)
c_based = Comment(author_id=BASEDBOT_ID,
parent_submission=parent_submission,
distinguish_level=6,
parent_comment_id=c.id,
level=level+1,
is_bot=True,
body_html=body_based_html,
top_comment_id=c.top_comment_id,
ghost=parent_post.ghost
)
g.db.add(c_based)
g.db.flush()
n = Notification(comment_id=c_based.id, user_id=v.id)
g.db.add(n)
if parent_post.id not in ADMIGGERS: if parent_post.id not in ADMIGGERS:
if v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in c.body.lower(): if v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in c.body.lower():

View file

@ -344,8 +344,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
if not (v and v.shadowbanned): if not (v and v.shadowbanned):
posts = posts.join(User, User.id == Submission.author_id).filter(User.shadowbanned == None) posts = posts.join(User, User.id == Submission.author_id).filter(User.shadowbanned == None)
if request.host == 'rdrama.net': num = 5 num = 1
else: num = 1
if sort == "hot": if sort == "hot":
ti = int(time.time()) + 3600 ti = int(time.time()) + 3600

View file

@ -223,8 +223,6 @@ def remove_mod(v, sub):
@app.get("/create_sub") @app.get("/create_sub")
@is_not_permabanned @is_not_permabanned
def create_sub(v): def create_sub(v):
if request.host == 'rdrama.net': cost = 0
else:
num = v.subs_created + 1 num = v.subs_created + 1
for a in v.alts: for a in v.alts:
num += a.subs_created num += a.subs_created
@ -240,8 +238,6 @@ def create_sub2(v):
if not name: abort(400) if not name: abort(400)
name = name.strip().lower() name = name.strip().lower()
if request.host == 'rdrama.net': cost = 0
else:
num = v.subs_created + 1 num = v.subs_created + 1
for a in v.alts: for a in v.alts:
num += a.subs_created num += a.subs_created

View file

@ -478,11 +478,6 @@ def leaderboard(v):
sq = g.db.query(User.id, func.rank().over(order_by=User.received_award_count.desc()).label("rank")).subquery() sq = g.db.query(User.id, func.rank().over(order_by=User.received_award_count.desc()).label("rank")).subquery()
pos5 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1] pos5 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1]
if request.host == 'pcmemes.net':
users6 = users.order_by(User.basedcount.desc()).limit(25).all()
sq = g.db.query(User.id, func.rank().over(order_by=User.basedcount.desc()).label("rank")).subquery()
pos6 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1]
else:
users6 = None users6 = None
pos6 = None pos6 = None

View file

@ -431,7 +431,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 class="btn caction py-0 nobackground px-1 text-muted copy-link" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://chapotraphouse.club{{c.shortlink}}{% else %}{{c.permalink}}{% endif %}"><i class="fas fa-copy"></i>Copy link</button> <button class="btn caction py-0 nobackground px-1 text-muted copy-link" data-clipboard-text="{{c.permalink}}"><i class="fas fa-copy"></i>Copy link</button>
{% if v %} {% if v %}
<button class="btn caction py-0 nobackground px-1 text-muted" role="button" onclick="openReplyBox('reply-to-{{c.id}}')"><i class="fas fa-reply" aria-hidden="true"></i>Reply</button> <button class="btn caction py-0 nobackground px-1 text-muted" role="button" onclick="openReplyBox('reply-to-{{c.id}}')"><i class="fas fa-reply" aria-hidden="true"></i>Reply</button>
@ -635,7 +635,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>
<a role="button" class="list-group-item copy-link" data-bs-dismiss="modal" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://chapotraphouse.club{{c.shortlink}}{% else %}{{c.permalink}}{% endif %}"><i class="fas fa-copy mr-2"></i>Copy link</a> <a role="button" class="list-group-item copy-link" data-bs-dismiss="modal" data-clipboard-text="{{c.permalink}}"><i class="fas fa-copy mr-2"></i>Copy link</a>
{% if v %} {% if v %}
<a role="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</a> <a role="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</a>

View file

@ -12,7 +12,7 @@
<a class="list-inline-item text-muted d-none d-md-inline-block" role="button" data-bs-toggle="modal" data-bs-target="#awardModal" data-url='/award_post/{{p.id}}'><i class="fas fa-gift fa-fw"></i>Give Award</a> <a class="list-inline-item text-muted d-none d-md-inline-block" role="button" data-bs-toggle="modal" data-bs-target="#awardModal" data-url='/award_post/{{p.id}}'><i class="fas fa-gift fa-fw"></i>Give Award</a>
{% endif %} {% endif %}
<a class="list-inline-item copy-link" role="button" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://chapotraphouse.club{{p.shortlink}}{% else %}{{p.permalink}}{% endif %}"><i class="fas fa-copy"></i>Copy link</a> <a class="list-inline-item copy-link" role="button" data-clipboard-text="{{p.permalink}}"><i class="fas fa-copy"></i>Copy link</a>
{% if v %} {% if v %}
<a id="subscribe-{{p.id}}" class="{% if p.id in v.subscribed_idlist() %}d-none{% endif %} list-inline-item" role="button" onclick="post_toast2(this,'/subscribe/{{p.id}}','subscribe-{{p.id}}','unsubscribe-{{p.id}}')"><i class="fas fa-eye"></i>Subscribe</a> <a id="subscribe-{{p.id}}" class="{% if p.id in v.subscribed_idlist() %}d-none{% endif %} list-inline-item" role="button" onclick="post_toast2(this,'/subscribe/{{p.id}}','subscribe-{{p.id}}','unsubscribe-{{p.id}}')"><i class="fas fa-eye"></i>Subscribe</a>

View file

@ -8,7 +8,7 @@
{% if not p.ghost or v.id == AEVANN_ID %}<a class="btn-block" href="/votes?link={{p.fullname}}"><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-3"></i>Votes</button></a>{% endif %} {% if not p.ghost or v.id == AEVANN_ID %}<a class="btn-block" href="/votes?link={{p.fullname}}"><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-3"></i>Votes</button></a>{% endif %}
<button data-bs-dismiss="modal" class="copy-link nobackground btn btn-link btn-block btn-lg text-left text-muted" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://chapotraphouse.club{{p.shortlink}}{% else %}{{p.permalink}}{% endif %}"><i class="far fa-copy text-center text-muted mr-3"></i>Copy link</button> <button data-bs-dismiss="modal" class="copy-link nobackground btn btn-link btn-block btn-lg text-left text-muted" data-clipboard-text="{{p.permalink}}"><i class="far fa-copy text-center text-muted mr-3"></i>Copy link</button>
<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-3"></i>Report</button> <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-3"></i>Report</button>

View file

@ -410,11 +410,7 @@
{% block content %} {% block content %}
{% if request.host == 'pcmemes.net' %}
{% set cc='SPLASH MOUNTAIN' %}
{% else %}
{% set cc='COUNTRY CLUB' %} {% set cc='COUNTRY CLUB' %}
{% endif %}
<div class="row mb-3" style="background-color:var(--gray-600)"> <div class="row mb-3" style="background-color:var(--gray-600)">

View file

@ -2,11 +2,7 @@
{% include "award_modal.html" %} {% include "award_modal.html" %}
{% endif %} {% endif %}
{% if request.host == 'pcmemes.net' %}
{% set cc='SPLASH MOUNTAIN' %}
{% else %}
{% set cc='COUNTRY CLUB' %} {% set cc='COUNTRY CLUB' %}
{% endif %}
{% if not v or v.highlightcomments %} {% if not v or v.highlightcomments %}
<script src="/assets/js/new_comments_count.js?v=242"></script> <script src="/assets/js/new_comments_count.js?v=242"></script>

View file

@ -12,11 +12,7 @@
<meta name="author" content=""> <meta name="author" content="">
<link rel="icon" type="image/png" href="/assets/images/{{SITE_NAME}}/icon.webp?v=1015"> <link rel="icon" type="image/png" href="/assets/images/{{SITE_NAME}}/icon.webp?v=1015">
{% if request.host == 'pcmemes.net' %}
{% set cc='Splash Mountain' %}
{% else %}
{% set cc='Country Club' %} {% set cc='Country Club' %}
{% endif %}
{% block title %} {% block title %}
<title>Create a post - {{SITE_NAME}}</title> <title>Create a post - {{SITE_NAME}}</title>