remotes/1693045480750635534/spooky-22
Aevann1 2021-09-30 21:40:33 +02:00
parent ece31240ca
commit 47a0acab80
15 changed files with 50 additions and 54 deletions

View File

@ -32,7 +32,7 @@ class Comment(Base):
parent_comment_id = Column(Integer, ForeignKey("comments.id"))
over_18 = Column(Boolean, default=False)
is_bot = Column(Boolean, default=False)
is_pinned = Column(String(255))
is_pinned = Column(String(25))
sentto=Column(Integer)
notifiedto=Column(Integer)
app_id = Column(Integer, ForeignKey("oauth_apps.id"))

View File

@ -5,8 +5,8 @@ class BannedDomain(Base):
__tablename__ = "banneddomains"
id = Column(Integer, primary_key=True)
domain = Column(String(255))
reason = Column(String(255))
domain = Column(String(50))
reason = Column(String(100))
class BadLink(Base):
@ -14,5 +14,5 @@ class BadLink(Base):
__tablename__ = "badlinks"
id = Column(Integer, primary_key=True)
link = Column(String(512))
reason = Column(String(255))
reason = Column(String(100))
autoban = Column(Boolean, default=False)

View File

@ -12,13 +12,9 @@ class Image(Base):
class BadPic(Base):
#Class for tracking fuzzy hashes of banned csam images
__tablename__="badpics"
id = Column(BigInteger, primary_key=True)
description=Column(String(255))
description=Column(String(200))
phash=Column(String(64))
ban_reason=Column(String(64))
ban_time=Column(Integer)
ban_time=Column(Integer)

View File

@ -22,7 +22,7 @@ class Submission(Base):
author_id = Column(BigInteger, ForeignKey("users.id"))
edited_utc = Column(BigInteger, default=0)
created_utc = Column(BigInteger, default=0)
thumburl = Column(String(255))
thumburl = Column(String(50))
is_banned = Column(Boolean, default=False)
removed_by = Column(Integer)
bannedfor = Column(Boolean)
@ -30,8 +30,8 @@ class Submission(Base):
views = Column(Integer, default=0)
deleted_utc = Column(Integer, default=0)
distinguish_level = Column(Integer, default=0)
created_str = Column(String(255))
stickied = Column(String(255))
created_str = Column(String(25))
stickied = Column(String(25))
is_pinned = Column(Boolean, default=False)
private = Column(Boolean, default=False)
club = Column(Boolean, default=False)

View File

@ -73,31 +73,31 @@ else:
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True)
username = Column(String(255))
namecolor = Column(String(255), default=defaultcolor)
background = Column(String(255))
customtitle = Column(String(255))
customtitleplain = Column(String(255))
username = Column(String(25))
namecolor = Column(String(6), default=defaultcolor)
background = Column(String(20))
customtitle = Column(String(300))
customtitleplain = Column(String(100))
if "pcmemes.net" in site:
quadrant = Column(String(255))
quadrant = Column(String(20))
basedcount = Column(Integer, default=0)
pills = Column(String(255), default="")
pills = deferred(Column(String(300), default=""))
titlecolor = Column(String(255), default=defaultcolor)
theme = Column(String(255), default=defaulttheme)
themecolor = Column(String(255), default=defaultcolor)
titlecolor = Column(String(6), default=defaultcolor)
theme = Column(String(10), default=defaulttheme)
themecolor = Column(String(6), default=defaultcolor)
cardview = Column(Boolean, default=cardview)
song = Column(String(255))
highres = Column(String(255))
profileurl = Column(String(255))
bannerurl = Column(String(255))
song = Column(String(20))
highres = Column(String(50))
profileurl = Column(String(50))
bannerurl = Column(String(50))
patron = Column(Integer, default=0)
verified = Column(String(255))
email = Column(String(255))
verified = Column(String(20))
email = Column(String(50))
css = deferred(Column(String(4000)))
profilecss = deferred(Column(String(4000)))
passhash = deferred(Column(String(255)))
passhash = deferred(Column(String(180)))
post_count = Column(Integer, default=0)
comment_count = Column(Integer, default=0)
received_award_count = Column(Integer, default=0)
@ -112,7 +112,7 @@ class User(Base):
agendaposter_expires_utc = Column(Integer, default=0)
changelogsub = Column(Boolean, default=False)
is_activated = Column(Boolean, default=False)
shadowbanned = Column(Boolean, default=False)
shadowbanned = Column(String(25), default=False)
over_18 = Column(Boolean, default=False)
hidevotedon = Column(Boolean, default=False)
highlightcomments = Column(Boolean, default=True)
@ -131,7 +131,7 @@ class User(Base):
is_banned = Column(Integer, default=0)
unban_utc = Column(Integer, default=0)
ban_reason = Column(String(255))
ban_reason = Column(String(120))
club_banned = Column(Boolean, default=False)
club_allowed = Column(Boolean, default=False)
login_nonce = Column(Integer, default=0)
@ -141,15 +141,15 @@ class User(Base):
mfa_secret = deferred(Column(String(16)))
is_private = Column(Boolean, default=False)
stored_subscriber_count = Column(Integer, default=0)
defaultsortingcomments = Column(String(255), default="top")
defaultsorting = Column(String(255), default="hot")
defaulttime = Column(String(255), default=defaulttimefilter)
defaultsortingcomments = Column(String(15), default="top")
defaultsorting = Column(String(15), default="hot")
defaulttime = Column(String(5), default=defaulttimefilter)
is_nofollow = Column(Boolean, default=False)
custom_filter_list = Column(String(1000))
discord_id = Column(String(64))
ban_evade = Column(Integer, default=0)
original_username = deferred(Column(String(255)))
original_username = deferred(Column(String(25)))
subscriptions = relationship("Subscription", viewonly=True)
following = relationship("Follow", primaryjoin="Follow.user_id==User.id", viewonly=True)

