sfdsfd
This commit is contained in:
parent
3bbe195b75
commit
3aae15d985
28 changed files with 245 additions and 142 deletions
|
@ -97,6 +97,7 @@ def downvoting(v, username):
|
|||
@app.post("/pay_rent")
|
||||
@limiter.limit("1/second")
|
||||
@auth_required
|
||||
@validate_formkey
|
||||
def pay_rent(v):
|
||||
if v.coins < 500: return "You must have more than 500 coins."
|
||||
v.coins -= 500
|
||||
|
@ -113,6 +114,7 @@ def pay_rent(v):
|
|||
@app.post("/steal")
|
||||
@limiter.limit("1/second")
|
||||
@is_not_banned
|
||||
@validate_formkey
|
||||
def steal(v):
|
||||
if int(time.time()) - v.created_utc < 604800:
|
||||
return "You must have an account older than 1 week in order to attempt stealing."
|
||||
|
@ -167,6 +169,7 @@ def thiefs(v):
|
|||
@app.post("/@<username>/suicide")
|
||||
@limiter.limit("1/second")
|
||||
@auth_required
|
||||
@validate_formkey
|
||||
def suicide(v, username):
|
||||
t = int(time.time())
|
||||
if v.admin_level == 0 and t - v.suicide_utc < 86400: return {"message": "You're on 1-day cooldown!"}
|
||||
|
@ -312,6 +315,7 @@ def song(song):
|
|||
@app.post("/subscribe/<post_id>")
|
||||
@limiter.limit("1/second")
|
||||
@auth_required
|
||||
@validate_formkey
|
||||
def subscribe(v, post_id):
|
||||
new_sub = Subscription(user_id=v.id, submission_id=post_id)
|
||||
g.db.add(new_sub)
|
||||
|
@ -321,6 +325,7 @@ def subscribe(v, post_id):
|
|||
@app.post("/unsubscribe/<post_id>")
|
||||
@limiter.limit("1/second")
|
||||
@auth_required
|
||||
@validate_formkey
|
||||
def unsubscribe(v, post_id):
|
||||
sub=g.db.query(Subscription).filter_by(user_id=v.id, submission_id=post_id).first()
|
||||
if sub:
|
||||
|
@ -337,6 +342,7 @@ def reportbugs(v):
|
|||
@limiter.limit("1/second")
|
||||
@limiter.limit("10/hour")
|
||||
@auth_required
|
||||
@validate_formkey
|
||||
def message2(v, username):
|
||||
|
||||
user = get_user(username, v=v)
|
||||
|
@ -400,6 +406,7 @@ def message2(v, username):
|
|||
@limiter.limit("1/second")
|
||||
@limiter.limit("6/minute")
|
||||
@auth_required
|
||||
@validate_formkey
|
||||
def messagereply(v):
|
||||
|
||||
message = request.values.get("body", "").strip()[:1000].strip()
|
||||
|
@ -727,6 +734,7 @@ def u_username_info(username, v=None):
|
|||
@app.post("/follow/<username>")
|
||||
@limiter.limit("1/second")
|
||||
@auth_required
|
||||
@validate_formkey
|
||||
def follow_user(username, v):
|
||||
|
||||
target = get_user(username)
|
||||
|
@ -752,6 +760,7 @@ def follow_user(username, v):
|
|||
@app.post("/unfollow/<username>")
|
||||
@limiter.limit("1/second")
|
||||
@auth_required
|
||||
@validate_formkey
|
||||
def unfollow_user(username, v):
|
||||
|
||||
target = get_user(username)
|
||||
|
@ -778,6 +787,7 @@ def unfollow_user(username, v):
|
|||
@app.post("/remove_follow/<username>")
|
||||
@limiter.limit("1/second")
|
||||
@auth_required
|
||||
@validate_formkey
|
||||
def remove_follow(username, v):
|
||||
target = get_user(username)
|
||||
|
||||
|
@ -869,6 +879,7 @@ def saved_comments(v, username):
|
|||
|
||||
@app.post("/fp/<fp>")
|
||||
@auth_required
|
||||
@validate_formkey
|
||||
def fp(v, fp):
|
||||
if v.username != fp:
|
||||
v.fp = fp
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue