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 {
animation: blinker 1s infinite;
animation: blinker 4s infinite;
}
@keyframes blinker {

View File

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

View File

@ -21,7 +21,6 @@ def award_timers(v, bot=False):
if v.unban_utc and v.unban_utc < now:
v.is_banned = 0
v.unban_utc = 0
v.ban_evade = 0
v.ban_reason = None
notify_if_not_bot("You have been unbanned!")
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):
chart(kind='daily', site=site)
chart(kind='weekly', site=site)
stats(site=site)
def chart(kind, site):
now = time.gmtime()

View File

@ -91,16 +91,11 @@ def get_logged_in_user():
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 wrapper(*args, **kwargs):
v = get_logged_in_user()
check_ban_evade(v)
v.check_ban_evade()
return make_response(f(*args, v=v, **kwargs))
@ -120,7 +115,7 @@ def auth_desired_with_logingate(f):
if not redir: redir = '/'
return redirect(redir)
check_ban_evade(v)
v.check_ban_evade()
return make_response(f(*args, v=v, **kwargs))
@ -132,7 +127,7 @@ def auth_required(f):
v = get_logged_in_user()
if not v: abort(401)
check_ban_evade(v)
v.check_ban_evade()
return make_response(f(*args, v=v, **kwargs))
@ -147,7 +142,7 @@ def is_not_permabanned(f):
if not v: abort(401)
check_ban_evade(v)
v.check_ban_evade()
if v.is_suspended_permanently:
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])
for uid in losing_voters:
add_notif(cid, uid)
post.body += '\n\nclosed'
g.db.add(post)
ma = ModAction(
kind="distribute",
@ -282,7 +278,6 @@ def revert_actions(v, username):
for user in users:
user.shadowbanned = None
user.unban_utc = 0
user.ban_evade = 0
user.ban_reason = None
if user.is_banned:
user.is_banned = 0
@ -292,7 +287,6 @@ def revert_actions(v, username):
for u in user.alts:
u.shadowbanned = None
u.unban_utc = 0
u.ban_evade = 0
u.ban_reason = None
if u.is_banned:
u.is_banned = 0
@ -935,11 +929,9 @@ def shadowban(user_id, v):
def unshadowban(user_id, v):
user = get_account(user_id)
user.shadowbanned = None
user.ban_evade = 0
g.db.add(user)
for alt in user.alts:
alt.shadowbanned = None
alt.ban_evade = 0
g.db.add(alt)
ma = ModAction(
@ -1062,7 +1054,6 @@ def unban_user(user_id, v):
user.is_banned = 0
user.unban_utc = 0
user.ban_evade = 0
user.ban_reason = None
send_repeatable_notification(user.id, f"@{v.username} has unbanned you!")
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!")
x.is_banned = 0
x.unban_utc = 0
x.ban_evade = 0
x.ban_reason = None
g.db.add(x)

View File

@ -232,7 +232,6 @@ def award_thing(v, thing_type, id):
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!")

View File

@ -333,7 +333,6 @@ def sign_up_post(v):
password=request.values.get("password"),
email=email,
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
)
@ -357,10 +356,7 @@ def sign_up_post(v):
check_for_alts(new_user.id)
if new_user.has_shadowbanned_alts:
new_user.shadowbanned = "AutoJanny"
g.db.add(new_user)
g.db.commit()
new_user.check_ban_evade()
send_notification(new_user.id, WELCOME_MSG)

View File

@ -481,10 +481,10 @@ if SITE_NAME == 'PCM':
count = int(y.group(3))
live.append((req.url, t.group(1), y.group(2), y.group(1), count))
except:
offline.append((req.url, t.group(1), y.group(2)))
offline.append((req.url.rstrip('/live'), t.group(1), y.group(2)))
else:
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)
live = sorted(live, key=lambda x: x[4], reverse=True)

View File

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

View File

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

View File

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