View File

@ -210,7 +210,7 @@ def get_comments(cids, v=None, load_parent=False):
).filter(Comment.id.in_(cids))
if not (v and v.shadowbanned) and not (v and v.admin_level == 6):
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()]
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned != None).all()]
comments = comments.filter(Comment.author_id.notin_(shadowbanned))
comments = comments.join(
@ -236,7 +236,7 @@ def get_comments(cids, v=None, load_parent=False):
output.append(comment)
else:
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()]
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned != None).all()]
output = g.db.query(Comment).options(lazyload('*')).filter(Comment.id.in_(cids), Comment.author_id.notin_(shadowbanned)).all()
if load_parent:

View File

@ -755,11 +755,11 @@ def agendaposter(user_id, v):
def shadowban(user_id, v):
user = g.db.query(User).options(lazyload('*')).filter_by(id=user_id).first()
if user.admin_level != 0: abort(403)
user.shadowbanned = True
user.shadowbanned = v.username
g.db.add(user)
for alt in user.alts:
if alt.admin_level > 0: break
alt.shadowbanned = True
alt.shadowbanned = v.username
g.db.add(alt)
ma = ModAction(
kind="shadowban",
@ -780,10 +780,10 @@ def shadowban(user_id, v):
def unshadowban(user_id, v):
user = g.db.query(User).options(lazyload('*')).filter_by(id=user_id).first()
if user.admin_level != 0: abort(403)
user.shadowbanned = False
user.shadowbanned = None
g.db.add(user)
for alt in user.alts:
alt.shadowbanned = False
alt.shadowbanned = None
g.db.add(alt)
ma = ModAction(

View File

@ -85,7 +85,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
)
if not (v and v.shadowbanned) and not (v and v.admin_level == 6):
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()]
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned != None).all()]
comments = comments.filter(Comment.author_id.notin_(shadowbanned))
comments=comments.filter(

View File

@ -194,7 +194,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
posts=posts.filter(not_(Submission.title.ilike(f'%{word}%')))
if not (v and v.shadowbanned):
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()]
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned != None).all()]
posts = posts.filter(Submission.author_id.notin_(shadowbanned))
if sort == "hot":

View File

@ -119,7 +119,7 @@ def post_id(pid, anything=None, v=None):
)
if not (v and v.shadowbanned) and not (v and v.admin_level == 6):
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()]
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned != None).all()]
comments = comments.filter(Comment.author_id.notin_(shadowbanned))
comments=comments.filter(
@ -160,7 +160,7 @@ def post_id(pid, anything=None, v=None):
post.preloaded_comments = output
else:
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()]
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned != None).all()]
comments = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.author_id.notin_(shadowbanned))
if sort == "new":

View File

