remotes/1693045480750635534/spooky-22
Aevann1 2021-07-23 15:47:25 +02:00
parent a028e10ef7
commit 9d8f9b2004
5 changed files with 30 additions and 39 deletions

View File

@ -2,6 +2,6 @@ for theme in ['dark', 'light', 'coffee', 'tron', '4chan']:
with open(f"D:/#D/drama/assets/style/{theme}_ff66ac.css", encoding='utf-8') as t:
text = t.read()
for color in ['805ad5','62ca56','38a169','80ffff','2a96f3','62ca56','eb4963','ff0000','f39731','30409f','3e98a7','e4432d','7b9ae4','ec72de','7f8fa6', 'f8db58']:
newtext = text.replace("ff66ac", color).replace("ff4097", color).replace("ff1a83", color).replace("ff3390", color)
newtext = text.replace("ff66ac", color).replace("ff4097", color).replace("ff1a83", color).replace("ff3390", color).replace("rgba(255, 102, 172, 0.25)", color)
with open(f"D:/#D/drama/assets/style/{theme}_{color}.css", encoding='utf-8', mode='w') as nt:
nt.write(newtext)

View File

@ -717,8 +717,6 @@ def edit_comment(cid, v):
if ban.reason:
reason += f" {ban.reason_text}"
return jsonify({"error": reason}), 401
return {'html': lambda: render_template("comment_failed.html",
action=f"/edit_comment/{c.base36id}",

View File

@ -23,6 +23,23 @@ from PIL import Image as PILimage
with open("snappy.txt", "r") as f:
snappyquotes = f.read().split("{[para]}")
def resize():
u = g.db.query(User).filter(User.profileurl != None, User.resized != True).first()
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:
u.profileurl = image
u.resized = True
g.db.add(u)
print(f"2 {u.profileurl}")
@app.route("/banaward/post/<post_id>", methods=["POST"])
@auth_required
@ -73,12 +90,7 @@ def publish(pid, v):
def submit_get(v):
if v and v.is_banned and not v.unban_utc: return render_template("seized.html")
board = request.args.get("guild", "general")
b = get_guild(board, graceful=True)
if not b:
b = get_guild("general")
b = get_guild("general")
return render_template("submit.html",
v=v,
@ -278,6 +290,8 @@ def edit_post(pid, v):
for x in notify_users: send_notification(1046, x, f"@{v.username} has mentioned you: https://rdrama.net{p.permalink}")
resize()
return redirect(p.permalink)
@app.route("/submit/title", methods=['GET'])
@ -1053,6 +1067,8 @@ def submit_post(v):
g.db.commit()
send_message(f"https://rdrama.net{new_post.permalink}")
resize()
return {"html": lambda: redirect(new_post.permalink),
"api": lambda: jsonify(new_post.json)
}
@ -1077,21 +1093,7 @@ def delete_post_pid(pid, v):
cache.delete_memoized(frontlist)
u = g.db.query(User).filter(User.profileurl != None, User.resized != True).first()
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:
u.profileurl = image
u.resized = True
g.db.add(u)
print(f"2 {u.profileurl}")
resize()
return "", 204

View File

@ -9,6 +9,7 @@ from drama.mail import *
from flask import *
from drama.__main__ import app, cache, limiter, db_session
from pusher_push_notifications import PushNotifications
from .front import resize
PUSHER_KEY = environ.get("PUSHER_KEY", "").strip()
@ -31,21 +32,7 @@ def leaderboard(v):
if v and v.is_banned and not v.unban_utc:return render_template("seized.html")
users1, users2 = leaderboard()
u = g.db.query(User).filter(User.profileurl != None, User.resized != True).first()
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:
u.profileurl = image
u.resized = True
g.db.add(u)
print(f"2 {u.profileurl}")
resize()
return render_template("leaderboard.html", v=v, users1=users1, users2=users2)

View File

@ -3,7 +3,9 @@ from drama.helpers.get import *
from drama.classes import *
from flask import *
from drama.__main__ import app
from .users import leaderboard
users1, users2 = leaderboard()
@app.route("/api/v1/vote/post/<post_id>/<x>", methods=["POST"])
@app.route("/api/vote/post/<post_id>/<x>", methods=["POST"])
@ -72,6 +74,8 @@ def api_vote_post(post_id, x, v):
post.upvotes = post.ups
post.downvotes = post.downs
g.db.add(post)
users1, users2 = leaderboard()
return "", 204
@app.route("/api/v1/vote/comment/<comment_id>/<x>", methods=["POST"])