forked from MarseyWorld/MarseyWorld
agendaposter award
parent
4b143aa12a
commit
5ddc080587
|
@ -3,119 +3,10 @@ from sqlalchemy.orm import relationship
|
|||
from files.__main__ import Base
|
||||
from os import environ
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.const import AWARDS
|
||||
|
||||
site_name = environ.get("SITE_NAME").strip()
|
||||
|
||||
if site_name == "Drama":
|
||||
AWARDS = {
|
||||
"ban": {
|
||||
"kind": "ban",
|
||||
"title": "1-Day Ban",
|
||||
"description": "Bans the author for a day.",
|
||||
"icon": "fas fa-gavel",
|
||||
"color": "text-danger",
|
||||
"price": 3000
|
||||
},
|
||||
"unban": {
|
||||
"kind": "unban",
|
||||
"title": "1-Day Unban",
|
||||
"description": "Removes 1 day from the ban duration of the recipient.",
|
||||
"icon": "fas fa-gavel",
|
||||
"color": "text-success",
|
||||
"price": 3500
|
||||
},
|
||||
"grass": {
|
||||
"kind": "grass",
|
||||
"title": "Grass",
|
||||
"description": "Ban the author permanently (must provide a timestamped picture of them touching grass to the admins to get unbanned)",
|
||||
"icon": "fas fa-seedling",
|
||||
"color": "text-success",
|
||||
"price": 10000
|
||||
},
|
||||
"shit": {
|
||||
"kind": "shit",
|
||||
"title": "Shit",
|
||||
"description": "Makes flies swarm a post.",
|
||||
"icon": "fas fa-poop",
|
||||
"color": "text-black-50",
|
||||
"price": 500
|
||||
},
|
||||
"fireflies": {
|
||||
"kind": "fireflies",
|
||||
"title": "Fireflies",
|
||||
"description": "Puts fireflies on the post.",
|
||||
"icon": "fas fa-sparkles",
|
||||
"color": "text-warning",
|
||||
"price": 500
|
||||
},
|
||||
"train": {
|
||||
"kind": "train",
|
||||
"title": "Train",
|
||||
"description": "Summons a train on the post.",
|
||||
"icon": "fas fa-train",
|
||||
"color": "text-pink",
|
||||
"price": 500
|
||||
},
|
||||
"pin": {
|
||||
"kind": "pin",
|
||||
"title": "1-Hour Pin",
|
||||
"description": "Pins the post.",
|
||||
"icon": "fas fa-thumbtack fa-rotate--45",
|
||||
"color": "text-warning",
|
||||
"price": 750
|
||||
},
|
||||
"unpin": {
|
||||
"kind": "unpin",
|
||||
"title": "1-Hour Unpin",
|
||||
"description": "Removes 1 hour from the pin duration of the post.",
|
||||
"icon": "fas fa-thumbtack fa-rotate--45",
|
||||
"color": "text-black",
|
||||
"price": 1000
|
||||
},
|
||||
}
|
||||
else:
|
||||
AWARDS = {
|
||||
"shit": {
|
||||
"kind": "shit",
|
||||
"title": "Shit",
|
||||
"description": "Makes flies swarm a post.",
|
||||
"icon": "fas fa-poop",
|
||||
"color": "text-black-50",
|
||||
"price": 500
|
||||
},
|
||||
"fireflies": {
|
||||
"kind": "fireflies",
|
||||
"title": "Fireflies",
|
||||
"description": "Puts fireflies on the post.",
|
||||
"icon": "fas fa-sparkles",
|
||||
"color": "text-warning",
|
||||
"price": 500
|
||||
},
|
||||
"train": {
|
||||
"kind": "train",
|
||||
"title": "Train",
|
||||
"description": "Summons a train on the post.",
|
||||
"icon": "fas fa-train",
|
||||
"color": "text-pink",
|
||||
"price": 500
|
||||
},
|
||||
"pin": {
|
||||
"kind": "pin",
|
||||
"title": "1-Hour Pin",
|
||||
"description": "Pins the post.",
|
||||
"icon": "fas fa-thumbtack fa-rotate--45",
|
||||
"color": "text-warning",
|
||||
"price": 750
|
||||
},
|
||||
"unpin": {
|
||||
"kind": "unpin",
|
||||
"title": "1-Hour Unpin",
|
||||
"description": "Removes 1 hour from the pin duration of the post.",
|
||||
"icon": "fas fa-thumbtack fa-rotate--45",
|
||||
"color": "text-black",
|
||||
"price": 1000
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
class AwardRelationship(Base):
|
||||
|
|
|
@ -23,117 +23,6 @@ defaultcolor = environ.get("DEFAULT_COLOR", "fff").strip()
|
|||
defaulttimefilter = environ.get("DEFAULT_TIME_FILTER", "all").strip()
|
||||
cardview = bool(int(environ.get("CARD_VIEW", 1)))
|
||||
|
||||
if site_name == "Drama":
|
||||
AWARDS = {
|
||||
"ban": {
|
||||
"kind": "ban",
|
||||
"title": "1-Day Ban",
|
||||
"description": "Bans the author for a day.",
|
||||
"icon": "fas fa-gavel",
|
||||
"color": "text-danger",
|
||||
"price": 3000
|
||||
},
|
||||
"unban": {
|
||||
"kind": "unban",
|
||||
"title": "1-Day Unban",
|
||||
"description": "Removes 1 day from the ban duration of the recipient.",
|
||||
"icon": "fas fa-gavel",
|
||||
"color": "text-success",
|
||||
"price": 3500
|
||||
},
|
||||
"grass": {
|
||||
"kind": "grass",
|
||||
"title": "Grass",
|
||||
"description": "Ban the author permanently (must provide a timestamped picture of them touching grass to the admins to get unbanned)",
|
||||
"icon": "fas fa-seedling",
|
||||
"color": "text-success",
|
||||
"price": 10000
|
||||
},
|
||||
"shit": {
|
||||
"kind": "shit",
|
||||
"title": "Shit",
|
||||
"description": "Makes flies swarm a post.",
|
||||
"icon": "fas fa-poop",
|
||||
"color": "text-black-50",
|
||||
"price": 500
|
||||
},
|
||||
"fireflies": {
|
||||
"kind": "fireflies",
|
||||
"title": "Fireflies",
|
||||
"description": "Puts fireflies on the post.",
|
||||
"icon": "fas fa-sparkles",
|
||||
"color": "text-warning",
|
||||
"price": 500
|
||||
},
|
||||
"train": {
|
||||
"kind": "train",
|
||||
"title": "Train",
|
||||
"description": "Summons a train on the post.",
|
||||
"icon": "fas fa-train",
|
||||
"color": "text-pink",
|
||||
"price": 500
|
||||
},
|
||||
"pin": {
|
||||
"kind": "pin",
|
||||
"title": "1-Hour Pin",
|
||||
"description": "Pins the post.",
|
||||
"icon": "fas fa-thumbtack fa-rotate--45",
|
||||
"color": "text-warning",
|
||||
"price": 750
|
||||
},
|
||||
"unpin": {
|
||||
"kind": "unpin",
|
||||
"title": "1-Hour Unpin",
|
||||
"description": "Removes 1 hour from the pin duration of the post.",
|
||||
"icon": "fas fa-thumbtack fa-rotate--45",
|
||||
"color": "text-black",
|
||||
"price": 1000
|
||||
},
|
||||
}
|
||||
else:
|
||||
AWARDS = {
|
||||
"shit": {
|
||||
"kind": "shit",
|
||||
"title": "Shit",
|
||||
"description": "Makes flies swarm a post.",
|
||||
"icon": "fas fa-poop",
|
||||
"color": "text-black-50",
|
||||
"price": 500
|
||||
},
|
||||
"fireflies": {
|
||||
"kind": "fireflies",
|
||||
"title": "Fireflies",
|
||||
"description": "Puts fireflies on the post.",
|
||||
"icon": "fas fa-sparkles",
|
||||
"color": "text-warning",
|
||||
"price": 500
|
||||
},
|
||||
"train": {
|
||||
"kind": "train",
|
||||
"title": "Train",
|
||||
"description": "Summons a train on the post.",
|
||||
"icon": "fas fa-train",
|
||||
"color": "text-pink",
|
||||
"price": 500
|
||||
},
|
||||
"pin": {
|
||||
"kind": "pin",
|
||||
"title": "1-Hour Pin",
|
||||
"description": "Pins the post.",
|
||||
"icon": "fas fa-thumbtack fa-rotate--45",
|
||||
"color": "text-warning",
|
||||
"price": 750
|
||||
},
|
||||
"unpin": {
|
||||
"kind": "unpin",
|
||||
"title": "1-Hour Unpin",
|
||||
"description": "Removes 1 hour from the pin duration of the post.",
|
||||
"icon": "fas fa-thumbtack fa-rotate--45",
|
||||
"color": "text-black",
|
||||
"price": 1000
|
||||
},
|
||||
}
|
||||
|
||||
class User(Base):
|
||||
__tablename__ = "users"
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from os import environ
|
||||
import re
|
||||
|
||||
site = environ.get("DOMAIN", '').strip()
|
||||
SITE = environ.get("DOMAIN", '').strip()
|
||||
SITE_NAME = environ.get("SITE_NAME", '').strip()
|
||||
|
||||
SLURS = {
|
||||
"faggot": "cute twink",
|
||||
|
@ -17,7 +18,6 @@ SLURS = {
|
|||
"troon": "🚂🚃🚃",
|
||||
"nonewnormal": "HorseDewormerAddicts",
|
||||
"kike": "https://sciencedirect.com/science/article/abs/pii/S016028960600033X",
|
||||
"retard": "r-slur",
|
||||
"janny": "j-slur",
|
||||
"jannie": "j-slur",
|
||||
"janny": "j-slur",
|
||||
|
@ -91,7 +91,7 @@ Thank you."""
|
|||
|
||||
BASED_MSG = "@{username}'s Based Count has increased by 1. Their Based Count is now {basedcount}.\n\nPills: {pills}"
|
||||
|
||||
if site == "pcmemes.net":
|
||||
if SITE == "pcmemes.net":
|
||||
BASEDBOT_ACCOUNT = 800
|
||||
NOTIFICATIONS_ACCOUNT = 1046
|
||||
AUTOJANNY_ACCOUNT = 1050
|
||||
|
@ -99,7 +99,7 @@ if site == "pcmemes.net":
|
|||
LONGPOSTBOT_ACCOUNT = 1832
|
||||
ZOZBOT_ACCOUNT = 1833
|
||||
AUTOPOLLER_ACCOUNT = 3369
|
||||
elif site == 'rdrama.net':
|
||||
elif SITE == 'rdrama.net':
|
||||
NOTIFICATIONS_ACCOUNT = 1046
|
||||
AUTOJANNY_ACCOUNT = 2360
|
||||
SNAPPY_ACCOUNT = 261
|
||||
|
@ -126,3 +126,122 @@ def sub_matcher(match: re.Match) -> str:
|
|||
def censor_slurs(body: str, logged_user) -> str:
|
||||
if not logged_user or logged_user.slurreplacer: body = SLUR_REGEX.sub(sub_matcher, body)
|
||||
return body
|
||||
|
||||
if SITE_NAME == "Drama":
|
||||
AWARDS = {
|
||||
"ban": {
|
||||
"kind": "ban",
|
||||
"title": "1-Day Ban",
|
||||
"description": "Bans the author for a day.",
|
||||
"icon": "fas fa-gavel",
|
||||
"color": "text-danger",
|
||||
"price": 3000
|
||||
},
|
||||
"unban": {
|
||||
"kind": "unban",
|
||||
"title": "1-Day Unban",
|
||||
"description": "Removes 1 day from the ban duration of the recipient.",
|
||||
"icon": "fas fa-gavel",
|
||||
"color": "text-success",
|
||||
"price": 3500
|
||||
},
|
||||
"grass": {
|
||||
"kind": "grass",
|
||||
"title": "Grass",
|
||||
"description": "Ban the author permanently (must provide a timestamped picture of them touching grass to the admins to get unbanned)",
|
||||
"icon": "fas fa-seedling",
|
||||
"color": "text-success",
|
||||
"price": 10000
|
||||
},
|
||||
"shit": {
|
||||
"kind": "shit",
|
||||
"title": "Shit",
|
||||
"description": "Makes flies swarm a post.",
|
||||
"icon": "fas fa-poop",
|
||||
"color": "text-black-50",
|
||||
"price": 500
|
||||
},
|
||||
"fireflies": {
|
||||
"kind": "fireflies",
|
||||
"title": "Fireflies",
|
||||
"description": "Puts fireflies on the post.",
|
||||
"icon": "fas fa-sparkles",
|
||||
"color": "text-warning",
|
||||
"price": 500
|
||||
},
|
||||
"train": {
|
||||
"kind": "train",
|
||||
"title": "Train",
|
||||
"description": "Summons a train on the post.",
|
||||
"icon": "fas fa-train",
|
||||
"color": "text-pink",
|
||||
"price": 500
|
||||
},
|
||||
"pin": {
|
||||
"kind": "pin",
|
||||
"title": "1-Hour Pin",
|
||||
"description": "Pins the post.",
|
||||
"icon": "fas fa-thumbtack fa-rotate--45",
|
||||
"color": "text-warning",
|
||||
"price": 750
|
||||
},
|
||||
"unpin": {
|
||||
"kind": "unpin",
|
||||
"title": "1-Hour Unpin",
|
||||
"description": "Removes 1 hour from the pin duration of the post.",
|
||||
"icon": "fas fa-thumbtack fa-rotate--45",
|
||||
"color": "text-black",
|
||||
"price": 1000
|
||||
},
|
||||
"agendaposter": {
|
||||
"kind": "agendaposter",
|
||||
"title": "Agendaposter",
|
||||
"description": "Force the agendaposter theme on the author for 24 hours.",
|
||||
"icon": "fas fa-snooze",
|
||||
"color": "text-purple",
|
||||
"price": 2000
|
||||
},
|
||||
}
|
||||
else:
|
||||
AWARDS = {
|
||||
"shit": {
|
||||
"kind": "shit",
|
||||
"title": "Shit",
|
||||
"description": "Makes flies swarm a post.",
|
||||
"icon": "fas fa-poop",
|
||||
"color": "text-black-50",
|
||||
"price": 500
|
||||
},
|
||||
"fireflies": {
|
||||
"kind": "fireflies",
|
||||
"title": "Fireflies",
|
||||
"description": "Puts fireflies on the post.",
|
||||
"icon": "fas fa-sparkles",
|
||||
"color": "text-warning",
|
||||
"price": 500
|
||||
},
|
||||
"train": {
|
||||
"kind": "train",
|
||||
"title": "Train",
|
||||
"description": "Summons a train on the post.",
|
||||
"icon": "fas fa-train",
|
||||
"color": "text-pink",
|
||||
"price": 500
|
||||
},
|
||||
"pin": {
|
||||
"kind": "pin",
|
||||
"title": "1-Hour Pin",
|
||||
"description": "Pins the post.",
|
||||
"icon": "fas fa-thumbtack fa-rotate--45",
|
||||
"color": "text-warning",
|
||||
"price": 750
|
||||
},
|
||||
"unpin": {
|
||||
"kind": "unpin",
|
||||
"title": "1-Hour Unpin",
|
||||
"description": "Removes 1 hour from the pin duration of the post.",
|
||||
"icon": "fas fa-thumbtack fa-rotate--45",
|
||||
"color": "text-black",
|
||||
"price": 1000
|
||||
},
|
||||
}
|
|
@ -31,7 +31,7 @@ def truescore(v):
|
|||
@limiter.limit("1/second")
|
||||
@admin_level_required(6)
|
||||
def revert_actions(v, username):
|
||||
if 'pcm' in request.host or ('rama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
|
||||
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
|
||||
user = get_user(username)
|
||||
if not user: abort(404)
|
||||
|
||||
|
@ -116,7 +116,7 @@ def club_ban(v, username):
|
|||
@limiter.limit("1/second")
|
||||
@admin_level_required(6)
|
||||
def make_admin(v, username):
|
||||
if 'pcm' in request.host or ('rama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
|
||||
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
|
||||
user = get_user(username)
|
||||
if not user: abort(404)
|
||||
user.admin_level = 6
|
||||
|
@ -129,7 +129,7 @@ def make_admin(v, username):
|
|||
@limiter.limit("1/second")
|
||||
@admin_level_required(6)
|
||||
def remove_admin(v, username):
|
||||
if 'pcm' in request.host or ('rama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
|
||||
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
|
||||
user = get_user(username)
|
||||
if not user: abort(404)
|
||||
user.admin_level = 0
|
||||
|
@ -142,7 +142,7 @@ def remove_admin(v, username):
|
|||
@limiter.limit("1/second")
|
||||
@admin_level_required(6)
|
||||
def make_fake_admin(v, username):
|
||||
if 'pcm' in request.host or ('rama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
|
||||
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
|
||||
user = get_user(username)
|
||||
if not user: abort(404)
|
||||
user.admin_level = 1
|
||||
|
@ -155,7 +155,7 @@ def make_fake_admin(v, username):
|
|||
@limiter.limit("1/second")
|
||||
@admin_level_required(6)
|
||||
def remove_fake_admin(v, username):
|
||||
if 'pcm' in request.host or ('rama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
|
||||
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
|
||||
user = get_user(username)
|
||||
if not user: abort(404)
|
||||
user.admin_level = 0
|
||||
|
@ -168,7 +168,7 @@ def remove_fake_admin(v, username):
|
|||
@limiter.limit("1/day")
|
||||
@admin_level_required(6)
|
||||
def monthly(v):
|
||||
if 'pcm' in request.host or ('rama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
|
||||
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
|
||||
thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id
|
||||
for u in g.db.query(User).options(lazyload('*')).filter(User.patron > 0).all():
|
||||
grant_awards = {}
|
||||
|
@ -672,8 +672,7 @@ def agendaposter(user_id, v):
|
|||
if expiry:
|
||||
expiry = int(expiry)
|
||||
expiry = g.timestamp + expiry*60*60*24
|
||||
else:
|
||||
expiry = 0
|
||||
else: expiry = 0
|
||||
|
||||
user.agendaposter = not user.agendaposter
|
||||
user.agendaposter_expires_utc = expiry
|
||||
|
|
|
@ -16,13 +16,13 @@ AWARDS2 = {
|
|||
"color": "text-danger",
|
||||
"price": 3000
|
||||
},
|
||||
"grass": {
|
||||
"kind": "grass",
|
||||
"title": "Grass",
|
||||
"description": "Ban the author permanently (must provide a timestamped picture of them touching grass to the admins to get unbanned)",
|
||||
"icon": "fas fa-seedling",
|
||||
"color": "text-success",
|
||||
"price": 10000
|
||||
"fireflies": {
|
||||
"kind": "fireflies",
|
||||
"title": "Fireflies",
|
||||
"description": "Puts fireflies on the post.",
|
||||
"icon": "fas fa-sparkles",
|
||||
"color": "text-warning",
|
||||
"price": 500
|
||||
},
|
||||
"shit": {
|
||||
"kind": "shit",
|
||||
|
@ -104,6 +104,14 @@ def shop(v):
|
|||
"color": "text-black",
|
||||
"price": 1000
|
||||
},
|
||||
"agendaposter": {
|
||||
"kind": "agendaposter",
|
||||
"title": "Agendaposter",
|
||||
"description": "Force the agendaposter theme on the author for 24 hours.",
|
||||
"icon": "fas fa-snooze",
|
||||
"color": "text-purple",
|
||||
"price": 2000
|
||||
},
|
||||
}
|
||||
else:
|
||||
AWARDS = {
|
||||
|
@ -246,6 +254,14 @@ def buy(v, award):
|
|||
"color": "text-black",
|
||||
"price": 1000
|
||||
},
|
||||
"agendaposter": {
|
||||
"kind": "agendaposter",
|
||||
"title": "Agendaposter",
|
||||
"description": "Force the agendaposter theme on the author for 24 hours.",
|
||||
"icon": "fas fa-snooze",
|
||||
"color": "text-purple",
|
||||
"price": 2000
|
||||
},
|
||||
}
|
||||
else:
|
||||
AWARDS = {
|
||||
|
@ -363,8 +379,8 @@ def award_post(pid, v):
|
|||
|
||||
send_notification(NOTIFICATIONS_ACCOUNT, post.author, msg)
|
||||
|
||||
author = post.author
|
||||
if kind == "ban":
|
||||
author = post.author
|
||||
link = f"[this post]({post.permalink})"
|
||||
|
||||
if not author.is_suspended:
|
||||
|
@ -374,7 +390,6 @@ def award_post(pid, v):
|
|||
author.unban_utc += 24*60*60
|
||||
send_notification(NOTIFICATIONS_ACCOUNT, author, f"Your account has been suspended for yet another day for {link}. Seriously man?")
|
||||
elif kind == "unban":
|
||||
author = post.author
|
||||
if not author.is_suspended or not author.unban_utc or time.time() > author.unban_utc: abort(403)
|
||||
|
||||
if author.unban_utc - time.time() > 86400:
|
||||
|
@ -385,7 +400,6 @@ def award_post(pid, v):
|
|||
author.is_banned = 0
|
||||
send_notification(NOTIFICATIONS_ACCOUNT, author, f"You have been unbanned!")
|
||||
elif kind == "grass":
|
||||
author = post.author
|
||||
author.is_banned = AUTOJANNY_ACCOUNT
|
||||
author.ban_reason = f"grass award used by @{v.username} on /post/{post.id}"
|
||||
link = f"[this post]({post.permalink})"
|
||||
|
@ -404,6 +418,14 @@ def award_post(pid, v):
|
|||
cache.delete_memoized(frontlist)
|
||||
else: post.stickied = f"t:{t}"
|
||||
g.db.add(post)
|
||||
elif kind == "agendaposter" and not (author.agendaposter and author.agendaposter_expires_utc == 0):
|
||||
if author.agendaposter_expires_utc and time.time() < author.agendaposter_expires_utc: author.agendaposter_expires_utc += 86400
|
||||
else: author.agendaposter_expires_utc = time.time() + 86400
|
||||
|
||||
author.agendaposter = True
|
||||
if not author.has_badge(26):
|
||||
badge = Badge(user_id=author.id, badge_id=26)
|
||||
g.db.add(badge)
|
||||
|
||||
post.author.received_award_count += 1
|
||||
g.db.add(post.author)
|
||||
|
@ -459,9 +481,9 @@ def award_comment(cid, v):
|
|||
if note: msg += f"\n\n> {note}"
|
||||
|
||||
send_notification(NOTIFICATIONS_ACCOUNT, c.author, msg)
|
||||
author = c.author
|
||||
|
||||
if kind == "ban":
|
||||
author = c.author
|
||||
link = f"[this comment]({c.permalink})"
|
||||
|
||||
if not author.is_suspended:
|
||||
|
@ -471,7 +493,6 @@ def award_comment(cid, v):
|
|||
author.unban_utc += 24*60*60
|
||||
send_notification(NOTIFICATIONS_ACCOUNT, author, f"Your account has been suspended for yet another day for {link}. Seriously man?")
|
||||
elif kind == "unban":
|
||||
author = c.author
|
||||
if not author.is_suspended or not author.unban_utc or time.time() > author.unban_utc: abort(403)
|
||||
|
||||
if author.unban_utc - time.time() > 86400:
|
||||
|
@ -482,7 +503,6 @@ def award_comment(cid, v):
|
|||
author.is_banned = 0
|
||||
send_notification(NOTIFICATIONS_ACCOUNT, author, f"You have been unbanned!")
|
||||
elif kind == "grass":
|
||||
author = c.author
|
||||
author.is_banned = AUTOJANNY_ACCOUNT
|
||||
author.ban_reason = f"grass award used by @{v.username} on /comment/{c.id}"
|
||||
link = f"[this comment]({c.permalink})"
|
||||
|
@ -498,6 +518,14 @@ def award_comment(cid, v):
|
|||
if time.time() > t: c.is_pinned = None
|
||||
else: c.is_pinned = f"t:{t}"
|
||||
g.db.add(c)
|
||||
elif kind == "agendaposter" and not (author.agendaposter and author.agendaposter_expires_utc == 0):
|
||||
if author.agendaposter_expires_utc and time.time() < author.agendaposter_expires_utc: author.agendaposter_expires_utc += 86400
|
||||
else: author.agendaposter_expires_utc = time.time() + 86400
|
||||
|
||||
author.agendaposter = True
|
||||
if not author.has_badge(26):
|
||||
badge = Badge(user_id=author.id, badge_id=26)
|
||||
g.db.add(badge)
|
||||
|
||||
c.author.received_award_count += 1
|
||||
g.db.add(c.author)
|
||||
|
@ -510,6 +538,7 @@ def award_comment(cid, v):
|
|||
@admin_level_required(6)
|
||||
def admin_userawards_get(v):
|
||||
|
||||
if v.username == "Aevann": return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v)
|
||||
return render_template("admin/awards.html", awards=list(AWARDS2.values()), v=v)
|
||||
|
||||
@app.post("/admin/awards")
|
||||
|
@ -532,8 +561,7 @@ def admin_userawards_post(v):
|
|||
thing = latest.id
|
||||
|
||||
for key, value in request.values.items():
|
||||
if key not in AWARDS:
|
||||
continue
|
||||
if key not in AWARDS: continue
|
||||
|
||||
if value:
|
||||
|
||||
|
@ -560,4 +588,5 @@ def admin_userawards_post(v):
|
|||
|
||||
g.db.commit()
|
||||
|
||||
if v.username == "Aevann": return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v)
|
||||
return render_template("admin/awards.html", awards=list(AWARDS2.values()), v=v)
|
|
@ -11,6 +11,7 @@ BOT_TOKEN = environ.get("DISCORD_BOT_TOKEN").strip()
|
|||
COINS_NAME = environ.get("COINS_NAME").strip()
|
||||
DISCORD_ENDPOINT = "https://discordapp.com/api/v6"
|
||||
WELCOME_CHANNEL="846509313941700618"
|
||||
SITE_NAME = environ.get("SITE_NAME", "").strip()
|
||||
|
||||
@app.get("/discord")
|
||||
@auth_required
|
||||
|
@ -18,7 +19,7 @@ def join_discord(v):
|
|||
|
||||
if v.is_suspended != 0 and v.admin_level == 0: return "Banned users cannot join the discord server!"
|
||||
|
||||
if 'rama' in request.host and v.admin_level == 0 and v.patron == 0 and v.truecoins < 150: return f"You must earn 150 {COINS_NAME} before entering the Discord server. You earn {COINS_NAME} by making posts/comments and getting upvoted."
|
||||
if SITE_NAME == 'Drama' and v.admin_level == 0 and v.patron == 0 and v.truecoins < 150: return f"You must earn 150 {COINS_NAME} before entering the Discord server. You earn {COINS_NAME} by making posts/comments and getting upvoted."
|
||||
|
||||
if v.shadowbanned or v.agendaposter: return ""
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ from files.__main__ import app, cache
|
|||
from files.classes.submission import Submission
|
||||
|
||||
defaulttimefilter = environ.get("DEFAULT_TIME_FILTER", "all").strip()
|
||||
SITE_NAME = environ.get("SITE_NAME", "").strip()
|
||||
|
||||
@app.get("/post/")
|
||||
def slash_post():
|
||||
|
@ -147,7 +148,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
|
|||
|
||||
posts = g.db.query(Submission.id).options(lazyload('*'))
|
||||
|
||||
if 'rama' in request.host and sort == "hot":
|
||||
if SITE_NAME == 'Drama' and sort == "hot":
|
||||
cutoff = int(time.time()) - 86400
|
||||
posts = posts.filter(Submission.created_utc >= cutoff)
|
||||
elif t != 'all':
|
||||
|
|
|
@ -21,6 +21,7 @@ valid_password_regex = re.compile("^.{8,100}$")
|
|||
YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip()
|
||||
COINS_NAME = environ.get("COINS_NAME").strip()
|
||||
GUMROAD_TOKEN = environ.get("GUMROAD_TOKEN", "").strip()
|
||||
SITE_NAME = environ.get("SITE_NAME", "").strip()
|
||||
|
||||
tiers={
|
||||
"(Paypig)": 1,
|
||||
|
@ -284,7 +285,7 @@ def themecolor(v):
|
|||
@auth_required
|
||||
@validate_formkey
|
||||
def gumroad(v):
|
||||
if 'rama' in request.host: patron = 'Paypig'
|
||||
if SITE_NAME == 'Drama': patron = 'Paypig'
|
||||
else: patron = 'Patron'
|
||||
|
||||
if not (v.email and v.is_activated): return {"error": f"You must have a verified email to verify {patron} status and claim your rewards"}, 400
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=82">
|
||||
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=82">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=84"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=84">
|
||||
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=84">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=82">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=84"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=84">
|
||||
{% endif %}
|
||||
|
||||
</head>
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
|
||||
@media (min-width: 767.98px) {
|
||||
.award-columns {
|
||||
column-count: 8 !important;
|
||||
column-count: 9 !important;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -250,12 +250,12 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=82">
|
||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=82">
|
||||
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=82">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=84">
|
||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=84">
|
||||
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=84">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=82">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=84"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=84">
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=82">
|
||||
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=82">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=84"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=84">
|
||||
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=84">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=82">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=84"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=84">
|
||||
{% endif %}
|
||||
|
||||
<div class="row justify-content-around">
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<title>2-Step Login - {{'SITE_NAME' | app_config}}</title>
|
||||
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=82">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=84"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=84">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -55,8 +55,8 @@
|
|||
|
||||
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=82">
|
||||
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=82">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=84"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=84">
|
||||
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=84">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
|
||||
|
||||
<link href="/assets/css/fa.css?v=52" rel="stylesheet">
|
||||
</head>
|
||||
|
@ -127,9 +127,6 @@
|
|||
<li class="nav-item">
|
||||
<a class="nav-link{% if request.path=='/settings/apps' %} active{% endif %}" href="/settings/apps">Apps</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{% if 'shop' in request.path %} active{% endif %}" href="/shop">Shop</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
@ -159,9 +156,6 @@
|
|||
<li class="nav-item">
|
||||
<a class="nav-link{% if request.path=='/settings/apps' %} active{% endif %} navsettings" href="/settings/apps"><i class="fas fa-code text-base mr-0"></i></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{% if 'shop' in request.path %} active{% endif %} navsettings" href="/shop"><i class="fas fa-store text-base mr-0"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -40,10 +40,10 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=82">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=84"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=84">
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=82">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=84"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=84">
|
||||
{% endif %}
|
||||
|
||||
<link href="/assets/css/fa.css?v=52" rel="stylesheet">
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600&display=swap" rel="stylesheet">
|
||||
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=82">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=84"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=84">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600&display=swap" rel="stylesheet">
|
||||
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=82">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=84"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=84">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
{% block stylesheets %}
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=82">
|
||||
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=82">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=84"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=84">
|
||||
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=84">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=82">
|
||||
<link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=82">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=84">
|
||||
<link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=84">
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
|
Loading…
Reference in New Issue