master
Aevann1 2021-07-25 16:56:06 +02:00
parent e8369daf01
commit 0a8895adee
5 changed files with 5 additions and 32 deletions

View File

@ -22,7 +22,6 @@ class Board(Base, Stndrd, Age_times):
is_banned=Column(Boolean, default=False)
disablesignups=Column(Boolean, default=False)
has_banner=Column(Boolean, default=False)
has_profile=Column(Boolean, default=False)
creator_id=Column(Integer, ForeignKey("users.id"))
ban_reason=Column(String(256), default=None)
color=Column(String(8), default="FF66AC")

View File

@ -40,7 +40,6 @@ class User(Base, Stndrd, Age_times):
created_utc = Column(Integer, default=0)
suicide_utc = Column(Integer, default=0)
admin_level = Column(Integer, default=0)
resized = Column(Boolean, default=True)
agendaposter = Column(Boolean, default=False)
agendaposter_expires_utc = Column(Integer, default=0)
changelogsub = Column(Boolean, default=False)
@ -85,7 +84,6 @@ class User(Base, Stndrd, Age_times):
login_nonce = Column(Integer, default=0)
title_id = Column(Integer, ForeignKey("titles.id"), default=None)
title = relationship("Title", lazy="joined")
has_profile = Column(Boolean, default=False)
has_banner = Column(Boolean, default=False)
reserved = Column(String(256), default=None)
is_nsfw = Column(Boolean, default=False)
@ -568,7 +566,6 @@ class User(Base, Stndrd, Age_times):
imageurl = upload_file(name=f"profile.gif", file=file, resize=(100, 100))
if imageurl:
self.profileurl = imageurl
self.has_profile = True
self.profile_upload_ip = request.remote_addr
self.profile_set_utc = int(time.time())
self.profile_upload_region = request.headers.get("cf-ipcountry")
@ -590,7 +587,7 @@ class User(Base, Stndrd, Age_times):
def del_profile(self):
self.has_profile = False
self.profileurl = None
g.db.add(self)
def del_banner(self):
@ -615,7 +612,7 @@ class User(Base, Stndrd, Age_times):
@property
def profile_url(self):
if self.has_profile and self.profileurl:
if self.profileurl:
return self.profileurl
else:
return self.defaultpicture()
@ -753,7 +750,7 @@ class User(Base, Stndrd, Age_times):
self.unban_utc = 0
if self.has_banner:
self.del_banner()
if self.has_profile:
if self.profileurl:
self.del_profile()
delete_role(self, "linked")

View File

@ -22,29 +22,6 @@ from PIL import Image as PILimage
with open("snappy.txt", "r") as f:
snappyquotes = f.read().split("{[para]}")
@app.route("/resize")
def resize():
u = g.db.query(User).filter(User.profileurl != None, User.resized != True).first()
if u:
print(u.username)
print(f"1 {u.profileurl}")
x = requests.get(u.profileurl)
with open("resizing", "wb") as file:
for chunk in x.iter_content(1024):
file.write(chunk)
image = upload_from_file("resizing", "resizing", (100, 100))
if image == None:
send_notification(1, u, "fail!")
u.resized = True
g.db.add(u)
else:
u.profileurl = image
u.resized = True
g.db.add(u)
print(f"2 {u.profileurl}")
@app.route("/banaward/post/<post_id>")
@auth_required
def postbanaward(post_id, v):

View File

@ -125,7 +125,7 @@
{% if c.is_blocking %}<i class="fas fa-user-minus text-warning" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="You're blocking this user, but you can see this comment because {{'it\'s an admin comment' if c.distinguish_level else 'you\'re an admin'}}."></i>&nbsp;{% endif %}
{% if c.is_blocked %}<i class="fas fa-user-minus text-danger" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="This user is blocking you, but you can see this comment because {{'it\'s an admin comment' if c.distinguish_level else 'you\'re an admin'}}."></i>&nbsp;{% endif %}
{% if c.author.is_deleted %}[deleted account]{% else %}<a {% if c.author.animatedname %}class="{% if c.author.patron %}patron{% else %}leaderboard{% endif %}"{% endif %} style="color:#{{c.author.namecolor}}; font-size:12px; font-weight:bold;" href="/@{{c.author.username}}">{{c.author.username}}</a>{% if c.author.customtitle %}&nbsp;<bdi style="color: #{{c.author.titlecolor}}">&nbsp;{{c.author.customtitle | safe}}</bdi>{% endif %}{% endif %}
{% if c.author.is_deleted %}[deleted account]{% else %}<a {% if c.author.animatedname %}class="{% if c.author.patron %}patron{% else %}leaderboard{% endif %}"{% endif %} style="color:#{{c.author.namecolor}}; font-size:12px; font-weight:bold;" href="/@{{c.author.username}}"><img src="{{ c.author.profile_url }}" class="profile-pic-25 mr-2"/>{{c.author.username}}</a>{% if c.author.customtitle %}&nbsp;<bdi style="color: #{{c.author.titlecolor}}">&nbsp;{{c.author.customtitle | safe}}</bdi>{% endif %}{% endif %}
<span id="timestamp-{{c.id}}" data-toggle="tooltip" data-placement="bottom" title="" class="time-stamp">&nbsp;{{c.age_string}}</span>
{% if c.edited_utc %}

View File

@ -101,7 +101,7 @@
</div>
{% if v.has_profile %}
{% if v.profileurl %}
<div>
<form action="/settings/delete/profile" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}">