xc
This commit is contained in:
parent
7fee47f48f
commit
9208a659d9
1 changed files with 25 additions and 26 deletions
|
@ -338,38 +338,37 @@ class Comment(Base):
|
||||||
|
|
||||||
body = self.body_html
|
body = self.body_html
|
||||||
|
|
||||||
if not body: return ""
|
if body:
|
||||||
|
body = censor_slurs(body, v)
|
||||||
|
|
||||||
body = censor_slurs(body, v)
|
if v:
|
||||||
|
if v.teddit: body = body.replace("old.reddit.com", "teddit.net")
|
||||||
|
elif not v.oldreddit: body = body.replace("old.reddit.com", "reddit.com")
|
||||||
|
|
||||||
if v:
|
if v.nitter and not '/i/spaces/' in body: body = body.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net")
|
||||||
if v.teddit: body = body.replace("old.reddit.com", "teddit.net")
|
|
||||||
elif not v.oldreddit: body = body.replace("old.reddit.com", "reddit.com")
|
|
||||||
|
|
||||||
if v.nitter and not '/i/spaces/' in body: body = body.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net")
|
if v and v.controversial:
|
||||||
|
for i in re.finditer('(/comments/.*?)"', body):
|
||||||
|
url = i.group(1)
|
||||||
|
p = urlparse(url).query
|
||||||
|
p = parse_qs(p)
|
||||||
|
|
||||||
if v and v.controversial:
|
if 'sort' not in p: p['sort'] = ['controversial']
|
||||||
for i in re.finditer('(/comments/.*?)"', body):
|
|
||||||
url = i.group(1)
|
|
||||||
p = urlparse(url).query
|
|
||||||
p = parse_qs(p)
|
|
||||||
|
|
||||||
if 'sort' not in p: p['sort'] = ['controversial']
|
url_noquery = url.split('?')[0]
|
||||||
|
body = body.replace(url, f"{url_noquery}?{urlencode(p, True)}")
|
||||||
|
|
||||||
url_noquery = url.split('?')[0]
|
if v and v.shadowbanned and v.id == self.author_id and 86400 > time.time() - self.created_utc > 60:
|
||||||
body = body.replace(url, f"{url_noquery}?{urlencode(p, True)}")
|
ti = max(int((time.time() - self.created_utc)/60), 1)
|
||||||
|
maxupvotes = min(ti, 31)
|
||||||
if v and v.shadowbanned and v.id == self.author_id and 86400 > time.time() - self.created_utc > 60:
|
rand = randint(0, maxupvotes)
|
||||||
ti = max(int((time.time() - self.created_utc)/60), 1)
|
if self.upvotes < rand:
|
||||||
maxupvotes = min(ti, 31)
|
amount = randint(0, 3)
|
||||||
rand = randint(0, maxupvotes)
|
self.upvotes += amount
|
||||||
if self.upvotes < rand:
|
g.db.add(self)
|
||||||
amount = randint(0, 3)
|
self.author.coins += amount
|
||||||
self.upvotes += amount
|
g.db.add(self.author)
|
||||||
g.db.add(self)
|
g.db.commit()
|
||||||
self.author.coins += amount
|
|
||||||
g.db.add(self.author)
|
|
||||||
g.db.commit()
|
|
||||||
|
|
||||||
for c in self.options:
|
for c in self.options:
|
||||||
body += f'<div class="custom-control"><input type="checkbox" class="custom-control-input" id="{c.id}" name="option"'
|
body += f'<div class="custom-control"><input type="checkbox" class="custom-control-input" id="{c.id}" name="option"'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue