From 4e01e30eb115c76df2a9a3b88af4574087303aaa Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 24 Jul 2022 04:00:02 +0000 Subject: [PATCH 01/10] sneed --- site_settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site_settings.json b/site_settings.json index cb3998b89b..999c2c0f46 100644 --- a/site_settings.json +++ b/site_settings.json @@ -1 +1 @@ -{"Bots": true, "Fart mode": false, "Read-only mode": false, "Signups": true} +{"Bots": true, "Fart mode": false, "Read-only mode": false, "Signups": false} \ No newline at end of file From f3c00fb5c731212001d80ff08f9ff5ee5ce8e9e7 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 24 Jul 2022 05:00:02 +0000 Subject: [PATCH 02/10] sneed --- site_settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site_settings.json b/site_settings.json index 999c2c0f46..3cfdf6fd56 100644 --- a/site_settings.json +++ b/site_settings.json @@ -1 +1 @@ -{"Bots": true, "Fart mode": false, "Read-only mode": false, "Signups": false} \ No newline at end of file +{"Bots": true, "Fart mode": false, "Read-only mode": false, "Signups": true} \ No newline at end of file From 8d547487b202d40828bd74fa31cbbd346c9d410e Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 24 Jul 2022 07:00:02 +0000 Subject: [PATCH 03/10] sneed --- site_settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site_settings.json b/site_settings.json index 3cfdf6fd56..999c2c0f46 100644 --- a/site_settings.json +++ b/site_settings.json @@ -1 +1 @@ -{"Bots": true, "Fart mode": false, "Read-only mode": false, "Signups": true} \ No newline at end of file +{"Bots": true, "Fart mode": false, "Read-only mode": false, "Signups": false} \ No newline at end of file From b539166bf101c6f3eb093670ab39595fa4c7eb30 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 24 Jul 2022 15:00:02 +0000 Subject: [PATCH 04/10] sneed --- site_settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site_settings.json b/site_settings.json index 999c2c0f46..3cfdf6fd56 100644 --- a/site_settings.json +++ b/site_settings.json @@ -1 +1 @@ -{"Bots": true, "Fart mode": false, "Read-only mode": false, "Signups": false} \ No newline at end of file +{"Bots": true, "Fart mode": false, "Read-only mode": false, "Signups": true} \ No newline at end of file From 856f155b4138c40efeb31b1cbf628abee8115958 Mon Sep 17 00:00:00 2001 From: DrTransmisia <95589613+DrTransmisia@users.noreply.github.com> Date: Sun, 24 Jul 2022 17:03:19 +0200 Subject: [PATCH 05/10] Errorcodejihad (#323) * formatmaxxing brained formatting * formatmaxxing brained formatting: EPISODE 2 * Start implementing a .json interface for all logged users reddit-like PROs: - easier to debugmaxx applications - good faith actors can scrap the site more easly :gigachadglow: CONs: - bad faith actors can scrap the site more easly :gigachadglow: - jannitors lose a little of their power of allowlisting applications (they do it for free though) anyways. I make this commit a separate commit so that Snakes can esclude it from the PR if he doesn't like it (cringe) * //comments route now returns appropriate [citation needed] HTTP codes when called in JSON mode so that stupid JSON clients can crashmaxx * More error codes (sorry I don't know how to squash) * json endpoint. see other commit. I don't know how to squash --- files/routes/users.py | 63 ++++++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/files/routes/users.py b/files/routes/users.py index eec72cd9f6..71a5493f5f 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -902,12 +902,16 @@ def visitors(v): @app.get("/@") +@app.get("/@.json") @app.get("/logged_out/@") @auth_desired def u_username(username, v=None): - if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path.rstrip('?')}") - if v and request.path.startswith('/logged_out'): return redirect(request.full_path.replace('/logged_out','').rstrip('?')) + if not v and not request.path.startswith('/logged_out'): + return redirect(f"/logged_out{request.full_path.rstrip('?')}") + + if v and request.path.startswith('/logged_out'): + return redirect(request.full_path.replace('/logged_out','').rstrip('?')) u = get_user(username, v=v, rendered=True) @@ -921,7 +925,9 @@ def u_username(username, v=None): return redirect(SITE_FULL + request.full_path.replace(username, u.username)[:-1]) if u.reserved: - if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": f"That username is reserved for: {u.reserved}"} + if request.headers.get("Authorization") or request.headers.get("xhr") or request.path.endswith(".json"): + return {"error": f"That username is reserved for: {u.reserved}"}, 418 + return render_template("userpage_reserved.html", u=u, v=v) if u.shadowbanned and not (v and v.admin_level >= 2) and not (v and v.id == u.id): @@ -937,17 +943,23 @@ 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 request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "That userpage is private"} + if request.headers.get("Authorization") or request.headers.get("xhr") or request.path.endswith(".json"): + return {"error": "That userpage is private"}, 403 + return render_template("userpage_private.html", 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}."} + if request.headers.get("Authorization") or request.headers.get("xhr") or request.path.endswith(".json"): + return {"error": f"You are blocking @{u.username}."}, 403 + return render_template("userpage_blocking.html", u=u, v=v) if v and v.admin_level < 2 and hasattr(u, 'is_blocked') and u.is_blocked: - if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "This person is blocking you."} + if request.headers.get("Authorization") or request.headers.get("xhr") or request.path.endswith(".json"): + return {"error": "This person is blocking you."}, 403 + return render_template("userpage_blocked.html", u=u, v=v) @@ -971,7 +983,9 @@ def u_username(username, v=None): listing = get_posts(ids, v=v) if u.unban_utc: - if request.headers.get("Authorization"): {"data": [x.json for x in listing]} + if request.headers.get("Authorization") or request.path.endswith(".json"): + return {"data": [x.json for x in listing]} + return render_template("userpage.html", unban=u.unban_string, u=u, @@ -985,7 +999,9 @@ def u_username(username, v=None): - if request.headers.get("Authorization"): return {"data": [x.json for x in listing]} + if request.headers.get("Authorization") or request.path.endswith(".json"): + return {"data": [x.json for x in listing]} + return render_template("userpage.html", u=u, v=v, @@ -998,12 +1014,16 @@ def u_username(username, v=None): @app.get("/@/comments") +@app.get("/@/comments.json") @app.get("/logged_out/@/comments") @auth_desired def u_username_comments(username, v=None): - if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path.rstrip('?')}") - if v and request.path.startswith('/logged_out'): return redirect(request.full_path.replace('/logged_out','').rstrip('?')) + if not v and not request.path.startswith('/logged_out'): + return redirect(f"/logged_out{request.full_path.rstrip('?')}") + + if v and request.path.startswith('/logged_out'): + return redirect(request.full_path.replace('/logged_out','').rstrip('?')) user = get_user(username, v=v, rendered=True) @@ -1012,27 +1032,30 @@ def u_username_comments(username, v=None): else: is_following = (v and user.has_follower(v)) - if username != user.username: return redirect(f'/@{user.username}/comments') + if username != user.username: + return redirect(f'/@{user.username}/comments') u = user if u.reserved: - if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": f"That username is reserved for: {u.reserved}"} - return render_template("userpage_reserved.html", - u=u, - v=v) + if request.headers.get("Authorization") or request.headers.get("xhr") or request.path.endswith(".json"): + return {"error": f"That username is reserved for: {u.reserved}"}, 418 + return render_template("userpage_reserved.html", u=u, v=v) if u.is_private and (not v or (v.id != u.id and v.admin_level < 2 and not v.eye)): - if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "That userpage is private"} + if request.headers.get("Authorization") or request.headers.get("xhr") or request.path.endswith(".json"): + return {"error": "That userpage is private"}, 403 return render_template("userpage_private.html", 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}."} + if request.headers.get("Authorization") or request.headers.get("xhr") or request.path.endswith(".json"): + return {"error": f"You are blocking @{u.username}."}, 403 return render_template("userpage_blocking.html", u=u, v=v) if v and v.admin_level < 2 and hasattr(u, 'is_blocked') and u.is_blocked: - if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "This person is blocking you."} + if request.headers.get("Authorization") or request.headers.get("xhr") or request.path.endswith(".json"): + return {"error": "This person is blocking you."}, 403 return render_template("userpage_blocked.html", u=u, v=v) @@ -1063,7 +1086,9 @@ def u_username_comments(username, v=None): listing = get_comments(ids, v=v) - if request.headers.get("Authorization"): return {"data": [c.json for c in listing]} + if request.headers.get("Authorization") or request.path.endswith(".json"): + return {"data": [c.json for c in listing]} + return render_template("userpage_comments.html", u=user, v=v, listing=listing, page=page, sort=sort, t=t,next_exists=next_exists, is_following=is_following, standalone=True) From 1c14722f06554814748f3e03f9da1aac1827c5e0 Mon Sep 17 00:00:00 2001 From: TLSM Date: Sun, 24 Jul 2022 16:23:21 -0400 Subject: [PATCH 06/10] Restyle glow award links for visibility. At present, we typically distinguish links from other text by coloring them, underlining on hover, and changing cursor to pointer on hover. However, when a post is glow-awarded, both color and underline-on-hover are suppressed, making links very hard to find in text. Given chiobu's tendency to glow award effortposts, this can make posts hard to read. My solution is to always show links as underlined in glow-awarded posts and comments. Not terribly attached to this particular approach, but it seems to undermine the award effect the least while largely restoring accessibility of links. --- files/assets/css/main.css | 4 ++++ files/templates/util/assetcache.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/files/assets/css/main.css b/files/assets/css/main.css index 6b7728096f..38cf4334e4 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -5316,6 +5316,10 @@ th, td { color: lightgreen; } +.glow .post-body a, .glow .comment-text a { + text-decoration: underline; +} + .text-green { color: green !important; } diff --git a/files/templates/util/assetcache.html b/files/templates/util/assetcache.html index 64d50a3834..31a9e62173 100644 --- a/files/templates/util/assetcache.html +++ b/files/templates/util/assetcache.html @@ -1,6 +1,6 @@ {%- set CACHE_VER = { - 'css/main.css': 428, + 'css/main.css': 429, 'css/catalog.css': 2, 'css/4chan.css': 61, From 80e5010ba25b999639a7d847f18da2d9568af24f Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 25 Jul 2022 03:00:02 +0000 Subject: [PATCH 07/10] sneed --- site_settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site_settings.json b/site_settings.json index 3cfdf6fd56..999c2c0f46 100644 --- a/site_settings.json +++ b/site_settings.json @@ -1 +1 @@ -{"Bots": true, "Fart mode": false, "Read-only mode": false, "Signups": true} \ No newline at end of file +{"Bots": true, "Fart mode": false, "Read-only mode": false, "Signups": false} \ No newline at end of file From dc0d78aa9ec503899de1682f5ad54a99682b5ef3 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 25 Jul 2022 23:00:02 +0000 Subject: [PATCH 08/10] sneed --- site_settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site_settings.json b/site_settings.json index 999c2c0f46..3cfdf6fd56 100644 --- a/site_settings.json +++ b/site_settings.json @@ -1 +1 @@ -{"Bots": true, "Fart mode": false, "Read-only mode": false, "Signups": false} \ No newline at end of file +{"Bots": true, "Fart mode": false, "Read-only mode": false, "Signups": true} \ No newline at end of file From baa17db4eaab0a87a7ac83d02451b7d07842b914 Mon Sep 17 00:00:00 2001 From: gooseman <16601315+geese-suck@users.noreply.github.com> Date: Tue, 26 Jul 2022 16:01:59 -0700 Subject: [PATCH 09/10] unicode and its consequences i hate fun --- files/assets/css/main.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/assets/css/main.css b/files/assets/css/main.css index 38cf4334e4..10077ae6b2 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -6154,4 +6154,8 @@ g { background-clip: text; -webkit-background-clip: text; font-weight: 700; -} \ No newline at end of file +} + +.user-info { + overflow: hidden; +} From 4dfa7206b6dee726a9f8f5964ea5a5581f2604e2 Mon Sep 17 00:00:00 2001 From: gooseman <16601315+geese-suck@users.noreply.github.com> Date: Tue, 26 Jul 2022 16:02:30 -0700 Subject: [PATCH 10/10] le cachebust --- files/templates/util/assetcache.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/util/assetcache.html b/files/templates/util/assetcache.html index 31a9e62173..c95787096a 100644 --- a/files/templates/util/assetcache.html +++ b/files/templates/util/assetcache.html @@ -1,6 +1,6 @@ {%- set CACHE_VER = { - 'css/main.css': 429, + 'css/main.css': 430, 'css/catalog.css': 2, 'css/4chan.css': 61,