diff --git a/files/classes/user.py b/files/classes/user.py index 5de8565da..d01dd7cc9 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -70,10 +70,6 @@ class User(Base): comment_count = Column(Integer, default=0) received_award_count = Column(Integer, default=0) created_utc = Column(Integer) - rent_utc = Column(Integer, default=0) - steal_utc = Column(Integer, default=0) - fail_utc = Column(Integer, default=0) - fail2_utc = Column(Integer, default=0) admin_level = Column(Integer, default=0) coins_spent = Column(Integer, default=0) lootboxes_bought = Column(Integer, default=0) diff --git a/files/routes/users.py b/files/routes/users.py index 061b3ed21..f8e4bbd0d 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -180,74 +180,6 @@ def downvoting(v, username): return render_template("voters.html", v=v, users=users[:25], pos=pos, name='Down', name2=f'Who @{username} hates') -@app.post("/pay_rent") -@limiter.limit("1/second;30/minute;200/hour;1000/day") -@auth_required -def pay_rent(v): - if v.coins < 500: return {"error":"You must have more than 500 coins."} - v.coins -= 500 - v.rent_utc = int(time.time()) - g.db.add(v) - u = get_account(253) - u.coins += 500 - g.db.add(u) - send_repeatable_notification(u.id, f"@{v.username} has paid rent!") - g.db.commit() - return {"message": "Rent paid!"} - - -@app.post("/steal") -@limiter.limit("1/second;30/minute;200/hour;1000/day") -@auth_required -def steal(v): - if int(time.time()) - v.created_utc < 604800: - return {"error":"You must have an account older than 1 week in order to attempt stealing."} - if v.coins < 5000: - return {"error":"You must have more than 5000 coins in order to attempt stealing."} - u = get_account(253) - if random.randint(1, 10) < 5: - v.coins += 700 - v.steal_utc = int(time.time()) - g.db.add(v) - u.coins -= 700 - g.db.add(u) - send_repeatable_notification(u.id, f"Some [grubby little rentoid](/@{v.username}) has absconded with 700 of your hard-earned coins to fuel his Funko Pop addiction. Stop being so trusting.") - send_repeatable_notification(v.id, "You have successfully shorted your heroic landlord 700 coins in rent. You're slightly less materially poor, but somehow even moreso morally. Are you proud of yourself?") - g.db.commit() - return {"message": "Attempt successful!"} - - else: - if random.random() < 0.15: - send_repeatable_notification(u.id, f"You caught [this sniveling little renthog](/@{v.username}) trying to rob you. After beating him within an inch of his life, you sold his Nintendo Switch for 500 coins and called the cops. He was sentenced to one (1) day in renthog prison.") - send_repeatable_notification(v.id, "The ever-vigilant landchad has caught you trying to steal his hard-earned rent money. The police take you away and laugh as you impotently stutter A-ACAB :sob: You are fined 500 coins and sentenced to one (1) day in renthog prison.") - v.ban(days=1, reason="Jailed thief") - v.fail_utc = int(time.time()) - else: - send_repeatable_notification(u.id, f"You caught [this sniveling little renthog](/@{v.username}) trying to rob you. After beating him within an inch of his life, you showed mercy in exchange for a 500 coin tip. This time.") - send_repeatable_notification(v.id, "The ever-vigilant landchad has caught you trying to steal his hard-earned rent money. You were able to convince him to spare your life with a 500 coin tip. This time.") - v.fail2_utc = int(time.time()) - v.coins -= 500 - g.db.add(v) - u.coins += 500 - g.db.add(u) - g.db.commit() - return {"message": "Attempt failed!"} - - -@app.get("/rentoids") -@auth_required -def rentoids(v): - users = g.db.query(User).filter(User.rent_utc > 0).all() - return render_template("rentoids.html", v=v, users=users) - - -@app.get("/thiefs") -@auth_required -def thiefs(v): - successful = g.db.query(User).filter(User.steal_utc > 0).all() - failed = g.db.query(User).filter(User.fail_utc > 0).all() - failed2 = g.db.query(User).filter(User.fail2_utc > 0).all() - return render_template("thiefs.html", v=v, successful=successful, failed=failed, failed2=failed2) @app.post("/@/suicide") @@ -708,14 +640,8 @@ def u_username(username, v=None): if u.is_private and (not v or (v.id != u.id and v.admin_level < 2 and not v.eye)): - - if v and u.id == LLM_ID: - if int(time.time()) - v.rent_utc > 600: - if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "That userpage is private"} - return render_template("userpage_private.html", time=int(time.time()), u=u, v=v) - else: - if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "That userpage is private"} - return render_template("userpage_private.html", time=int(time.time()), u=u, v=v) + if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "That userpage is private"} + return render_template("userpage_private.html", time=int(time.time()), u=u, v=v) if v and hasattr(u, 'is_blocking') and u.is_blocking: @@ -798,13 +724,8 @@ def u_username_comments(username, v=None): if u.is_private and (not v or (v.id != u.id and v.admin_level < 2 and not v.eye)): - if v and u.id == LLM_ID: - if int(time.time()) - v.rent_utc > 600: - if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "That userpage is private"} - return render_template("userpage_private.html", time=int(time.time()), u=u, v=v) - else: - if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "That userpage is private"} - return render_template("userpage_private.html", time=int(time.time()), u=u, v=v) + if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "That userpage is private"} + return render_template("userpage_private.html", time=int(time.time()), u=u, v=v) if v and hasattr(u, 'is_blocking') and u.is_blocking: if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": f"You are blocking @{u.username}."} diff --git a/files/templates/rentoids.html b/files/templates/rentoids.html deleted file mode 100644 index b4a8e663c..000000000 --- a/files/templates/rentoids.html +++ /dev/null @@ -1,21 +0,0 @@ -{% extends "default.html" %} -{% block content %} -

