forked from rDrama/rDrama
1
0
Fork 0

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

master
Aevann1 2022-09-22 19:40:23 +00:00
commit fe7e8761f6
12 changed files with 54 additions and 65 deletions

View File

@ -6266,7 +6266,7 @@ div.markdown {
} }
.live-circle { .live-circle {
animation: blinker 1s infinite; animation: blinker 4s infinite;
} }
@keyframes blinker { @keyframes blinker {

View File

@ -128,7 +128,6 @@ class User(Base):
is_nofollow = Column(Boolean, default=False) is_nofollow = Column(Boolean, default=False)
custom_filter_list = Column(String) custom_filter_list = Column(String)
discord_id = Column(String) discord_id = Column(String)
ban_evade = Column(Integer, default=0)
original_username = Column(String) original_username = Column(String)
referred_by = Column(Integer, ForeignKey("users.id")) referred_by = Column(Integer, ForeignKey("users.id"))
currently_held_lottery_tickets = Column(Integer, default=0) currently_held_lottery_tickets = Column(Integer, default=0)
@ -835,10 +834,18 @@ class User(Base):
@property @property
@lazy @lazy
def has_shadowbanned_alts(self): def check_ban_evade(self):
for u in self.alts_unique: for u in self.alts_unique:
if u.shadowbanned or u.is_suspended_permanently: return True if u.shadowbanned:
return False self.shadowbanned = u.shadowbanned
g.db.add(self)
g.db.commit()
return
if u.is_suspended_permanently:
self.shadowbanned = u.banned_by.username
g.db.add(self)
g.db.commit()
return
@property @property
@lazy @lazy

View File

@ -21,7 +21,6 @@ def award_timers(v, bot=False):
if v.unban_utc and v.unban_utc < now: if v.unban_utc and v.unban_utc < now:
v.is_banned = 0 v.is_banned = 0
v.unban_utc = 0 v.unban_utc = 0
v.ban_evade = 0
v.ban_reason = None v.ban_reason = None
notify_if_not_bot("You have been unbanned!") notify_if_not_bot("You have been unbanned!")
if v.agendaposter and v.agendaposter != 1 and v.agendaposter < now: if v.agendaposter and v.agendaposter != 1 and v.agendaposter < now:

View File

@ -15,7 +15,6 @@ from files.helpers.const import *
def generate_charts_task(site): def generate_charts_task(site):
chart(kind='daily', site=site) chart(kind='daily', site=site)
chart(kind='weekly', site=site) chart(kind='weekly', site=site)
stats(site=site)
def chart(kind, site): def chart(kind, site):
now = time.gmtime() now = time.gmtime()

View File

@ -91,16 +91,11 @@ def get_logged_in_user():
return v return v
def check_ban_evade(v):
if v and not v.patron and v.admin_level < 2 and v.ban_evade and not v.unban_utc:
v.shadowbanned = "AutoJanny"
g.db.add(v)
def auth_desired(f): def auth_desired(f):
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
v = get_logged_in_user() v = get_logged_in_user()
check_ban_evade(v) v.check_ban_evade()
return make_response(f(*args, v=v, **kwargs)) return make_response(f(*args, v=v, **kwargs))
@ -120,7 +115,7 @@ def auth_desired_with_logingate(f):
if not redir: redir = '/' if not redir: redir = '/'
return redirect(redir) return redirect(redir)
check_ban_evade(v) v.check_ban_evade()
return make_response(f(*args, v=v, **kwargs)) return make_response(f(*args, v=v, **kwargs))
@ -132,7 +127,7 @@ def auth_required(f):
v = get_logged_in_user() v = get_logged_in_user()
if not v: abort(401) if not v: abort(401)
check_ban_evade(v) v.check_ban_evade()
return make_response(f(*args, v=v, **kwargs)) return make_response(f(*args, v=v, **kwargs))
@ -147,7 +142,7 @@ def is_not_permabanned(f):
if not v: abort(401) if not v: abort(401)
check_ban_evade(v) v.check_ban_evade()
if v.is_suspended_permanently: if v.is_suspended_permanently:
return {"error": "Internal server error"}, 500 return {"error": "Internal server error"}, 500

View File

@ -235,10 +235,6 @@ def distribute(v, option_id):
losing_voters.extend([x.user_id for x in o.votes]) losing_voters.extend([x.user_id for x in o.votes])
for uid in losing_voters: for uid in losing_voters:
add_notif(cid, uid) add_notif(cid, uid)
post.body += '\n\nclosed'
g.db.add(post)
ma = ModAction( ma = ModAction(
kind="distribute", kind="distribute",
@ -282,7 +278,6 @@ def revert_actions(v, username):
for user in users: for user in users:
user.shadowbanned = None user.shadowbanned = None
user.unban_utc = 0 user.unban_utc = 0
user.ban_evade = 0
user.ban_reason = None user.ban_reason = None
if user.is_banned: if user.is_banned:
user.is_banned = 0 user.is_banned = 0
@ -292,7 +287,6 @@ def revert_actions(v, username):
for u in user.alts: for u in user.alts:
u.shadowbanned = None u.shadowbanned = None
u.unban_utc = 0 u.unban_utc = 0
u.ban_evade = 0
u.ban_reason = None u.ban_reason = None
if u.is_banned: if u.is_banned:
u.is_banned = 0 u.is_banned = 0
@ -935,11 +929,9 @@ def shadowban(user_id, v):
def unshadowban(user_id, v): def unshadowban(user_id, v):
user = get_account(user_id) user = get_account(user_id)
user.shadowbanned = None user.shadowbanned = None
user.ban_evade = 0
g.db.add(user) g.db.add(user)
for alt in user.alts: for alt in user.alts:
alt.shadowbanned = None alt.shadowbanned = None
alt.ban_evade = 0
g.db.add(alt) g.db.add(alt)
ma = ModAction( ma = ModAction(
@ -1062,7 +1054,6 @@ def unban_user(user_id, v):
user.is_banned = 0 user.is_banned = 0
user.unban_utc = 0 user.unban_utc = 0
user.ban_evade = 0
user.ban_reason = None user.ban_reason = None
send_repeatable_notification(user.id, f"@{v.username} has unbanned you!") send_repeatable_notification(user.id, f"@{v.username} has unbanned you!")
g.db.add(user) g.db.add(user)
@ -1071,7 +1062,6 @@ def unban_user(user_id, v):
if x.is_banned: send_repeatable_notification(x.id, f"@{v.username} has unbanned you!") if x.is_banned: send_repeatable_notification(x.id, f"@{v.username} has unbanned you!")
x.is_banned = 0 x.is_banned = 0
x.unban_utc = 0 x.unban_utc = 0
x.ban_evade = 0
x.ban_reason = None x.ban_reason = None
g.db.add(x) g.db.add(x)

View File

@ -232,7 +232,6 @@ def award_thing(v, thing_type, id):
else: else:
author.unban_utc = 0 author.unban_utc = 0
author.is_banned = 0 author.is_banned = 0
author.ban_evade = 0
author.ban_reason = None author.ban_reason = None
send_repeatable_notification(author.id, "You have been unbanned!") send_repeatable_notification(author.id, "You have been unbanned!")

View File

@ -333,7 +333,6 @@ def sign_up_post(v):
password=request.values.get("password"), password=request.values.get("password"),
email=email, email=email,
referred_by=ref_id or None, referred_by=ref_id or None,
ban_evade =int(any((x.is_banned or x.shadowbanned) and not x.unban_utc for x in g.db.query(User).filter(User.id.in_(session.get("history", []))).all() if x)),
profileurl=profileurl profileurl=profileurl
) )
@ -357,10 +356,7 @@ def sign_up_post(v):
check_for_alts(new_user.id) check_for_alts(new_user.id)
if new_user.has_shadowbanned_alts: new_user.check_ban_evade()
new_user.shadowbanned = "AutoJanny"
g.db.add(new_user)
g.db.commit()
send_notification(new_user.id, WELCOME_MSG) send_notification(new_user.id, WELCOME_MSG)

View File

@ -481,10 +481,10 @@ if SITE_NAME == 'PCM':
count = int(y.group(3)) count = int(y.group(3))
live.append((req.url, t.group(1), y.group(2), y.group(1), count)) live.append((req.url, t.group(1), y.group(2), y.group(1), count))
except: except:
offline.append((req.url, t.group(1), y.group(2))) offline.append((req.url.rstrip('/live'), t.group(1), y.group(2)))
else: else:
y = offline_regex.search(txt) y = offline_regex.search(txt)
try: offline.append((req.url, y.group(2), y.group(1))) try: offline.append((req.url.rstrip('/live'), y.group(2), y.group(1)))
except: print(x) except: print(x)
live = sorted(live, key=lambda x: x[4], reverse=True) live = sorted(live, key=lambda x: x[4], reverse=True)

View File

@ -9,36 +9,41 @@
tr:hover { tr:hover {
border: 2.5px solid var(--primary); border: 2.5px solid var(--primary);
} }
img.thumb {
border-radius: 4px;
}
</style> </style>
<h1 class="py-3"><i class="fas fa-circle mr-3" style="color:red"></i>Live</h1> <div class="px-2">
<div class="overflow-x-auto"> <h1 class="py-3"><i class="fas fa-circle mr-3" style="color:red"></i>Live</h1>
<table class="table table-striped mb-5"> <div class="overflow-x-auto">
<tbody> <table class="table table-striped mb-5">
{% for link, thumb, name, title, viewers in live %} <tbody>
<tr onclick="window.open('{{link}}', '_blank')"> {% for link, thumb, name, title, viewers in live %}
<td width="48"><img src="{{thumb}}" alt="{{name}} thumbnail" referrerpolicy="no-referrer" width="48"></td> <tr onclick="window.open('{{link}}', '_blank')">
<td>{{name}}</td> <td width="48"><img class="thumb" src="{{thumb}}" alt="{{name}} thumbnail" referrerpolicy="no-referrer" width="48"></td>
<td>{{title}}</td> <td>{{name}}</td>
<td>{{viewers}}</td> <td>{{title}}</td>
</tr> <td>{{viewers}}</td>
{% endfor %} </tr>
</tbody> {% endfor %}
</table> </tbody>
</div> </table>
</div>
<h1 class="py-3"><i class="fas fa-circle mr-3" style="color:gray"></i>Offline</h1> <h1 class="py-3"><i class="fas fa-circle mr-3" style="color:gray"></i>Offline</h1>
<div class="overflow-x-auto"> <div class="overflow-x-auto">
<table class="table table-striped mb-5"> <table class="table table-striped mb-5">
<tbody> <tbody>
{% for link, thumb, name in offline %} {% for link, thumb, name in offline %}
<tr onclick="window.open('{{link}}', '_blank')"> <tr onclick="window.open('{{link}}', '_blank')">
<td width="48"><img src="{{thumb}}" alt="{{name}} thumbnail" referrerpolicy="no-referrer" width="48"></td> <td width="48"><img class="thumb" src="{{thumb}}" alt="{{name}} thumbnail" referrerpolicy="no-referrer" width="48"></td>
<td>{{name}}</td> <td>{{name}}</td>
<td></td> <td></td>
<td></td> <td></td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -1,6 +1,6 @@
{%- {%-
set CACHE_VER = { set CACHE_VER = {
'css/main.css': 4034, 'css/main.css': 4035,
'css/catalog.css': 4007, 'css/catalog.css': 4007,
'css/4chan.css': 4007, 'css/4chan.css': 4007,
'css/classic.css': 4031, 'css/classic.css': 4031,

View File

@ -888,7 +888,6 @@ CREATE TABLE public.users (
custom_filter_list character varying(1000) DEFAULT ''::character varying, custom_filter_list character varying(1000) DEFAULT ''::character varying,
discord_id character varying(64), discord_id character varying(64),
stored_subscriber_count integer DEFAULT 0 NOT NULL, stored_subscriber_count integer DEFAULT 0 NOT NULL,
ban_evade integer DEFAULT 0 NOT NULL,
original_username character varying(30), original_username character varying(30),
customtitle character varying(1000), customtitle character varying(1000),
defaultsorting character varying(15) DEFAULT 'hot'::character varying NOT NULL, defaultsorting character varying(15) DEFAULT 'hot'::character varying NOT NULL,