remotes/1693045480750635534/spooky-22
Aevann1 2021-09-13 14:06:22 +02:00
parent d3fc580c79
commit e92c5db120
4 changed files with 12 additions and 2 deletions

View File

@ -273,6 +273,8 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing):
if v and not v.oldreddit: body = body.replace("old.reddit.com", "reddit.com")
if v and v.nitter: 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)

View File

@ -325,7 +325,9 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
if "?" in url: url += "&sort=controversial"
else: url += "?sort=controversial"
return url
elif self.url: return self.url
elif self.url:
if v and v.nitter: return self.url.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net")
return self.url
else: return ""
@property
@ -355,6 +357,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
body = body.replace(s, r)
if v and not v.oldreddit: body = body.replace("old.reddit.com", "reddit.com")
if v and v.nitter: body = body.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net")
return body
@property

View File

@ -73,7 +73,8 @@ class User(Base, Stndrd, Age_times):
flairchanged = Column(Boolean, default=False)
newtab = Column(Boolean, default=False)
newtabexternal = Column(Boolean, default=True)
oldreddit = Column(Boolean, default=False)
oldreddit = Column(Boolean)
nitter = Column(Boolean)
controversial = Column(Boolean, default=False)
submissions = relationship(
"Submission",

View File

@ -78,6 +78,10 @@ def settings_profile_post(v):
updated = True
v.oldreddit = request.values.get("oldreddit", None) == 'true'
if request.values.get("nitter", v.nitter) != v.oldrnittereddit:
updated = True
v.nitter = request.values.get("nitter", None) == 'true'
if request.values.get("controversial", v.controversial) != v.controversial:
updated = True
v.controversial = request.values.get("controversial", None) == 'true'