-
Rentoids
-

-
- - - - - - -{% for user in users %} - - - - -{% endfor %} -
#Name
{{loop.index}}{{user.username}}
- -{% endblock %} \ No newline at end of file diff --git a/files/templates/thiefs.html b/files/templates/thiefs.html deleted file mode 100644 index 2fa107f44..000000000 --- a/files/templates/thiefs.html +++ /dev/null @@ -1,57 +0,0 @@ -{% extends "default.html" %} -{% block content %} -

-
Successful thiefs
-

-
- - - - - - -{% for user in successful %} - - - - -{% endfor %} -
#Name
{{loop.index}}{{user.username}}
- -

-
Evicted thiefs
-

-
- - - - - - -{% for user in failed2 %} - - - - -{% endfor %} -
#Name
{{loop.index}}{{user.username}}
- -

-
Jailed thiefs
-

-
- - - - - - -{% for user in failed %} - - - - -{% endfor %} -
#Name
{{loop.index}}{{user.username}}
- -{% endblock %} \ No newline at end of file diff --git a/schema.sql b/schema.sql index 60ba60d8b..b1e35c2b4 100644 --- a/schema.sql +++ b/schema.sql @@ -601,14 +601,10 @@ CREATE TABLE public.users ( post_count integer DEFAULT 0 NOT NULL, comment_count integer DEFAULT 0 NOT NULL, highres character varying(60), - rent_utc integer DEFAULT 0 NOT NULL, patron integer DEFAULT 0 NOT NULL, controversial boolean DEFAULT false NOT NULL, background character varying(20), verified character varying(20), - fail_utc integer DEFAULT 0 NOT NULL, - steal_utc integer DEFAULT 0 NOT NULL, - fail2_utc integer DEFAULT 0 NOT NULL, cardview boolean NOT NULL, received_award_count integer DEFAULT 0 NOT NULL, highlightcomments boolean DEFAULT true NOT NULL,