forked from rDrama/rDrama
dfdf
parent
e8369daf01
commit
0a8895adee
|
@ -22,7 +22,6 @@ class Board(Base, Stndrd, Age_times):
|
||||||
is_banned=Column(Boolean, default=False)
|
is_banned=Column(Boolean, default=False)
|
||||||
disablesignups=Column(Boolean, default=False)
|
disablesignups=Column(Boolean, default=False)
|
||||||
has_banner=Column(Boolean, default=False)
|
has_banner=Column(Boolean, default=False)
|
||||||
has_profile=Column(Boolean, default=False)
|
|
||||||
creator_id=Column(Integer, ForeignKey("users.id"))
|
creator_id=Column(Integer, ForeignKey("users.id"))
|
||||||
ban_reason=Column(String(256), default=None)
|
ban_reason=Column(String(256), default=None)
|
||||||
color=Column(String(8), default="FF66AC")
|
color=Column(String(8), default="FF66AC")
|
||||||
|
|
|
@ -40,7 +40,6 @@ class User(Base, Stndrd, Age_times):
|
||||||
created_utc = Column(Integer, default=0)
|
created_utc = Column(Integer, default=0)
|
||||||
suicide_utc = Column(Integer, default=0)
|
suicide_utc = Column(Integer, default=0)
|
||||||
admin_level = Column(Integer, default=0)
|
admin_level = Column(Integer, default=0)
|
||||||
resized = Column(Boolean, default=True)
|
|
||||||
agendaposter = Column(Boolean, default=False)
|
agendaposter = Column(Boolean, default=False)
|
||||||
agendaposter_expires_utc = Column(Integer, default=0)
|
agendaposter_expires_utc = Column(Integer, default=0)
|
||||||
changelogsub = Column(Boolean, default=False)
|
changelogsub = Column(Boolean, default=False)
|
||||||
|
@ -85,7 +84,6 @@ class User(Base, Stndrd, Age_times):
|
||||||
login_nonce = Column(Integer, default=0)
|
login_nonce = Column(Integer, default=0)
|
||||||
title_id = Column(Integer, ForeignKey("titles.id"), default=None)
|
title_id = Column(Integer, ForeignKey("titles.id"), default=None)
|
||||||
title = relationship("Title", lazy="joined")
|
title = relationship("Title", lazy="joined")
|
||||||
has_profile = Column(Boolean, default=False)
|
|
||||||
has_banner = Column(Boolean, default=False)
|
has_banner = Column(Boolean, default=False)
|
||||||
reserved = Column(String(256), default=None)
|
reserved = Column(String(256), default=None)
|
||||||
is_nsfw = Column(Boolean, default=False)
|
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))
|
imageurl = upload_file(name=f"profile.gif", file=file, resize=(100, 100))
|
||||||
if imageurl:
|
if imageurl:
|
||||||
self.profileurl = imageurl
|
self.profileurl = imageurl
|
||||||
self.has_profile = True
|
|
||||||
self.profile_upload_ip = request.remote_addr
|
self.profile_upload_ip = request.remote_addr
|
||||||
self.profile_set_utc = int(time.time())
|
self.profile_set_utc = int(time.time())
|
||||||
self.profile_upload_region = request.headers.get("cf-ipcountry")
|
self.profile_upload_region = request.headers.get("cf-ipcountry")
|
||||||
|
@ -590,7 +587,7 @@ class User(Base, Stndrd, Age_times):
|
||||||
|
|
||||||
def del_profile(self):
|
def del_profile(self):
|
||||||
|
|
||||||
self.has_profile = False
|
self.profileurl = None
|
||||||
g.db.add(self)
|
g.db.add(self)
|
||||||
|
|
||||||
def del_banner(self):
|
def del_banner(self):
|
||||||
|
@ -615,7 +612,7 @@ class User(Base, Stndrd, Age_times):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def profile_url(self):
|
def profile_url(self):
|
||||||
if self.has_profile and self.profileurl:
|
if self.profileurl:
|
||||||
return self.profileurl
|
return self.profileurl
|
||||||
else:
|
else:
|
||||||
return self.defaultpicture()
|
return self.defaultpicture()
|
||||||
|
@ -753,7 +750,7 @@ class User(Base, Stndrd, Age_times):
|
||||||
self.unban_utc = 0
|
self.unban_utc = 0
|
||||||
if self.has_banner:
|
if self.has_banner:
|
||||||
self.del_banner()
|
self.del_banner()
|
||||||
if self.has_profile:
|
if self.profileurl:
|
||||||
self.del_profile()
|
self.del_profile()
|
||||||
|
|
||||||
delete_role(self, "linked")
|
delete_role(self, "linked")
|
||||||
|
|
|
@ -22,29 +22,6 @@ from PIL import Image as PILimage
|
||||||
with open("snappy.txt", "r") as f:
|
with open("snappy.txt", "r") as f:
|
||||||
snappyquotes = f.read().split("{[para]}")
|
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>")
|
@app.route("/banaward/post/<post_id>")
|
||||||
@auth_required
|
@auth_required
|
||||||
def postbanaward(post_id, v):
|
def postbanaward(post_id, v):
|
||||||
|
|
|
@ -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> {% endif %}
|
{% 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> {% 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> {% 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> {% 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 %} <bdi style="color: #{{c.author.titlecolor}}"> {{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 %} <bdi style="color: #{{c.author.titlecolor}}"> {{c.author.customtitle | safe}}</bdi>{% endif %}{% endif %}
|
||||||
|
|
||||||
<span id="timestamp-{{c.id}}" data-toggle="tooltip" data-placement="bottom" title="" class="time-stamp"> {{c.age_string}}</span>
|
<span id="timestamp-{{c.id}}" data-toggle="tooltip" data-placement="bottom" title="" class="time-stamp"> {{c.age_string}}</span>
|
||||||
{% if c.edited_utc %}
|
{% if c.edited_utc %}
|
||||||
|
|
|
@ -101,7 +101,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if v.has_profile %}
|
{% if v.profileurl %}
|
||||||
<div>
|
<div>
|
||||||
<form action="/settings/delete/profile" method="post">
|
<form action="/settings/delete/profile" method="post">
|
||||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||||
|
|
Loading…
Reference in New Issue