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

master
Aevann1 2022-09-19 18:54:32 +00:00
commit 3ad2384b65
38 changed files with 1531 additions and 2106 deletions

View File

@ -4625,13 +4625,6 @@ span.green {
.patron[style="background-color:#FFFFFF;"] {
color: black !important;
}
.post--category-tag {
padding: 2px 5px 3px 5px;
border-radius: 5px;
font-size: 12px;
font-weight: 700;
margin-right: 0.25rem;
}
.container, .container-fluid {
background-color: var(--background) !important;
}
@ -5684,19 +5677,6 @@ g {
border-radius:.35rem;
}
.category--tag-button {
display: inline-block;
cursor: pointer;
}
#submit-categories input {
display: none;
}
#submit-categories input:checked + label {
border: 5px var(--black) double;
}
/* ------- Font Awesome ------- */
@font-face{
font-family:"Font Awesome 6 Pro";
@ -6070,7 +6050,7 @@ g {
}
@media (max-width: 767.98px) {
.pronouns, .patron, .post--category-tag, .mod {
.pronouns, .patron, .mod {
padding: 2px 5px !important;
}
}

View File

@ -1,41 +0,0 @@
function category_modal(id, title, sub) {
document.getElementById("category-modal-title").innerHTML = `Category: ${title}`;
xhrCategories = new XMLHttpRequest();
xhrCategories.open("GET", "/categories.json");
xhrCategories.onload = function () {
let data;
try {
data = JSON.parse(xhrCategories.response);
} catch(e) { console.log(e) }
categories = [{id: '', name: 'None', sub: sub, color_text: '#000', color_bg: '#FFF'}];
categories = [].concat(categories, data[sub]);
document.getElementById("category-modal-body").innerHTML = '';
categories.forEach(function (c) {
document.getElementById("category-modal-body").innerHTML +=
`<div class="category--tag-button" data-category="${c.id}">` +
`<span class="post--category-tag" style="color:${c.color_text}; ` +
`background-color:${c.color_bg};">${c.name}</span>` +
`</div>`;
});
document.querySelectorAll('.category--tag-button').forEach(tag =>
tag.addEventListener('click', function (e) {
reqBody = new FormData();
reqBody.append('formkey', formkey());
reqBody.append('post_id', id);
reqBody.append('category_id', tag.dataset.category);
xhrSubmit = new XMLHttpRequest();
xhrSubmit.open('POST', `/post_recategorize`);
xhrSubmit.onload = function () {
window.location.reload();
}
xhrSubmit.send(reqBody);
})
);
}
xhrCategories.send();
}

View File

@ -180,32 +180,6 @@ function checkRepost() {
}
}
function updateCategories() {
if (document.getElementById("submit-categories") == null) {
return;
}
sub = document.getElementById("sub").value;
xhrCategories = new XMLHttpRequest();
xhrCategories.open("GET", "/categories.json");
xhrCategories.onload = function () {
let data;
try {
data = JSON.parse(xhrCategories.response);
} catch(e) { console.log(e) }
document.getElementById("submit-categories").innerHTML = '';
data[sub].forEach(function (c) {
document.getElementById("submit-categories").innerHTML +=
`<input type="radio" id="category-${c.id}" name="category" value="${c.id}">` +
`<label for="category-${c.id}" class="post--category-tag" ` +
`style="color:${c.color_text}; background-color:${c.color_bg};">` +
`${c.name}</label>`;
});
}
xhrCategories.send();
}
document.addEventListener('keydown', (e) => {
if(!((e.ctrlKey || e.metaKey) && e.key === "Enter"))
return;
@ -215,5 +189,4 @@ document.addEventListener('keydown', (e) => {
submitButton.click();
});
checkRepost();
updateCategories();
checkRepost();

View File

@ -8,7 +8,6 @@ from .badges import *
from .userblock import *
from .submission import *
from .votes import *
from .category import *
from .domains import *
from .subscriptions import *
from files.__main__ import app

View File

@ -1,31 +0,0 @@
from sqlalchemy import *
from sqlalchemy.orm import relationship
from files.__main__ import Base
import time
class Category(Base):
__tablename__ = "category"
id = Column(Integer, primary_key=True, nullable=False)
name = Column(String(128), nullable=False)
sub = Column(String(20), ForeignKey("subs.name"))
color_text = Column(String(6))
color_bg = Column(String(6))
created_utc = Column(Integer)
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self):
return f"<Category(id={self.id})>"
def as_json(self):
data = {
'id': self.id,
'name': self.name,
'sub': self.sub if self.sub else '',
'color_text': '#' + self.color_text,
'color_bg': '#' + self.color_bg,
}
return data

View File

@ -383,7 +383,7 @@ class Comment(Base):
body += f'''><label class="custom-control-label" for="comment-{o.id}">{o.body_html} -
<a href="/votes/comment/option/{o.id}"><span id="score-comment-{o.id}">{o.upvotes}</span> votes</a></label></div>'''
if self.author.sig_html and (self.author_id == MOOSE_ID or (not self.ghost and not (v and (v.sigs_disabled or v.poor)))):
if not self.ghost and self.author.show_sig(v):
body += f"<hr>{self.author.sig_html}"
return body

View File

@ -314,11 +314,6 @@ ACTIONTYPES = {
"icon": 'fa-thumbtack fa-rotate--45',
"color": 'bg-success'
},
'post_recategorize': {
"str": 'changed category of {self.target_link}',
"icon": 'fa-grid',
"color": 'bg-primary'
},
'purge_cache': {
"str": 'purged cache',
"icon": 'fa-memory',

View File

@ -53,7 +53,6 @@ class Submission(Base):
body = Column(String)
body_html = Column(String)
flair = Column(String)
category_id = Column(Integer, ForeignKey("category.id"))
ban_reason = Column(String)
embed_url = Column(String)
new = Column(Boolean)
@ -67,7 +66,6 @@ class Submission(Base):
comments = relationship("Comment", primaryjoin="Comment.parent_submission==Submission.id", back_populates="post")
subr = relationship("Sub", primaryjoin="foreign(Submission.sub)==remote(Sub.name)")
options = relationship("SubmissionOption", order_by="SubmissionOption.id")
category = relationship("Category", primaryjoin="Submission.category_id==Category.id")
bump_utc = deferred(Column(Integer, server_default=FetchedValue()))
@ -396,8 +394,7 @@ class Submission(Base):
<a href="/votes/post/option/{o.id}"><span id="score-post-{o.id}">{o.upvotes}</span> votes</a></label></div>'''
if not listing and self.author.sig_html and (self.author_id == MOOSE_ID or (not self.ghost and not (v and (v.sigs_disabled or v.poor)))):
if not listing and not self.ghost and self.author.show_sig(v):
body += f"<hr>{self.author.sig_html}"
return body

File diff suppressed because it is too large Load Diff

View File

@ -124,8 +124,6 @@ AGENDAPOSTER_MSG_HTML = """<p>Hi <a href="/id/{id}"><img loading="lazy" src="/pp
################################################################################
PERMS = { # Minimum admin_level to perform action.
'ADMIN_CATEGORIES_CHANGE': 2, # change category on post ("recategorize")
'ADMIN_CATEGORIES_MANAGE': 3, # create/update/delete categories
'HOLE_CREATE': 0,
'FLAGS_REMOVE': 2,
'VOTES_VISIBLE': 0,
@ -137,7 +135,6 @@ PERMS = { # Minimum admin_level to perform action.
FEATURES = {
'PROCOINS': True,
'AWARDS': True,
'CATEGORIES': False,
'CHAT': True,
'PINS': True,
'COUNTRY_CLUB': True,
@ -154,7 +151,6 @@ FEATURES = {
'MARKUP_COMMANDS': True,
'REPOST_DETECTION': True,
'PATRON_ICONS': False,
'ORDER': False
}
EMOJI_MARSEYS = True
@ -189,7 +185,6 @@ PIZZA_VOTERS = ()
IDIO_ID = 0
CARP_ID = 0
JOAN_ID = 0
MOOSE_ID = 0
AEVANN_ID = 0
SNAKES_ID = 0
HOMO_ID = 0
@ -218,7 +213,6 @@ GIFT_NOTIF_ID = 5
if SITE == 'rdrama.net':
FEATURES['PRONOUNS'] = True
FEATURES['HOUSES'] = True
FEATURES['ORDER'] = True
SIDEBAR_THREAD = 37696
BANNER_THREAD = 37697
@ -244,7 +238,6 @@ if SITE == 'rdrama.net':
IDIO_ID = 30
CARP_ID = 995
JOAN_ID = 28
MOOSE_ID = 1904
AEVANN_ID = 1
SNAKES_ID = 10288
HOMO_ID = 147
@ -318,7 +311,6 @@ elif SITE == 'watchpeopledie.co':
else: # localhost or testing environment implied
FEATURES['PRONOUNS'] = True
FEATURES['HOUSES'] = True
FEATURES['ORDER'] = True
bots = {AUTOJANNY_ID, SNAPPY_ID, LONGPOSTBOT_ID, ZOZBOT_ID, BASEDBOT_ID}
@ -1075,4 +1067,19 @@ has_app = path.exists(f'files/assets/app_{SITE_NAME}_v2.4.apk')
GLOBAL = environ.get("GLOBAL")
ONLINE_STR = f'{SITE}_online'
ONLINE_STR = f'{SITE}_online'
forced_hats = {
"rehab": ("Roulette", "I'm a recovering ludomaniac!"),
"progressivestack": ("Attention Whore", "I won the oppression olympics!"),
"longpost": ("The Pizzashill", "We need to get rid of the character limit!"),
"bird": ("Bluecheck", "Three sentences is too much for me..."),
"marseyawarded": ("Three Lil Marseys", ":marseynotes: :marseynotes: :I prefer to speak in cats:"),
"bite": ("Vampire Mask", "When other little girls wanted to be ballet dancers I kind of wanted to be a vampire."),
"rainbow": ("Globohomo", "Homosexuality is no longer optional!"),
"owoify": ("Furry Marsey", "Nuzzles, pounces on you, UwU, you're so warm!.."),
"earlylife": ("The Merchant", "SHUT IT DOWN, the goys know!"),
"marsify": ("Marsified", "I can't pick my own Marseys, help!"),
"is_banned": ("Behind Bars", "This user is banned and needs to do better!"),
"agendaposter": ("Egg_irl", "This user is getting in touch with xir identity!")
}

View File

@ -87,7 +87,6 @@ def sub_inactive_purge_task():
g.db.add(post)
to_delete = mods \
+ g.db.query(Category).filter(Category.sub.in_(names)).all() \
+ g.db.query(Exile).filter(Exile.sub.in_(names)).all() \
+ g.db.query(SubBlock).filter(SubBlock.sub.in_(names)).all() \
+ g.db.query(SubJoin).filter(SubJoin.sub.in_(names)).all() \

View File

@ -1,6 +1,5 @@
from files.classes import *
from flask import g
from sqlalchemy.orm import joinedload
def get_id(username, v=None, graceful=False):
@ -136,8 +135,6 @@ def get_post(i, v=None, graceful=False):
Submission,
vt.c.vote_type,
blocking.c.target_id,
).options(
joinedload(Submission.category)
)
post=post.filter(Submission.id == i
@ -191,8 +188,6 @@ def get_posts(pids, v=None):
blocked.c.target_id,
).filter(
Submission.id.in_(pids)
).options(
joinedload(Submission.category)
).join(
vt, vt.c.submission_id==Submission.id, isouter=True
).join(

View File

@ -51,7 +51,7 @@ def timestamp(timestamp):
def inject_constants():
return {"environ":environ, "SITE":SITE, "SITE_NAME":SITE_NAME, "SITE_FULL":SITE_FULL,
"AUTOJANNY_ID":AUTOJANNY_ID, "PUSHER_ID":PUSHER_ID,
"CC":CC, "CC_TITLE":CC_TITLE, "listdir":listdir, "MOOSE_ID":MOOSE_ID, "AEVANN_ID":AEVANN_ID,
"CC":CC, "CC_TITLE":CC_TITLE, "listdir":listdir, "AEVANN_ID":AEVANN_ID,
"PIZZASHILL_ID":PIZZASHILL_ID, "DEFAULT_COLOR":DEFAULT_COLOR,
"COLORS":COLORS, "time":time, "PERMS":PERMS, "FEATURES":FEATURES,
"HOLE_NAME":HOLE_NAME, "HOLE_STYLE_FLAIR":HOLE_STYLE_FLAIR, "HOLE_REQUIRED":HOLE_REQUIRED,

View File

@ -1459,86 +1459,6 @@ def admin_toggle_ban_domain(v):
return redirect("/admin/banned_domains/")
@app.get("/admin/categories")
@admin_level_required(PERMS['ADMIN_CATEGORIES_MANAGE'])
def admin_categories(v):
if not FEATURES['CATEGORIES']:
abort(404)
categories = g.db.query(Category).order_by(nullsfirst(Category.sub), Category.name).all()
return render_template("admin/categories.html", v=v, categories=categories)
@app.post("/admin/categories/add")
@admin_level_required(PERMS['ADMIN_CATEGORIES_MANAGE'])
def admin_categories_add(v):
if not FEATURES['CATEGORIES']:
abort(404)
cat_name = request.values.get("name").strip()
cat_sub = request.values.get("sub").strip().lower()
cat_color_text = request.values.get("color_text").strip().strip('#').lower()
cat_color_bg = request.values.get("color_bg").strip().strip('#').lower()
if cat_sub == '':
cat_sub = None
cat = Category(
name=cat_name,
sub=cat_sub,
color_text=cat_color_text,
color_bg=cat_color_bg
)
g.db.add(cat)
g.db.commit()
return redirect("/admin/categories")
@app.post("/admin/categories/update/<cid>")
@admin_level_required(PERMS['ADMIN_CATEGORIES_MANAGE'])
def admin_categories_update(v, cid):
if not FEATURES['CATEGORIES']:
abort(404)
cat_name = request.values.get("name").strip()
cat_color_text = request.values.get("color_text").strip().strip('#').lower()
cat_color_bg = request.values.get("color_bg").strip().strip('#').lower()
try:
cat_id = int(cid)
except:
abort(400)
cat = g.db.query(Category).filter(Category.id == cat_id).one_or_none()
if not cat:
abort(400)
cat.name = cat_name
cat.color_text = cat_color_text
cat.color_bg = cat_color_bg
g.db.add(cat)
g.db.commit()
return redirect("/admin/categories")
@app.post("/admin/categories/delete/<cid>")
@admin_level_required(PERMS['ADMIN_CATEGORIES_MANAGE'])
def admin_categories_delete(v, cid):
if not FEATURES['CATEGORIES']:
abort(404)
try:
cat_id = int(cid)
except:
abort(400)
cat = g.db.query(Category).filter(Category.id == cat_id).one_or_none()
g.db.delete(cat)
g.db.commit()
return redirect("/admin/categories")
@app.post("/admin/nuke_user")
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@admin_level_required(2)

View File

@ -1,5 +1,5 @@
from shutil import move, copyfile
from os import listdir, rename
from os import listdir, rename, path
from files.__main__ import app, limiter
from files.helpers.const import *
@ -373,12 +373,15 @@ def update_marsey(v):
if not existing:
return error("A marsey with this name doesn't exist!")
for x in ('png','jpeg','webp','gif'):
if path.isfile(f'/asset_submissions/marseys/original/{name}.{x}'):
os.remove(f'/asset_submissions/marseys/original/{name}.{x}')
highquality = f"/asset_submissions/marseys/{name}"
file.save(highquality)
with Image.open(highquality) as i:
format = i.format.lower()
new_path = f'/asset_submissions/marseys/original/{name}.{format}'
new_path = f'/asset_submissions/marseys/original/{name}.{format}'
rename(highquality, new_path)
filename = f"files/assets/images/emojis/{name}.webp"
@ -430,7 +433,12 @@ def update_hat(v):
return error("Images must be 100x130")
format = i.format.lower()
new_path = f'/asset_submissions/hats/original/{name}.{format}'
new_path = f'/asset_submissions/hats/original/{name}.{format}'
for x in ('png','jpeg','webp','gif'):
if path.isfile(f'/asset_submissions/hats/original/{name}.{x}'):
os.remove(f'/asset_submissions/hats/original/{name}.{x}')
rename(highquality, new_path)
filename = f"files/assets/images/hats/{name}.webp"

View File

@ -1,497 +1,497 @@
from files.__main__ import app, limiter
from files.helpers.wrappers import *
from files.helpers.alerts import *
from files.helpers.get import *
from files.helpers.const import *
from files.helpers.regex import *
from files.helpers.discord import *
from files.helpers.actions import *
from files.classes.award import *
from .front import frontlist
from flask import g, request
from files.helpers.sanitize import filter_emojis_only
from files.helpers.marsify import marsify
from files.helpers.owoify import owoify
from copy import deepcopy
@app.get("/shop")
@app.get("/settings/shop")
@auth_required
def shop(v):
if not FEATURES['AWARDS']:
abort(404)
AWARDS = deepcopy(AWARDS2)
if v.house:
AWARDS[v.house] = deepcopy(HOUSE_AWARDS[v.house])
for val in AWARDS.values(): val["owned"] = 0
for useraward in g.db.query(AwardRelationship).filter(AwardRelationship.user_id == v.id, AwardRelationship.submission_id == None, AwardRelationship.comment_id == None).all():
if useraward.kind in AWARDS: AWARDS[useraward.kind]["owned"] += 1
for val in AWARDS.values():
val["baseprice"] = int(val["price"])
if val["kind"].endswith('Founder'):
val["baseprice"] = int(val["baseprice"] / 0.75)
val["price"] = int(val["price"] * v.discount)
sales = g.db.query(func.sum(User.coins_spent)).scalar()
return render_template("shop.html", awards=list(AWARDS.values()), v=v, sales=sales)
@app.post("/buy/<award>")
@limiter.limit("100/minute;200/hour;1000/day")
@auth_required
def buy(v, award):
if not FEATURES['AWARDS']:
abort(404)
if award == 'benefactor' and not request.values.get("mb"):
return {"error": "You can only buy the Benefactor award with marseybux."}, 403
if award == 'ghost' and v.admin_level < 2:
return {"error": "Only admins can buy this award."}, 403
AWARDS = deepcopy(AWARDS2)
if v.house:
AWARDS[v.house] = HOUSE_AWARDS[v.house]
if award not in AWARDS: abort(400)
og_price = AWARDS[award]["price"]
price = int(og_price * v.discount)
if request.values.get("mb"):
if award == "grass":
return {"error": "You can't buy the grass award with marseybux."}, 403
charged = v.charge_account('procoins', price)
if not charged:
return {"error": "Not enough marseybux."}, 400
else:
charged = v.charge_account('coins', price)
if not charged:
return {"error": "Not enough coins."}, 400
v.coins_spent += price
if v.coins_spent >= 1000000:
badge_grant(badge_id=73, user=v)
elif v.coins_spent >= 500000:
badge_grant(badge_id=72, user=v)
elif v.coins_spent >= 250000:
badge_grant(badge_id=71, user=v)
elif v.coins_spent >= 100000:
badge_grant(badge_id=70, user=v)
elif v.coins_spent >= 10000:
badge_grant(badge_id=69, user=v)
g.db.add(v)
if award == "lootbox":
lootbox_items = []
for i in [1,2,3,4,5]:
award = random.choice(["firework", "confetti", "ricardo", "wholesome", "shit", "fireflies", "scooter", "train"])
lootbox_items.append(AWARDS[award]['title'])
award = AwardRelationship(user_id=v.id, kind=award)
g.db.add(award)
g.db.flush()
v.lootboxes_bought += 1
lootbox_msg = "You open your lootbox and receive: " + ', '.join(lootbox_items)
send_repeatable_notification(v.id, lootbox_msg)
if v.lootboxes_bought == 10:
badge_grant(badge_id=76, user=v)
elif v.lootboxes_bought == 50:
badge_grant(badge_id=77, user=v)
elif v.lootboxes_bought == 150:
badge_grant(badge_id=78, user=v)
else:
award_object = AwardRelationship(user_id=v.id, kind=award)
g.db.add(award_object)
g.db.add(v)
if CARP_ID and v.id != CARP_ID and og_price >= 10000:
send_repeatable_notification(CARP_ID, f"@{v.username} has bought a `{award}` award!")
return {"message": f"{award} award bought!"}
@app.post("/award/<thing_type>/<id>")
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
@is_not_permabanned
def award_thing(v, thing_type, id):
if not FEATURES['AWARDS']:
abort(404)
if thing_type == 'post': thing = get_post(id)
else: thing = get_comment(id)
if not thing: return {"error": f"This {thing_type} doesn't exist."}, 404
if v.shadowbanned: return render_template('errors/500.html', err=True, v=v), 500
kind = request.values.get("kind", "").strip()
AWARDS = deepcopy(AWARDS2)
if v.house:
AWARDS[v.house] = HOUSE_AWARDS[v.house]
if kind not in AWARDS:
return {"error": "This award doesn't exist."}, 404
award = g.db.query(AwardRelationship).filter(
AwardRelationship.kind == kind,
AwardRelationship.user_id == v.id,
AwardRelationship.submission_id == None,
AwardRelationship.comment_id == None
).first()
if not award:
return {"error": "You don't have that award."}, 404
if thing_type == 'post': award.submission_id = thing.id
else: award.comment_id = thing.id
award.awarded_utc = int(time.time())
g.db.add(award)
note = request.values.get("note", "").strip()
author = thing.author
if author.id in (PIZZASHILL_ID, DAD_ID) and v.id not in (PIZZASHILL_ID, DAD_ID):
return {"error": "This user is immune to awards."}, 403
if kind == "benefactor" and author.id == v.id:
return {"error": "You can't use this award on yourself."}, 400
if kind == 'marsify' and author.marsify == 1:
return {"error": "User is already permenantly marsified!"}, 403
if v.id != author.id:
if author.deflector and v.deflector:
msg = f"@{v.username} has tried to give your [{thing_type}]({thing.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected on them, they also had a deflector up, so it bounced back and forth until it vaporized!"
send_repeatable_notification(author.id, msg)
msg = f"@{author.username} is under the effect of a deflector award; your {AWARDS[kind]['title']} Award has been deflected back to you but your deflector protected you, the award bounced back and forth until it vaporized!"
send_repeatable_notification(v.id, msg)
g.db.delete(award)
if request.referrer and len(request.referrer) > 1:
if request.referrer == f'{SITE_FULL}/submit': return redirect(thing.permalink)
elif request.referrer.startswith(f'{SITE_FULL}/'): return redirect(request.referrer)
return redirect(SITE_FULL)
if author.deflector and v.id != AEVANN_ID and (AWARDS[kind]['price'] > 500 or kind == 'marsify' or kind.istitle()) and kind not in ('pin','unpin','benefactor'):
msg = f"@{v.username} has tried to give your [{thing_type}]({thing.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected and applied to them :marseytroll:"
send_repeatable_notification(author.id, msg)
msg = f"@{author.username} is under the effect of a deflector award; your {AWARDS[kind]['title']} Award has been deflected back to you :marseytroll:"
send_repeatable_notification(v.id, msg)
author = v
else:
msg = f"@{v.username} has given your [{thing_type}]({thing.shortlink}) the {AWARDS[kind]['title']} Award!"
if note: msg += f"\n\n> {note}"
send_repeatable_notification(author.id, msg)
link = f"[this {thing_type}]({thing.shortlink})"
if kind == "ban":
if not author.is_suspended:
author.ban(reason=f"1-Day ban award used by @{v.username} on /{thing_type}/{thing.id}", days=1)
send_repeatable_notification(author.id, f"Your account has been banned for **a day** for {link}. It sucked and you should feel bad.")
elif author.unban_utc:
author.unban_utc += 86400
send_repeatable_notification(author.id, f"Your account has been banned for **yet another day** for {link}. Seriously man?")
if v.admin_level > 2:
log_link = f'/{thing_type}/{thing.id}'
reason = f'<a href="{log_link}">{log_link}</a>'
note = f'reason: "{reason}", duration: for 1 day'
ma=ModAction(
kind="ban_user",
user_id=v.id,
target_user_id=author.id,
_note=note
)
g.db.add(ma)
elif kind == "unban":
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:
author.unban_utc -= 86400
send_repeatable_notification(author.id, "Your ban duration has been reduced by 1 day!")
else:
author.unban_utc = 0
author.is_banned = 0
author.ban_evade = 0
author.ban_reason = None
send_repeatable_notification(author.id, "You have been unbanned!")
if v.admin_level > 2:
ma=ModAction(
kind="unban_user",
user_id=v.id,
target_user_id=author.id,
)
g.db.add(ma)
elif kind == "grass":
author.is_banned = AUTOJANNY_ID
author.ban_reason = f"grass award used by @{v.username} on /{thing_type}/{thing.id}"
author.unban_utc = int(time.time()) + 30 * 86400
send_repeatable_notification(author.id, f"Your account has been banned permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass/snow/sand/ass to get unbanned!")
if v.admin_level > 2:
log_link = f'/{thing_type}/{thing.id}'
reason = f'<a href="{log_link}">{log_link}</a>'
note = f'reason: "{reason}", duration: for 30 days'
ma=ModAction(
kind="ban_user",
user_id=v.id,
target_user_id=author.id,
_note=note
)
g.db.add(ma)
elif kind == "pin":
if not FEATURES['PINS']:
abort(403)
if thing.stickied and thing.stickied_utc:
thing.stickied_utc += 3600
else:
thing.stickied = f'{v.username} (pin award)'
thing.stickied_utc = int(time.time()) + 3600
g.db.add(thing)
cache.delete_memoized(frontlist)
elif kind == "unpin":
if not thing.stickied_utc: abort(403)
t = thing.stickied_utc - 3600
if time.time() > t:
thing.stickied = None
thing.stickied_utc = None
cache.delete_memoized(frontlist)
else: thing.stickied_utc = t
g.db.add(thing)
elif kind == "agendaposter" and not (author.agendaposter and author.agendaposter == 0):
if author.marseyawarded:
return {"error": "This user is the under the effect of a conflicting award: Marsey award."}, 404
if author.agendaposter and time.time() < author.agendaposter: author.agendaposter += 86400
else: author.agendaposter = int(time.time()) + 86400
badge_grant(user=author, badge_id=28)
elif kind == "flairlock":
if thing.ghost: abort(403)
new_name = note[:100].replace("𒐪","")
if not new_name and author.flairchanged:
author.flairchanged += 86400
else:
author.customtitleplain = new_name
new_name = censor_slurs(new_name, None)
author.customtitle = filter_emojis_only(new_name)
if len(author.customtitle) > 1000: abort(403)
author.flairchanged = int(time.time()) + 86400
badge_grant(user=author, badge_id=96)
elif kind == "pause":
author.mute = True
badge_grant(badge_id=68, user=author)
elif kind == "unpausable":
author.unmutable = True
badge_grant(badge_id=67, user=author)
elif kind == "marsey":
if author.marseyawarded: author.marseyawarded += 86400
else: author.marseyawarded = int(time.time()) + 86400
badge_grant(user=author, badge_id=98)
elif kind == "pizzashill":
if author.bird:
return {"error": "This user is the under the effect of a conflicting award: Bird Site award."}, 404
if author.longpost: author.longpost += 86400
else: author.longpost = int(time.time()) + 86400
badge_grant(user=author, badge_id=97)
elif kind == "bird":
if author.longpost:
return {"error": "This user is the under the effect of a conflicting award: Pizzashill award."}, 404
if author.bird: author.bird += 86400
else: author.bird = int(time.time()) + 86400
badge_grant(user=author, badge_id=95)
elif kind == "eye":
author.eye = True
badge_grant(badge_id=83, user=author)
elif kind == "offsitementions":
author.offsitementions = True
badge_grant(user=author, badge_id=140)
elif kind == "alt":
author.alt = True
badge_grant(badge_id=84, user=author)
elif kind == "unblockable":
author.unblockable = True
badge_grant(badge_id=87, user=author)
for block in g.db.query(UserBlock).filter_by(target_id=author.id).all(): g.db.delete(block)
elif kind == "fish":
author.fish = True
badge_grant(badge_id=90, user=author)
elif kind == "progressivestack":
if not FEATURES['PINS']:
abort(403)
if author.progressivestack: author.progressivestack += 21600
else: author.progressivestack = int(time.time()) + 21600
badge_grant(user=author, badge_id=94)
elif kind == "benefactor":
if author.patron: return {"error": "This user is already a paypig!"}, 400
author.patron = 1
if author.patron_utc: author.patron_utc += 2629746
else: author.patron_utc = int(time.time()) + 2629746
author.procoins += 2500
if author.discord_id: add_role(author, "1")
badge_grant(user=v, badge_id=103)
elif kind == "rehab":
if author.rehab: author.rehab += 86400
else: author.rehab = int(time.time()) + 86400
badge_grant(user=author, badge_id=109)
elif kind == "deflector":
if author.deflector: author.deflector += 36000
else: author.deflector = int(time.time()) + 36000
elif kind == "beano":
badge_grant(user=author, badge_id=128)
elif kind == "checkmark":
author.verified = "Verified"
badge_grant(user=author, badge_id=150)
elif kind == 'marsify':
if author.marsify: author.marsify += 21600
else: author.marsify = int(time.time()) + 21600
badge_grant(user=author, badge_id=170)
if thing_type == 'comment' and (not author.deflector or v.id == AEVANN_ID):
body = thing.body
if author.owoify: body = owoify(body)
body = marsify(body)
thing.body_html = sanitize(body, limit_pings=5)
g.db.add(thing)
elif "Vampire" in kind and kind == v.house:
if author.bite: author.bite += 86400
else: author.bite = int(time.time()) + 86400
if not author.old_house:
author.old_house = author.house
if 'Vampire' not in author.house:
author.house = 'Vampire'
badge_grant(user=author, badge_id=168)
elif "Racist" in kind and kind == v.house:
if author.earlylife: author.earlylife += 86400
else: author.earlylife = int(time.time()) + 86400
badge_grant(user=author, badge_id=169)
elif ("Furry" in kind and kind == v.house) or kind == 'owoify':
if author.owoify: author.owoify += 21600
else: author.owoify = int(time.time()) + 21600
badge_grant(user=author, badge_id=167)
if thing_type == 'comment' and not (author.deflector or v.id == AEVANN_ID):
body = thing.body
body = owoify(body)
if author.marsify: body = marsify(body)
thing.body_html = sanitize(body, limit_pings=5)
g.db.add(thing)
elif ("Femboy" in kind and kind == v.house):
if author.rainbow: author.rainbow += 86400
else: author.rainbow = int(time.time()) + 86400
badge_grant(user=author, badge_id=171)
if author.received_award_count: author.received_award_count += 1
else: author.received_award_count = 1
g.db.add(author)
if request.referrer and len(request.referrer) > 1:
if request.referrer == f'{SITE_FULL}/submit': return redirect(thing.permalink)
elif request.referrer.startswith(f'{SITE_FULL}/'): return redirect(request.referrer)
return redirect(SITE_FULL)
@app.get("/admin/awards")
@admin_level_required(2)
def admin_userawards_get(v):
if not FEATURES['AWARDS']:
abort(404)
if SITE == 'pcmemes.net' and v.admin_level < 3: abort(403)
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(AWARDS.values()), v=v)
@app.post("/admin/awards")
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@admin_level_required(2)
def admin_userawards_post(v):
if not FEATURES['AWARDS']:
abort(404)
if SITE == 'pcmemes.net' and v.admin_level < 3: abort(403)
if SITE == 'watchpeopledie.co' and v.id not in (AEVANN_ID, CARP_ID, SNAKES_ID): abort(403)
try: u = request.values.get("username").strip()
except: abort(404)
whitelist = ("shit", "fireflies", "train", "scooter", "wholesome", "tilt", "glowie")
u = get_user(u, graceful=False, v=v)
notify_awards = {}
for key, value in request.values.items():
if key not in AWARDS: continue
if v.admin_level < 3 and key not in whitelist: continue
if value:
if int(value) > 100 or (int(value) > 10 and v.id != AEVANN_ID): abort(403)
if int(value): notify_awards[key] = int(value)
for x in range(int(value)):
award = AwardRelationship(
user_id=u.id,
kind=key,
granted=True
)
g.db.add(award)
if v.id != u.id:
text = f"@{v.username} has given you the following awards:\n\n"
for key, value in notify_awards.items():
text += f" - **{value}** {AWARDS[key]['title']} {'Awards' if value != 1 else 'Award'}\n"
send_repeatable_notification(u.id, text)
note = ""
for key, value in notify_awards.items():
note += f"{value} {AWARDS[key]['title']}, "
if len(note) > 500: return {"error": "You're giving too many awards at the same time!"}, 400
ma=ModAction(
kind="grant_awards",
user_id=v.id,
target_user_id=u.id,
_note=note[:-2]
)
g.db.add(ma)
if v.admin_level != 3: return render_template("admin/awards.html", awards=list(AWARDS3.values()), v=v, msg=f"Awards granted to @{u.username} successfully!")
return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v, msg=f"Awards granted to @{u.username} successfully!")
from files.__main__ import app, limiter
from files.helpers.wrappers import *
from files.helpers.alerts import *
from files.helpers.get import *
from files.helpers.const import *
from files.helpers.regex import *
from files.helpers.discord import *
from files.helpers.actions import *
from files.classes.award import *
from .front import frontlist
from flask import g, request
from files.helpers.sanitize import filter_emojis_only
from files.helpers.marsify import marsify
from files.helpers.owoify import owoify
from copy import deepcopy
@app.get("/shop")
@app.get("/settings/shop")
@auth_required
def shop(v):
if not FEATURES['AWARDS']:
abort(404)
AWARDS = deepcopy(AWARDS2)
if v.house:
AWARDS[v.house] = deepcopy(HOUSE_AWARDS[v.house])
for val in AWARDS.values(): val["owned"] = 0
for useraward in g.db.query(AwardRelationship).filter(AwardRelationship.user_id == v.id, AwardRelationship.submission_id == None, AwardRelationship.comment_id == None).all():
if useraward.kind in AWARDS: AWARDS[useraward.kind]["owned"] += 1
for val in AWARDS.values():
val["baseprice"] = int(val["price"])
if val["kind"].endswith('Founder'):
val["baseprice"] = int(val["baseprice"] / 0.75)
val["price"] = int(val["price"] * v.discount)
sales = g.db.query(func.sum(User.coins_spent)).scalar()
return render_template("shop.html", awards=list(AWARDS.values()), v=v, sales=sales)
@app.post("/buy/<award>")
@limiter.limit("100/minute;200/hour;1000/day")
@auth_required
def buy(v, award):
if not FEATURES['AWARDS']:
abort(404)
if award == 'benefactor' and not request.values.get("mb"):
return {"error": "You can only buy the Benefactor award with marseybux."}, 403
if award == 'ghost' and v.admin_level < 2:
return {"error": "Only admins can buy this award."}, 403
AWARDS = deepcopy(AWARDS2)
if v.house:
AWARDS[v.house] = HOUSE_AWARDS[v.house]
if award not in AWARDS: abort(400)
og_price = AWARDS[award]["price"]
price = int(og_price * v.discount)
if request.values.get("mb"):
if award == "grass":
return {"error": "You can't buy the grass award with marseybux."}, 403
charged = v.charge_account('procoins', price)
if not charged:
return {"error": "Not enough marseybux."}, 400
else:
charged = v.charge_account('coins', price)
if not charged:
return {"error": "Not enough coins."}, 400
v.coins_spent += price
if v.coins_spent >= 1000000:
badge_grant(badge_id=73, user=v)
elif v.coins_spent >= 500000:
badge_grant(badge_id=72, user=v)
elif v.coins_spent >= 250000:
badge_grant(badge_id=71, user=v)
elif v.coins_spent >= 100000:
badge_grant(badge_id=70, user=v)
elif v.coins_spent >= 10000:
badge_grant(badge_id=69, user=v)
g.db.add(v)
if award == "lootbox":
lootbox_items = []
for i in [1,2,3,4,5]:
award = random.choice(["firework", "confetti", "ricardo", "wholesome", "shit", "fireflies", "scooter", "train"])
lootbox_items.append(AWARDS[award]['title'])
award = AwardRelationship(user_id=v.id, kind=award)
g.db.add(award)
g.db.flush()
v.lootboxes_bought += 1
lootbox_msg = "You open your lootbox and receive: " + ', '.join(lootbox_items)
send_repeatable_notification(v.id, lootbox_msg)
if v.lootboxes_bought == 10:
badge_grant(badge_id=76, user=v)
elif v.lootboxes_bought == 50:
badge_grant(badge_id=77, user=v)
elif v.lootboxes_bought == 150:
badge_grant(badge_id=78, user=v)
else:
award_object = AwardRelationship(user_id=v.id, kind=award)
g.db.add(award_object)
g.db.add(v)
if CARP_ID and v.id != CARP_ID and og_price >= 10000:
send_repeatable_notification(CARP_ID, f"@{v.username} has bought a `{award}` award!")
return {"message": f"{award} award bought!"}
@app.post("/award/<thing_type>/<id>")
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
@is_not_permabanned
def award_thing(v, thing_type, id):
if not FEATURES['AWARDS']:
abort(404)
if thing_type == 'post': thing = get_post(id)
else: thing = get_comment(id)
if not thing: return {"error": f"This {thing_type} doesn't exist."}, 404
if v.shadowbanned: return render_template('errors/500.html', err=True, v=v), 500
kind = request.values.get("kind", "").strip()
AWARDS = deepcopy(AWARDS2)
if v.house:
AWARDS[v.house] = HOUSE_AWARDS[v.house]
if kind not in AWARDS:
return {"error": "This award doesn't exist."}, 404
award = g.db.query(AwardRelationship).filter(
AwardRelationship.kind == kind,
AwardRelationship.user_id == v.id,
AwardRelationship.submission_id == None,
AwardRelationship.comment_id == None
).first()
if not award:
return {"error": "You don't have that award."}, 404
if thing_type == 'post': award.submission_id = thing.id
else: award.comment_id = thing.id
award.awarded_utc = int(time.time())
g.db.add(award)
note = request.values.get("note", "").strip()
author = thing.author
if author.id in (PIZZASHILL_ID, DAD_ID) and v.id not in (PIZZASHILL_ID, DAD_ID):
return {"error": "This user is immune to awards."}, 403
if kind == "benefactor" and author.id == v.id:
return {"error": "You can't use this award on yourself."}, 400
if kind == 'marsify' and author.marsify == 1:
return {"error": "User is already permenantly marsified!"}, 403
if v.id != author.id:
if author.deflector and v.deflector:
msg = f"@{v.username} has tried to give your [{thing_type}]({thing.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected on them, they also had a deflector up, so it bounced back and forth until it vaporized!"
send_repeatable_notification(author.id, msg)
msg = f"@{author.username} is under the effect of a deflector award; your {AWARDS[kind]['title']} Award has been deflected back to you but your deflector protected you, the award bounced back and forth until it vaporized!"
send_repeatable_notification(v.id, msg)
g.db.delete(award)
if request.referrer and len(request.referrer) > 1:
if request.referrer == f'{SITE_FULL}/submit': return redirect(thing.permalink)
elif request.referrer.startswith(f'{SITE_FULL}/'): return redirect(request.referrer)
return redirect(SITE_FULL)
if author.deflector and v.id != AEVANN_ID and (AWARDS[kind]['price'] > 500 or kind == 'marsify' or kind.istitle()) and kind not in ('pin','unpin','benefactor'):
msg = f"@{v.username} has tried to give your [{thing_type}]({thing.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected and applied to them :marseytroll:"
send_repeatable_notification(author.id, msg)
msg = f"@{author.username} is under the effect of a deflector award; your {AWARDS[kind]['title']} Award has been deflected back to you :marseytroll:"
send_repeatable_notification(v.id, msg)
author = v
else:
msg = f"@{v.username} has given your [{thing_type}]({thing.shortlink}) the {AWARDS[kind]['title']} Award!"
if note: msg += f"\n\n> {note}"
send_repeatable_notification(author.id, msg)
link = f"[this {thing_type}]({thing.shortlink})"
if kind == "ban":
if not author.is_suspended:
author.ban(reason=f"1-Day ban award used by @{v.username} on /{thing_type}/{thing.id}", days=1)
send_repeatable_notification(author.id, f"Your account has been banned for **a day** for {link}. It sucked and you should feel bad.")
elif author.unban_utc:
author.unban_utc += 86400
send_repeatable_notification(author.id, f"Your account has been banned for **yet another day** for {link}. Seriously man?")
if v.admin_level > 2:
log_link = f'/{thing_type}/{thing.id}'
reason = f'<a href="{log_link}">{log_link}</a>'
note = f'reason: "{reason}", duration: for 1 day'
ma=ModAction(
kind="ban_user",
user_id=v.id,
target_user_id=author.id,
_note=note
)
g.db.add(ma)
elif kind == "unban":
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:
author.unban_utc -= 86400
send_repeatable_notification(author.id, "Your ban duration has been reduced by 1 day!")
else:
author.unban_utc = 0
author.is_banned = 0
author.ban_evade = 0
author.ban_reason = None
send_repeatable_notification(author.id, "You have been unbanned!")
if v.admin_level > 2:
ma=ModAction(
kind="unban_user",
user_id=v.id,
target_user_id=author.id,
)
g.db.add(ma)
elif kind == "grass":
author.is_banned = AUTOJANNY_ID
author.ban_reason = f"grass award used by @{v.username} on /{thing_type}/{thing.id}"
author.unban_utc = int(time.time()) + 30 * 86400
send_repeatable_notification(author.id, f"Your account has been banned permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass/snow/sand/ass to get unbanned!")
if v.admin_level > 2:
log_link = f'/{thing_type}/{thing.id}'
reason = f'<a href="{log_link}">{log_link}</a>'
note = f'reason: "{reason}", duration: for 30 days'
ma=ModAction(
kind="ban_user",
user_id=v.id,
target_user_id=author.id,
_note=note
)
g.db.add(ma)
elif kind == "pin":
if not FEATURES['PINS']:
abort(403)
if thing.stickied and thing.stickied_utc:
thing.stickied_utc += 3600
else:
thing.stickied = f'{v.username} (pin award)'
thing.stickied_utc = int(time.time()) + 3600
g.db.add(thing)
cache.delete_memoized(frontlist)
elif kind == "unpin":
if not thing.stickied_utc: abort(403)
t = thing.stickied_utc - 3600
if time.time() > t:
thing.stickied = None
thing.stickied_utc = None
cache.delete_memoized(frontlist)
else: thing.stickied_utc = t
g.db.add(thing)
elif kind == "agendaposter" and not (author.agendaposter and author.agendaposter == 0):
if author.marseyawarded:
return {"error": "This user is the under the effect of a conflicting award: Marsey award."}, 404
if author.agendaposter and time.time() < author.agendaposter: author.agendaposter += 86400
else: author.agendaposter = int(time.time()) + 86400
badge_grant(user=author, badge_id=28)
elif kind == "flairlock":
if thing.ghost: abort(403)
new_name = note[:100].replace("𒐪","")
if not new_name and author.flairchanged:
author.flairchanged += 86400
else:
author.customtitleplain = new_name
new_name = censor_slurs(new_name, None)
author.customtitle = filter_emojis_only(new_name)
if len(author.customtitle) > 1000: abort(403)
author.flairchanged = int(time.time()) + 86400
badge_grant(user=author, badge_id=96)
elif kind == "pause":
author.mute = True
badge_grant(badge_id=68, user=author)
elif kind == "unpausable":
author.unmutable = True
badge_grant(badge_id=67, user=author)
elif kind == "marsey":
if author.marseyawarded: author.marseyawarded += 86400
else: author.marseyawarded = int(time.time()) + 86400
badge_grant(user=author, badge_id=98)
elif kind == "pizzashill":
if author.bird:
return {"error": "This user is the under the effect of a conflicting award: Bird Site award."}, 404
if author.longpost: author.longpost += 86400
else: author.longpost = int(time.time()) + 86400
badge_grant(user=author, badge_id=97)
elif kind == "bird":
if author.longpost:
return {"error": "This user is the under the effect of a conflicting award: Pizzashill award."}, 404
if author.bird: author.bird += 86400
else: author.bird = int(time.time()) + 86400
badge_grant(user=author, badge_id=95)
elif kind == "eye":
author.eye = True
badge_grant(badge_id=83, user=author)
elif kind == "offsitementions":
author.offsitementions = True
badge_grant(user=author, badge_id=140)
elif kind == "alt":
author.alt = True
badge_grant(badge_id=84, user=author)
elif kind == "unblockable":
author.unblockable = True
badge_grant(badge_id=87, user=author)
for block in g.db.query(UserBlock).filter_by(target_id=author.id).all(): g.db.delete(block)
elif kind == "fish":
author.fish = True
badge_grant(badge_id=90, user=author)
elif kind == "progressivestack":
if not FEATURES['PINS']:
abort(403)
if author.progressivestack: author.progressivestack += 21600
else: author.progressivestack = int(time.time()) + 21600
badge_grant(user=author, badge_id=94)
elif kind == "benefactor":
if author.patron: return {"error": "This user is already a paypig!"}, 400
author.patron = 1
if author.patron_utc: author.patron_utc += 2629746
else: author.patron_utc = int(time.time()) + 2629746
author.procoins += 2500
if author.discord_id: add_role(author, "1")
badge_grant(user=v, badge_id=103)
elif kind == "rehab":
if author.rehab: author.rehab += 86400
else: author.rehab = int(time.time()) + 86400
badge_grant(user=author, badge_id=109)
elif kind == "deflector":
if author.deflector: author.deflector += 36000
else: author.deflector = int(time.time()) + 36000
elif kind == "beano":
badge_grant(user=author, badge_id=128)
elif kind == "checkmark":
author.verified = "Verified"
badge_grant(user=author, badge_id=150)
elif kind == 'marsify':
if author.marsify: author.marsify += 21600
else: author.marsify = int(time.time()) + 21600
badge_grant(user=author, badge_id=170)
if thing_type == 'comment' and (not author.deflector or v.id == AEVANN_ID):
body = thing.body
if author.owoify: body = owoify(body)
body = marsify(body)
thing.body_html = sanitize(body, limit_pings=5)
g.db.add(thing)
elif "Vampire" in kind and kind == v.house:
if author.bite: author.bite += 86400
else: author.bite = int(time.time()) + 86400
if not author.old_house:
author.old_house = author.house
if 'Vampire' not in author.house:
author.house = 'Vampire'
badge_grant(user=author, badge_id=168)
elif "Racist" in kind and kind == v.house:
if author.earlylife: author.earlylife += 86400
else: author.earlylife = int(time.time()) + 86400
badge_grant(user=author, badge_id=169)
elif ("Furry" in kind and kind == v.house) or kind == 'owoify':
if author.owoify: author.owoify += 21600
else: author.owoify = int(time.time()) + 21600
badge_grant(user=author, badge_id=167)
if thing_type == 'comment' and not (author.deflector or v.id == AEVANN_ID):
body = thing.body
body = owoify(body)
if author.marsify: body = marsify(body)
thing.body_html = sanitize(body, limit_pings=5)
g.db.add(thing)
elif ("Femboy" in kind and kind == v.house):
if author.rainbow: author.rainbow += 86400
else: author.rainbow = int(time.time()) + 86400
badge_grant(user=author, badge_id=171)
if author.received_award_count: author.received_award_count += 1
else: author.received_award_count = 1
g.db.add(author)
if request.referrer and len(request.referrer) > 1:
if request.referrer == f'{SITE_FULL}/submit': return redirect(thing.permalink)
elif request.referrer.startswith(f'{SITE_FULL}/'): return redirect(request.referrer)
return redirect(SITE_FULL)
@app.get("/admin/awards")
@admin_level_required(2)
def admin_userawards_get(v):
if not FEATURES['AWARDS']:
abort(404)
if SITE == 'pcmemes.net' and v.admin_level < 3: abort(403)
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(AWARDS.values()), v=v)
@app.post("/admin/awards")
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@admin_level_required(2)
def admin_userawards_post(v):
if not FEATURES['AWARDS']:
abort(404)
if SITE == 'pcmemes.net' and v.admin_level < 3: abort(403)
if SITE == 'watchpeopledie.co' and v.id not in (AEVANN_ID, CARP_ID, SNAKES_ID): abort(403)
try: u = request.values.get("username").strip()
except: abort(404)
whitelist = ("shit", "fireflies", "train", "scooter", "wholesome", "tilt", "glowie")
u = get_user(u, graceful=False, v=v)
notify_awards = {}
for key, value in request.values.items():
if key not in AWARDS: continue
if v.admin_level < 3 and key not in whitelist: continue
if value:
if int(value) > 10: abort(403)
if int(value): notify_awards[key] = int(value)
for x in range(int(value)):
award = AwardRelationship(
user_id=u.id,
kind=key,
granted=True
)
g.db.add(award)
if v.id != u.id:
text = f"@{v.username} has given you the following awards:\n\n"
for key, value in notify_awards.items():
text += f" - **{value}** {AWARDS[key]['title']} {'Awards' if value != 1 else 'Award'}\n"
send_repeatable_notification(u.id, text)
note = ""
for key, value in notify_awards.items():
note += f"{value} {AWARDS[key]['title']}, "
if len(note) > 500: return {"error": "You're giving too many awards at the same time!"}, 400
ma=ModAction(
kind="grant_awards",
user_id=v.id,
target_user_id=u.id,
_note=note[:-2]
)
g.db.add(ma)
if v.admin_level != 3: return render_template("admin/awards.html", awards=list(AWARDS3.values()), v=v, msg=f"Awards granted to @{u.username} successfully!")
return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v, msg=f"Awards granted to @{u.username} successfully!")

View File

@ -709,14 +709,6 @@ def submit_post(v, sub=None):
if not sub and HOLE_REQUIRED:
return error(f"You must choose a {HOLE_NAME} for your post!")
category = None
if FEATURES['CATEGORIES']:
category_id = request.values.get('category', '')
try:
category = int(category_id)
except:
category = None
if v.is_suspended: return error("You can't perform this action while banned.")
torture = (v.agendaposter and not v.marseyawarded and sub != 'chudrama')
@ -933,7 +925,6 @@ def submit_post(v, sub=None):
title=title[:500],
title_html=title_html,
sub=sub,
category_id=category,
ghost=ghost
)
@ -1168,42 +1159,6 @@ def toggle_post_nsfw(pid, v):
if post.over_18: return {"message": "Post has been marked as +18!"}
else: return {"message": "Post has been unmarked as +18!"}
@app.post("/post_recategorize")
@auth_required
def post_recategorize(v):
if not FEATURES['CATEGORIES']:
abort(404)
if v.admin_level < PERMS['ADMIN_CATEGORIES_CHANGE']:
abort(403)
post_id = request.values.get("post_id")
category_id = request.values.get("category_id")
try:
pid = int(post_id)
cid = None
if category_id != '':
cid = int(category_id)
except:
abort(400)
post = g.db.get(Submission, pid)
post.category_id = cid
g.db.add(post)
category_new_name = '&lt;none&gt;'
if category_id != '':
category_new_name = g.db.get(Category, cid).name
ma = ModAction(
kind='post_recategorize',
user_id=v.id,
target_submission_id=post.id,
_note=category_new_name
)
g.db.add(ma)
g.db.commit()
return {"message": "Success!"}
@app.post("/save_post/<pid>")
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}')

View File

@ -104,6 +104,9 @@ def settings_profile_post(v):
updated = True
v.marsify = int(request.values.get("marsify") == 'true')
if v.marsify: badge_grant(user=v, badge_id=170)
else:
badge = v.has_badge(170)
if badge: g.db.delete(badge)
elif request.values.get("bio") == "":
v.bio = None
@ -129,7 +132,7 @@ def settings_profile_post(v):
g.db.add(v)
return render_template("settings_profile.html", v=v, msg="Your enemies list has been updated.")
elif (v.patron or v.id == MOOSE_ID) and request.values.get("sig"):
elif v.patron and request.values.get("sig"):
sig = request.values.get("sig")[:200].replace('\n','').replace('\r','')
sig_html = sanitize(sig)

View File

@ -193,37 +193,6 @@ def static_megathread_index(v):
def api(v):
return render_template("api.html", v=v)
@app.get("/order")
@auth_desired
def order(v):
if not FEATURES['ORDER']: abort(404)
if v: return redirect("/")
return render_template("order.html", v=v)
@app.post("/order")
@limiter.limit("1/hour;2/day")
def submit_order():
if not FEATURES['ORDER']: abort(404)
body = request.values.get("message")
if not body: abort(400)
body = 'This message has been sent automatically to all admins via [/order](/order)\n\nMessage:\n\n' + body
body = body.strip()
body_html = sanitize(body)
new_comment = Comment(author_id=AUTOJANNY_ID, parent_submission=None, level=1, body_html=body_html, sentto=2)
g.db.add(new_comment)
g.db.flush()
new_comment.top_comment_id = new_comment.id
for admin in g.db.query(User).filter(User.admin_level > 2, User.id != AEVANN_ID).all():
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
g.db.add(notif)
return {"success": True}
@app.get("/contact")
@app.get("/contactus")
@app.get("/contact_us")
@ -262,7 +231,7 @@ def submit_contact(v):
g.db.flush()
new_comment.top_comment_id = new_comment.id
for admin in g.db.query(User).filter(User.admin_level > 2, User.id != AEVANN_ID).all():
for admin in g.db.query(User).filter(User.admin_level > 2).all():
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
g.db.add(notif)
@ -466,16 +435,4 @@ def knowledgebase(v, page):
if not os.path.exists('files/templates/' + template_path):
abort(404)
return render_template(template_path, v=v)
@app.get("/categories.json")
def categories_json():
categories = g.db.query(Category).all()
data = {}
for c in categories:
sub = c.sub if c.sub else ''
sub_cats = (data[sub] if sub in data else []) + [c.as_json()]
data.update({sub: sub_cats})
return jsonify(data)
return render_template(template_path, v=v)

View File

@ -826,7 +826,7 @@ def messagereply(v):
if c.top_comment.sentto == 2:
admins = [x[0] for x in g.db.query(User.id).filter(User.admin_level > 2, User.id != v.id, User.id != AEVANN_ID).all()]
admins = [x[0] for x in g.db.query(User.id).filter(User.admin_level > 2, User.id != v.id).all()]
if parent.author.id not in admins:
admins.append(parent.author.id)

View File

@ -94,9 +94,6 @@
<ul>
<li><a href="/create_hole">Create {{ HOLE_NAME | capitalize }}</a></li>
<li><a href="/admin/apps">Apps</a></li>
{% if FEATURES['CATEGORIES'] -%}
<li><a href="/admin/categories">Categories</a></li>
{%- endif %}
</ul>
{% if v.admin_level > 2 %}

View File

@ -53,7 +53,7 @@
<tr>
<td><i class="{{a['icon']}} {{a['color']}}" style="font-size: 30px"></i></td>
<td>{{a['title']}}</td>
<td><input autocomplete="off" type="number" class="form-control" name="{{a['kind']}}" min="0" {% if v.id != AEVANN_ID %}max="10"{% endif %} placeholder="Enter number..."></td>
<td><input autocomplete="off" type="number" class="form-control" name="{{a['kind']}}" min="0" max="10" placeholder="Enter number..."></td>
</tr>
{% endfor %}
</table>

View File

@ -1,51 +0,0 @@
{% extends "default.html" %}
{% block title %}
<title>Admin — Categories</title>
{% endblock %}
{% block content %}
<div class="overflow-x-auto"><table class="table table-striped mt-3 mb-5">
<thead class="bg-primary text-white">
<tr>
<th>Category</th>
<th>{{ HOLE_NAME | capitalize }}</th>
<th>Name</th>
<th>Text Color</th>
<th>Background Color</th>
<th>Actions</th>
<th>&nbsp;</th>
</tr>
</thead>
{% for category in categories %}
<tr>
<td>{{help.submission_category_tag(category.name, category.color_text, category.color_bg)}}</td>
<td>{{category.sub if category.sub else '&mdash;'|safe}}</td>
<form action="/admin/categories/update/{{category.id}}" method="POST">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<td><input name="name" type="text" value="{{category.name}}" maxlength="128" autocomplete="off" class="form-control"></td>
<td><input name="color_text" type="text" value="#{{category.color_text}}" size="7" maxlength="7" autocomplete="off" class="form-control"></td>
<td><input name="color_bg" type="text" value="#{{category.color_bg}}" size="7" maxlength="7" autocomplete="off" class="form-control"></td>
<td><input type="submit" onclick="disable(this)" class="btn btn-primary" value="Update"></td>
</form>
<form action="/admin/categories/delete/{{category.id}}" method="POST">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<td><input type="submit" onclick="disable(this)" class="btn btn-primary" value="Delete"></td>
</form>
</tr>
{% endfor %}
<tr>
<form action="/admin/categories/add" method="POST">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<td><input name="name" type="text" placeholder="Name" maxlength="128" autocomplete="off" class="form-control"></td>
<td><input name="sub" type="text" placeholder="{{HOLE_NAME|capitalize}} (optional)" maxlength="20" autocomplete="off" class="form-control"></td>
<td></td>
<td><input name="color_text" type="text" placeholder="#000000 (Text)" size="7" maxlength="7" autocomplete="off" class="form-control"></td>
<td><input name="color_bg" type="text" placeholder="#000000 (BG)" size="7" maxlength="7" autocomplete="off" class="form-control"></td>
<td colspan="2"><input type="submit" onclick="disable(this)" class="btn btn-primary" value="Create"></td>
</form>
</tr>
</table>
{% endblock %}

View File

@ -1,16 +0,0 @@
<div class="modal fade" id="category-modal" tabindex="-1" role="dialog" aria-labelledby="category-modal-title" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header pt-3">
<h5 id="category-modal-title"></h5>
<button class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true"><i class="far fa-times"></i></span>
</button>
</div>
<div class="modal-body" id="category-modal-body">
</div>
</div>
</div>
</div>
<script defer src="{{asset('js/category_modal.js')}}"></script>

View File

@ -756,9 +756,6 @@
{% include "emoji_modal.html" %}
{% if v.admin_level > 1 %}
{% include "ban_modal.html" %}
{% if FEATURES['CATEGORIES'] -%}
{% include "category_modal.html" %}
{%- endif %}
{% endif %}
<div class="modal fade" id="deleteCommentModal" tabindex="-1" role="dialog" aria-labelledby="deleteCommentModalTitle" aria-hidden="true">

View File

@ -8,16 +8,24 @@
{% block Banner %}
<style>
.shop-tabs {
padding-top: 50px;
}
@media (max-width: 768px) {
#hats-banner {
width: 80%;
}
.shop-tabs {
padding-top: 30px;
}
}
.shop-tab {
display: inline-flex;
max-width: 46.6%;
letter-spacing: 3px;
border-radius: 0;
}
.shop-tab.active {
@ -27,15 +35,15 @@
}
</style>
<div class="container-fluid bg-white sticky" style="padding-top: 30px; padding-bottom: 0 !important;">
<div class="container-fluid bg-white sticky shop-tabs" style="padding-bottom: 0 !important;">
<div class="row box-shadow-bottom">
<div class="col">
<div class="col p-0">
<div class="container" style="padding-bottom: 0;">
<div class="row box-shadow-bottom bg-white" style="justify-content: center;">
<a class="btn btn-primary btn-block py-2 m-0 mr-3 shop-tab" href="/shop">
<a class="btn btn-primary btn-block m-0 shop-tab" href="/shop">
<span class="mr-auto ml-auto"><i class="fas fa-gift mr-2"></i>AWARDS</span>
</a>
<a class="btn btn-primary btn-block py-2 m-0 shop-tab active" href="/hats">
<a class="btn btn-primary btn-block m-0 shop-tab active" href="/hats">
<span class="mr-auto ml-auto"><i class="fas fa-hat-cowboy mr-2"></i>HATS</span>
</a>
</div>

View File

@ -259,11 +259,6 @@
</div>
</li>
{% else %}
{% if FEATURES['ORDER'] %}
<li class="nav-item d-flex align-items-center justify-content-center mx-1 mr-2">
<a class="btn btn-primary" href="/order">Request a quote</a>
</li>
{% endif %}
<li class="nav-item d-flex align-items-center justify-content-center mx-1 mr-2">
<a class="btn btn-primary" href="/contact">Contact us</a>
</li>
@ -332,11 +327,6 @@
<a class="nav-link" role="button", onclick="post_toast(this,'/logout', true)"><i class="fas fa-sign-out fa-fw mr-3 text-danger"></i>Log out</a>
</li>
{% else %}
{% if FEATURES['ORDER'] %}
<li class="nav-item d-flex align-items-center justify-content-center pb-3">
<a class="btn btn-primary btn-block" href="/order">Request a quote</a>
</li>
{% endif %}
<li class="nav-item d-flex align-items-center justify-content-center pb-3">
<a class="btn btn-primary btn-block" href="/contact">Contact us</a>
</li>

View File

@ -1,218 +0,0 @@
{% extends "default.html" %}
{% block content %}
<style>
.order-form {
margin: 0 auto;
margin-top: 2rem;
max-width: 500px;
}
.order-form h2 {
display: flex;
align-items: center;
justify-content: center;
}
.order-form h2 hr {
flex: 1;
}
.order-form h2 span {
flex: 3;
text-align: center;
}
.order-form--heading,
.form-check {
text-transform: uppercase;
letter-spacing: 2px;
}
#orderSuccess {
display: flex;
align-items: center;
justify-content: center;
display: none;
padding-top: 5rem;
text-align: center;
}
.order-toast {
position: fixed;
bottom: 1.5rem;
margin: 0 auto;
left: 0;
right: 0;
width: unset;
z-index: 1000;
height: auto !important;
}
</style>
<form class="order-form" id="orderForm" action="#" onsubmit="submitForm(event)">
<h2 class="order-form--heading">
<hr /><span>Request a quote</span>
<hr />
</h2>
<!-- Platforms -->
<div class="mb-3">
<label class="order-form--heading">Platforms to target</label>
<div class="form-check">
<input name="platform" class="form-check-input" type="checkbox" id="defaultCheck1" value="twitter">
<label class="form-check-label" for="defaultCheck1">
Twitter
</label>
</div>
<div class="form-check">
<input name="platform" class="form-check-input" type="checkbox" id="defaultCheck2" value="instagram">
<label class="form-check-label" for="defaultCheck2">
Instagram
</label>
</div>
<div class="form-check">
<input name="platform" class="form-check-input" type="checkbox" id="defaultCheck3" value="tiktok">
<label class="form-check-label" for="defaultCheck3">
TikTok
</label>
</div>
<div class="form-check">
<input name="platform" class="form-check-input" type="checkbox" id="defaultCheck3" value="facebook">
<label class="form-check-label" for="defaultCheck4">
Facebook
</label>
</div>
<div class="form-check">
<input name="platform" class="form-check-input" type="checkbox" id="defaultCheck5" value="reddit">
<label class="form-check-label" for="defaultCheck5">
Reddit
</label>
</div>
</div>
<!-- Narrative -->
<div class="mb-3">
<label for="exampleInputPassword1" class="order-form--heading">Narrative to push</label>
<textarea form="orderForm" class="textarea form-control" id="narrativeToPush" name="narrative"
rows="5"></textarea>
</div>
<!-- Additional Information -->
<div class="mb-3">
<label for="exampleInputPassword1" class="order-form--heading">Additional information</label>
<textarea form="orderForm" class="textarea form-control" id="additionalInformation" name="info"
rows="5"></textarea>
</div>
<!-- Customer Email -->
<div class="mb-3">
<label for="exampleInputEmail1" class="order-form--heading">Your Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" name="email" aria-describedby="emailHelp">
<div id="emailHelp" class="form-text"><small>We respect your privacy. <a href="https://wikipedia.org/">Learn
more.</a></small></div>
</div>
<!-- Actions -->
<button type="submit" class="btn btn-primary">Request Quote</button>
</form>
<div id="orderSuccess">
<div class="order-form--heading">
<h1>Order Received</h1>
<p>We will get back to you as quickly as possible with a quote.</p>
</div>
</div>
<div class="toast order-toast" id="order-post-success" role="alert" aria-live="assertive" aria-atomic="true" data-bs-animation="true" data-bs-autohide="true"
data-bs-delay="5000">
<div class="toast-body bg-success text-center text-white">
<i class="fas fa-comment-alt-smile mr-2"></i> We have received your order.
</div>
</div>
<div class="toast order-toast" id="order-post-error" role="alert" aria-live="assertive" aria-atomic="true"
data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
<div class="toast-body bg-danger text-center text-white">
<i class="fas fa-exclamation-circle mr-2"></i>
rDrama is very busy right now -- please try your request again later.
</span>
</div>
</div>
<script>
function submitForm(e) {
e.preventDefault();
const formElement = document.getElementById('orderForm');
const formData = new FormData(formElement);
const structure = {
platforms: [],
narrative: "",
info: "",
email: ""
};
for (const [key, value] of formData.entries()) {
if (key === "platform") {
structure.platforms.push(value);
} else {
structure[key] = value;
}
}
const capitalize = word => `${word[0].toUpperCase()}${word.slice(1)}`
let platformText = capitalize(structure.platforms[0]);
if (structure.platforms.length === 2) {
platformText += ` and ${capitalize(structure.platforms[1])}`;
} else if (structure.platforms.length === 3) {
platformText += `, ${capitalize(structure.platforms[1])} and ${capitalize(structure.platforms[2])}`;
} else {
platformText += "all of your platforms"
}
const messageToSend = `
I am looking to push the following narrative on ${platformText}:
${structure.narrative}
${structure.info.length > 0 ? `Additionally, ${structure.info}` : ""}
You can contact me at ${structure.email}.
`;
const xhr = new XMLHttpRequest();
xhr.open("post", `/order`);
xhr.onload = function () {
try {
const response = JSON.parse(xhr.response);
const succeeded = xhr.status >= 200 &&
xhr.status < 300 &&
response &&
!response.error;
if (succeeded) {
const successElement = document.getElementById("orderSuccess");
const toast = document.getElementById("order-post-success");
bootstrap.Toast.getOrCreateInstance(toast).show();
formElement.style.display = "none";
successElement.style.display = "flex";
} else {
const toast = document.getElementById("order-post-error");
bootstrap.Toast.getOrCreateInstance(toast).show();
}
} catch (error) {
const toast = document.getElementById("order-post-error");
bootstrap.Toast.getOrCreateInstance(toast).show();
}
};
const form = new FormData();
form.append("formkey", formkey());
form.append("message", messageToSend);
xhr.send(form);
}
</script>
{% endblock %}

View File

@ -60,10 +60,6 @@
<a id="unclub-{{p.id}}" class="dropdown-item {% if not p.club %}d-none{% endif %} list-inline-item text-info" role="button" onclick="post_toast(this,'/toggle_club/{{p.id}}','club-{{p.id}}','unclub-{{p.id}}','d-none')"><i class="fas fa-eye"></i>Unmark club</a>
{% endif %}
{% if FEATURES['CATEGORIES'] and (v.admin_level >= PERMS['ADMIN_CATEGORIES_CHANGE']) %}
<a id="categorize-{{p.id}}" class="dropdown-item list-inline-item text-info" role="button" data-bs-toggle="modal" data-bs-target="#category-modal" onclick="category_modal('{{p.id}}', '{{p.title}}', '{{p.sub if p.sub else ''}}')"><i class="fas fa-grid text-info fa-fw"></i>Recategorize</a>
{% endif %}
{% if v.admin_level > 1 %}
{% if "/reported/" in request.path %}
{% if v.id != p.author.id %}<a class="dropdown-item list-inline-item text-danger" role="button" onclick="post_toast(this,'/remove_post/{{p.id}}')"><i class="fas fa-ban"></i>Remove</a>{% endif %}

View File

@ -18,10 +18,6 @@
<button id="unclub2-{{p.id}}" class="{% if not p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-info text-left" role="button" onclick="post_toast(this,'/toggle_club/{{p.id}}','club2-{{p.id}}','unclub2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye mr-2"></i>Unmark club</button>
{%- endif %}
{% if FEATURES['CATEGORIES'] and (v.admin_level >= PERMS['ADMIN_CATEGORIES_CHANGE']) %}
<button id="categorize2-{{p.id}}" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#category-modal" onclick="category_modal('{{p.id}}', '{{p.title}}', '{{p.sub if p.sub else ''}}')" class="nobackground btn btn-link btn-block btn-lg text-info text-left" role="button"><i class="fas fa-grid mr-2"></i>Recategorize</button>
{% endif %}
<button id="distinguish2-{{p.id}}" class="{% if p.distinguish_level %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" role="button" onclick="post_toast(this,'/distinguish/{{p.id}}','distinguish2-{{p.id}}','undistinguish2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-crown text-center text-primary mr-2"></i>Distinguish</button>
<button id="undistinguish2-{{p.id}}" class="{% if not p.distinguish_level %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" role="button" onclick="post_toast(this,'/distinguish/{{p.id}}','distinguish2-{{p.id}}','undistinguish2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-crown text-center text-primary mr-2"></i>Undistinguish</button>

View File

@ -14,16 +14,24 @@
{% block Banner %}
<style>
.shop-tabs {
padding-top: 50px;
}
@media (max-width: 768px) {
#shop-banner {
width: 80%;
}
.shop-tabs {
padding-top: 30px;
}
}
.shop-tab {
display: inline-flex;
max-width: 46.6%;
letter-spacing: 3px;
border-radius: 0;
}
.shop-tab.active {
@ -33,12 +41,12 @@
}
</style>
<div class="container-fluid bg-white sticky" style="padding-top: 30px; padding-bottom: 0 !important;">
<div class="container-fluid bg-white sticky shop-tabs" style="padding-bottom: 0 !important;">
<div class="row box-shadow-bottom">
<div class="col">
<div class="col p-0">
<div class="container" style="padding-bottom: 0;">
<div class="row box-shadow-bottom bg-white pt-3" style="justify-content: center;">
<a class="btn btn-primary btn-block m-0 mr-3 shop-tab active" href="/shop">
<div class="row box-shadow-bottom bg-white" style="justify-content: center;">
<a class="btn btn-primary btn-block m-0 shop-tab active" href="/shop">
<span class="mr-auto ml-auto"><i class="fas fa-gift mr-2"></i>AWARDS</span>
</a>
<a class="btn btn-primary btn-block m-0 shop-tab" href="/hats">

View File

@ -709,7 +709,6 @@
<h1 id="post-title" class="card-title post-title text-left mb-md-3 {% if p.author.agendaposter and p.sub != 'chudrama' %}agendaposter{% endif %}">
<a {% if p.author.rainbow %}class="rainbow-text"{% endif %} {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}">
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:12px; line-height:2;">{{CC}}</span>{% endif %}
{% if p.category %}{{help.submission_category_tag(p.category.name, p.category.color_text, p.category.color_bg)}}{% endif %}
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
{{p.realtitle(v) | safe}}
</a>
@ -717,7 +716,6 @@
{% else %}
<h1 id="post-title" class="card-title post-title text-left mb-md-3 {% if p.author.agendaposter and p.sub != 'chudrama' %}agendaposter{% endif %} {% if p.author.rainbow %}rainbow-text{% endif %}">
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:12px; line-height:2;">{{CC}}</span>{% endif %}
{% if p.category %}{{help.submission_category_tag(p.category.name, p.category.color_text, p.category.color_bg)}}{% endif %}
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
{{p.realtitle(v) | safe}}
</h1>

View File

@ -196,7 +196,6 @@
<h5 class="card-title post-title text-left w-lg-95 mb-0 pb-0 pb-md-1">
<a id="{{p.id}}-title" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} href="{{p.permalink}}" class="{% if p.sub %}sub{% endif %} stretched-link {% if p.author.agendaposter and p.sub != 'chudrama' %}agendaposter{% endif %}">
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:12px; line-height:2;">{{CC}}</span>{% endif %}
{% if p.category %}{{help.submission_category_tag(p.category.name, p.category.color_text, p.category.color_bg)}}{% endif %}
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
{{p.realtitle(v) | safe}}
</a></h5>
@ -422,9 +421,6 @@
{% include "report_post_modal.html" %}
{% if v.admin_level > 1 %}
{% include "ban_modal.html" %}
{% if FEATURES['CATEGORIES'] -%}
{% include "category_modal.html" %}
{%- endif %}
{% endif %}
{% endif %}
{% include "expanded_image_modal.html" %}

View File

@ -85,7 +85,7 @@
<div class="input-group mb2">
{%- set hole_placeholder = 'Required' if HOLE_REQUIRED else 'Optional' -%}
<input list="subs" autocomplete="off" id='sub' class="form-control" form="submitform" name="sub" oninput="savetext()" onchange="updateCategories()" {% if sub %}value="{{sub}}"{% endif %} placeholder="{{hole_placeholder}}">
<input list="subs" autocomplete="off" id='sub' class="form-control" form="submitform" name="sub" oninput="savetext()" {% if sub %}value="{{sub}}"{% endif %} placeholder="{{hole_placeholder}}">
<datalist id="subs">
{% for s in SUBS %}
<option value="{{s}}"></option>
@ -94,11 +94,6 @@
</div>
{% if FEATURES['CATEGORIES'] -%}
<label class="mt-4" for="submit-categories">Category</label>
<div id="submit-categories"></div>
{%- endif %}
<label class='mt-4' for="title">Post Title</label>

View File

@ -1,6 +1,6 @@
{%-
set CACHE_VER = {
'css/main.css': 4031,
'css/main.css': 4032,
'css/catalog.css': 4007,
'css/4chan.css': 4007,
'css/classic.css': 4030,
@ -17,7 +17,6 @@ set CACHE_VER = {
'js/award_modal.js': 4001,
'js/bootstrap.js': 4006,
'js/category_modal.js': 4000,
'js/comments_admin.js': 4000,
'js/comments_v.js': 4002,
'js/submission_listing.js': 4000,
@ -26,7 +25,7 @@ set CACHE_VER = {
'js/lottery.js': 4000,
'js/marked.js': 4006,
'js/search.js': 4000,
'js/submit.js': 4000,
'js/submit.js': 4001,
'js/userpage.js': 4000,
'js/userpage_v.js': 4002,
'js/lozad.js': 4000,

View File

@ -2,8 +2,4 @@
{%- if value != 1 -%}
{{ suffix }}
{%- endif -%}
{%- endmacro -%}
{%- macro submission_category_tag(name, color_text, color_bg) -%}
<span class="post--category-tag" style="color:#{{color_text}}; background-color:#{{color_bg}};">{{name | safe}}</span>
{%- endmacro -%}
{%- endmacro -%}

View File

@ -1,10 +0,0 @@
CREATE TABLE category (
id serial PRIMARY KEY,
name character varying(128) NOT NULL,
sub character varying(20) REFERENCES subs(name),
color_text char(6),
color_bg char(6),
UNIQUE (name, sub)
);
ALTER TABLE submissions ADD COLUMN category_id integer REFERENCES category(id) ON DELETE SET NULL;

View File

@ -1,7 +1,6 @@
alter table alts add column created_utc int;
alter table award_relationships add column created_utc int;
alter table badge_defs add column created_utc int;
alter table category add column created_utc int;
alter table oauth_apps add column created_utc int;
alter table client_auths add column created_utc int;
alter table banneddomains add column created_utc int;