forked from MarseyWorld/MarseyWorld
sneed
parent
bb2a69d07a
commit
6a3573ea40
|
@ -37,6 +37,7 @@ class User(Base, Stndrd, Age_times):
|
|||
passhash = deferred(Column(String, default=None))
|
||||
created_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)
|
||||
|
|
|
@ -388,27 +388,6 @@ def archiveorg(url):
|
|||
except Exception as e: print(e)
|
||||
|
||||
|
||||
def sex():
|
||||
for u in g.db.query(User).filter(User.profileurl != None).all():
|
||||
print(f"1 {u.profileurl}")
|
||||
x = requests.get(u.profileurl)
|
||||
|
||||
with open("nigger", "wb") as file:
|
||||
for chunk in x.iter_content(1024):
|
||||
file.write(chunk)
|
||||
|
||||
u.profileurl = upload_from_file("nigger", "nigger", (50, 50))
|
||||
g.db.add(u)
|
||||
print(f"2 {u.profileurl}")
|
||||
time.sleep(100)
|
||||
|
||||
|
||||
@app.route("/admin/resize", methods=["GET"])
|
||||
def resize():
|
||||
new_thread = threading.Thread(target=sex)
|
||||
new_thread.start()
|
||||
return "sex"
|
||||
|
||||
@app.route("/submit", methods=['POST'])
|
||||
@app.route("/api/v1/submit", methods=["POST"])
|
||||
@app.route("/api/vue/submit", methods=["POST"])
|
||||
|
@ -420,6 +399,7 @@ def resize():
|
|||
@api("create")
|
||||
def submit_post(v):
|
||||
|
||||
|
||||
title = request.form.get("title", "").strip()
|
||||
|
||||
title = title.strip()
|
||||
|
@ -956,31 +936,11 @@ def submit_post(v):
|
|||
g.db.add(n)
|
||||
g.db.commit()
|
||||
send_message(f"https://rdrama.net{new_post.permalink}")
|
||||
|
||||
return {"html": lambda: redirect(new_post.permalink),
|
||||
"api": lambda: jsonify(new_post.json)
|
||||
}
|
||||
|
||||
# @app.route("/api/nsfw/<pid>/<x>", methods=["POST"])
|
||||
# @auth_required
|
||||
# @validate_formkey
|
||||
# def api_nsfw_pid(pid, x, v):
|
||||
|
||||
# try:
|
||||
# x=bool(int(x))
|
||||
# except:
|
||||
# abort(400)
|
||||
|
||||
# post=get_post(pid)
|
||||
|
||||
# if not v.admin_level >=3 and not post.author_id==v.id and not post.board.has_mod(v):
|
||||
# abort(403)
|
||||
|
||||
# post.over_18=x
|
||||
# g.db.add(post)
|
||||
#
|
||||
|
||||
# return "", 204
|
||||
|
||||
|
||||
@app.route("/delete_post/<pid>", methods=["POST"])
|
||||
@app.route("/api/v1/delete_post/<pid>", methods=["POST"])
|
||||
|
@ -1001,17 +961,17 @@ def delete_post_pid(pid, v):
|
|||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
# delete i.ruqqus.ga
|
||||
if post.domain == "i.ruqqus.ga":
|
||||
u = g.db.query(User).filter(User.profileurl != None, User.resized != True).first():
|
||||
print(f"1 {u.profileurl}")
|
||||
x = requests.get(u.profileurl)
|
||||
|
||||
segments = post.url.split("/")
|
||||
pid = segments[4]
|
||||
rand = segments[5]
|
||||
if pid == post.base36id:
|
||||
key = f"post/{pid}/{rand}"
|
||||
delete_file(key)
|
||||
#post.is_image = False
|
||||
g.db.add(post)
|
||||
with open("resizing", "wb") as file:
|
||||
for chunk in x.iter_content(1024):
|
||||
file.write(chunk)
|
||||
|
||||
u.profileurl = upload_from_file("resizing", "resizing", (50, 50))
|
||||
g.db.add(u)
|
||||
print(f"2 {u.profileurl}")
|
||||
|
||||
return "", 204
|
||||
|
||||
|
|
Loading…
Reference in New Issue