@ -46,7 +46,7 @@ def settings_profile_post(v):
if request.values.get("background", v.background) != v.background:
updated = True
v.background= request.values.get("background", None)
v.background = request.values.get("background", None)
if request.values.get("slurreplacer", v.slurreplacer) != v.slurreplacer:
updated = True
@ -755,7 +755,7 @@ def settings_song_change(v):
if song == "" and v.song and path.isfile(f"/songs/{v.song}.mp3") and g.db.query(User.id).options(lazyload('*')).filter_by(song=v.song).count() == 1:
os.remove(f"/songs/{v.song}.mp3")
v.song=None
v.song = None
g.db.add(v)
g.db.commit()
return redirect("/settings/profile")
@ -774,7 +774,7 @@ def settings_song_change(v):
if "&" in id: id = id.split("&")[0]
if path.isfile(f'/songs/{id}.mp3'):
v.song=id
v.song = id
g.db.add(v)
g.db.commit()
return redirect("/settings/profile")
@ -824,7 +824,7 @@ def settings_song_change(v):
songfile = max(paths, key=path.getctime)
os.rename(songfile, f"/songs/{id}.mp3")
v.song=id
v.song = id
g.db.add(v)
g.db.commit()

View File

@ -106,7 +106,7 @@ def suicide(v, username):
@auth_required
def get_coins(v, username):
user = get_user(username)
if user is not None: return {"coins": user.coins}, 200
if user != None: return {"coins": user.coins}, 200
else: return {"error": "invalid_user"}, 404
@app.post("/@<username>/transfer_coins")

View File

@ -194,7 +194,7 @@
{% endif %}
{% if c.active_flags %}<a class="btn btn-primary" style="padding:1px 5px; font-size:10px;" href="javascript:void(0)" onclick="document.getElementById('flaggers-{{c.id}}').classList.toggle('d-none')">{{c.active_flags}} Reports</a>{% endif %}
{% if c.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
{% if v and v.admin_level==6 and c.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Shadowbanned user"></i>{% endif %}
{% if v and v.admin_level==6 and c.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Shadowbanned by @{{c.author.shadowbanned}}"></i>{% endif %}
{% if c.is_pinned %}<i class="text-admin fas fa-thumbtack fa-rotate--45" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned by @{{c.is_pinned}}"></i>{% endif %}
{% if c.distinguish_level %}<i class="fas fa-broom text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{'SITE_NAME' | app_config}} Admin, speaking officially"></i>{% endif %}
{% if c.is_op %}<i class="fas fa-microphone-stand text-info" data-bs-toggle="tooltip" data-bs-placement="bottom" title="OP"></i>{% endif %}

View File

@ -260,7 +260,7 @@
<i class="{{a.class_list}} px-1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{a.title}} Award given by @{{a.user.username}}"></i>
{% endfor %}
{% endif %}
{% if v and v.admin_level==6 and p.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Shadowbanned user"></i>{% endif %}
{% if v and v.admin_level==6 and p.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Shadowbanned by @{{p.author.shadowbanned}}"></i>{% endif %}
{% if p.stickied %}<i class="fas fa-thumbtack fa-fw text-admin fa-rotate--45" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned by @{{p.stickied}}"></i>{% endif %}
{% if p.is_pinned %}<i class="fas fa-thumbtack fa-fw text-admin fa-rotate--45" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned to profile"></i>{% endif %}
{% if p.distinguish_level %} <i class="fas fa-broom text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{'SITE_NAME' | app_config}} Admin, speaking officially"></i>{% endif %}

View File

@ -128,7 +128,7 @@
<i class="{{a.class_list}} px-1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{a.title}} Award given by @{{a.user.username}}"></i>
{% endfor %}
{% endif %}
{% if v and v.admin_level==6 and p.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Shadowbanned user"></i>{% endif %}
{% if v and v.admin_level==6 and p.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Shadowbanned by @{{p.author.shadowbanned}}"></i>{% endif %}
{% if p.stickied %}<i class="fas fa-thumbtack text-admin fa-rotate--45" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned by @{{p.stickied}}"></i>{% endif %}
{% if p.distinguish_level %}<i class="fas fa-broom text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{'SITE_NAME' | app_config}} Admin, speaking officially"></i>{% endif %}
{% if p.is_pinned and request.path.startswith('/@') %}<i class="fas fa-thumbtack text-admin fa-rotate--45" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned to profile"></i>{% endif %}