From 81bbd9a681397de0840b727f2c56fcdad7b30acf Mon Sep 17 00:00:00 2001 From: Aevann1 <59999695+Aevann1@users.noreply.github.com> Date: Fri, 10 Sep 2021 01:49:50 +0200 Subject: [PATCH 01/98] Update images.py --- files/helpers/images.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/files/helpers/images.py b/files/helpers/images.py index a811ea740..a4628c4cb 100644 --- a/files/helpers/images.py +++ b/files/helpers/images.py @@ -28,7 +28,7 @@ def upload_ibb(file, resize=False): om = next(frames) om.info = i.info - try: om.save(f"image.{om.format}", save_all=True, append_images=list(frames), loop=0, optimize=True, quality=30) + try: om.save(f"image.{i.format}", save_all=True, append_images=list(frames), loop=0, optimize=True, quality=30) except Exception as e: print(e) return @@ -63,11 +63,8 @@ def upload_imgur(file, resize=False): om = next(frames) om.info = i.info - try: om.save(f"image.{om.filename.split('.')[-1]}", save_all=True, append_images=list(frames), loop=0, optimize=True, quality=30) + try: om.save(f"image.{i.format}", save_all=True, append_images=list(frames), loop=0, optimize=True, quality=30) except Exception as e: - #print(om.filename) - print(type(om)) - print(om.format) print(e) return try: From 2d9f72bc9ec2bb51c03ab83b508f3616acf1bdbd Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 10 Sep 2021 03:44:17 +0200 Subject: [PATCH 02/98] fd --- files/routes/front.py | 51 ++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/files/routes/front.py b/files/routes/front.py index 8ebcf6059..7189a5197 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -65,32 +65,33 @@ def notifications(v): g.db.add(x) i += 1 - listing = [] - for c in comments: - c._is_blocked = False - c._is_blocking = False - if c.parent_submission and c.parent_comment and c.parent_comment.author_id == v.id: - c.replies = [] - while c.parent_comment and c.parent_comment.author_id == v.id: - parent = c.parent_comment - if c not in parent.replies2: - parent.replies2 = parent.replies2 + [c] - parent.replies = parent.replies2 - c = parent - if c not in listing: - listing.append(c) - c.replies = c.replies2 - elif c.parent_submission: - c.replies = [] - if c not in listing: - listing.append(c) - else: - if c.parent_comment: - while c.level > 1: - c = c.parent_comment + if not messages and not posts: + listing = [] + for c in comments: + c._is_blocked = False + c._is_blocking = False + if c.parent_submission and c.parent_comment and c.parent_comment.author_id == v.id: + c.replies = [] + while c.parent_comment and c.parent_comment.author_id == v.id: + parent = c.parent_comment + if c not in parent.replies2: + parent.replies2 = parent.replies2 + [c] + parent.replies = parent.replies2 + c = parent + if c not in listing: + listing.append(c) + c.replies = c.replies2 + elif c.parent_submission: + c.replies = [] + if c not in listing: + listing.append(c) + else: + if c.parent_comment: + while c.level > 1: + c = c.parent_comment - if c not in listing: - listing.append(c) + if c not in listing: + listing.append(c) return render_template("notifications.html", v=v, From 63aa3a052f00bd03c61906704d7ad2868e8942a5 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 10 Sep 2021 03:45:38 +0200 Subject: [PATCH 03/98] fd --- files/routes/front.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/routes/front.py b/files/routes/front.py index 5e9bc9d2c..14dded45a 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -31,7 +31,7 @@ def notifications(v): cids = v.notification_messages(page=page) next_exists = (len(cids) == 26) cids = cids[:25] - comments = get_comments(cids, v=v) + listing = get_comments(cids, v=v) elif posts: notifications = v.notifications.join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ACCOUNT).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(26) @@ -43,7 +43,7 @@ def notifications(v): g.db.add(x) comments.append(c) next_exists = (len(comments) == 26) - comments = comments[:25] + listing = comments[:25] else: notifications = v.notifications.join(Notification.comment).filter( Comment.is_banned == False, From 47e39a807ea9334ddddd655d7206d6330ec18ee2 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 10 Sep 2021 03:47:51 +0200 Subject: [PATCH 04/98] fd --- files/routes/front.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/files/routes/front.py b/files/routes/front.py index 14dded45a..efbdad049 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -31,9 +31,9 @@ def notifications(v): cids = v.notification_messages(page=page) next_exists = (len(cids) == 26) cids = cids[:25] - listing = get_comments(cids, v=v) + comments = get_comments(cids, v=v) elif posts: - notifications = v.notifications.join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ACCOUNT).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(26) + notifications = v.notifications.join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ACCOUNT).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(101) comments = [] for x in notifications: @@ -42,8 +42,8 @@ def notifications(v): x.read = True g.db.add(x) comments.append(c) - next_exists = (len(comments) == 26) - listing = comments[:25] + next_exists = (len(comments) == 101) + listing = comments[:100] else: notifications = v.notifications.join(Notification.comment).filter( Comment.is_banned == False, @@ -65,7 +65,7 @@ def notifications(v): g.db.add(x) i += 1 - if not messages and not posts: + if not posts: listing = [] for c in comments: c._is_blocked = False From 30736871ace0e23525114baa6bceb8215e06625f Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 10 Sep 2021 03:50:22 +0200 Subject: [PATCH 05/98] fd --- files/templates/comments.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/templates/comments.html b/files/templates/comments.html index 2ad6ad546..bfc56465c 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -432,9 +432,9 @@
  • Votes
  • {% if v %} -
  • Save
  • +
  • Save
  • -
  • Unsave
  • +
  • Unsave
  • {% endif %} From e32d42a6f7c31a6166736a9cd4afbda79ab29a84 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 10 Sep 2021 03:56:30 +0200 Subject: [PATCH 06/98] fd --- files/helpers/images.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/files/helpers/images.py b/files/helpers/images.py index a4628c4cb..6fb63c1e6 100644 --- a/files/helpers/images.py +++ b/files/helpers/images.py @@ -11,10 +11,9 @@ CF_ZONE = environ.get("CLOUDFLARE_ZONE", "").strip() IMGUR_KEY = environ.get("IMGUR_KEY", "").strip() IBB_KEY = environ.get("IBB_KEY", "").strip() -def upload_ibb(file, resize=False): - +def upload_ibb(filepath, resize=False): if resize: - i = IImage.open(file) + i = IImage.open(filepath) size = 100, 100 frames = ImageSequence.Iterator(i) @@ -28,12 +27,12 @@ def upload_ibb(file, resize=False): om = next(frames) om.info = i.info - try: om.save(f"image.{i.format}", save_all=True, append_images=list(frames), loop=0, optimize=True, quality=30) + try: om.save(filepath, save_all=True, append_images=list(frames), loop=0, optimize=True, quality=30) except Exception as e: print(e) return try: - with open(file, 'rb') as f: + with open(filepath, 'rb') as f: data={'image': base64.b64encode(f.read())} req = requests.post(f'https://api.imgbb.com/1/upload?key={IBB_KEY}', data=data) resp = req.json()['data'] @@ -46,10 +45,9 @@ def upload_ibb(file, resize=False): return(url) -def upload_imgur(file, resize=False): - +def upload_imgur(filepath, resize=False): if resize: - i = IImage.open(file) + i = IImage.open(filepath) size = 100, 100 frames = ImageSequence.Iterator(i) @@ -63,12 +61,12 @@ def upload_imgur(file, resize=False): om = next(frames) om.info = i.info - try: om.save(f"image.{i.format}", save_all=True, append_images=list(frames), loop=0, optimize=True, quality=30) + try: om.save(filepath, save_all=True, append_images=list(frames), loop=0, optimize=True, quality=30) except Exception as e: print(e) return try: - with open(file, 'rb') as f: + with open(filepath, 'rb') as f: data={'image': base64.b64encode(f.read())} req = requests.post('https://api.imgur.com/3/upload.json', headers = {"Authorization": f"Client-ID {IMGUR_KEY}"}, data=data) resp = req.json()['data'] From 17842318967b9829a2015abad5a5b98b640935cc Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 10 Sep 2021 04:01:36 +0200 Subject: [PATCH 07/98] gf --- files/templates/userpage.html | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/files/templates/userpage.html b/files/templates/userpage.html index f3e1b3a17..e1096841d 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -44,16 +44,18 @@ {% block desktopUserBanner %} + diff --git a/files/templates/formatting.html b/files/templates/formatting.html index 9164bcff2..705e26b0a 100644 --- a/files/templates/formatting.html +++ b/files/templates/formatting.html @@ -144,6 +144,6 @@ We also have some custom hooks for mentioning users and subreddits. Note that th {% include "expanded_image_modal.html" %} - + {% endblock %} diff --git a/files/templates/login.html b/files/templates/login.html index 885137e41..25837626f 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -130,7 +130,7 @@ {% include "bootstrap.html" %} - + diff --git a/files/templates/settings.html b/files/templates/settings.html index 6fccf5a5d..b5b43bebc 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -254,7 +254,7 @@ - + {% block onload %}{% endblock %} diff --git a/files/templates/settings2.html b/files/templates/settings2.html index 42ec62685..bc7e4c001 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -226,7 +226,7 @@ }); - + {% block scripts %} {% endblock %} diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index c28b08551..17140d28b 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -233,7 +233,7 @@ - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index 5d1b3bc51..58f31e357 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -144,7 +144,7 @@ - + diff --git a/files/templates/submit.html b/files/templates/submit.html index 4f0cf7a5e..900b8beb1 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -482,7 +482,7 @@ - + diff --git a/files/templates/userpage.html b/files/templates/userpage.html index e1096841d..1b3a19754 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -244,6 +244,7 @@ {% elif v and v.id == u.id %} Edit profile Profile views + Refresh Badges {% endif %} {% if v and v.id != u.id and v.admin_level > 1 %}

    @@ -445,8 +446,8 @@ {% if v and v.id == u.id %} Edit profile - Profile views - {% endif %} + Refresh Badges + {% endif %} {% if v and v.id != u.id %} Unfollow Follow From 838e1d87e79878fd833de6b809d187622314e09f Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 10 Sep 2021 06:35:43 +0200 Subject: [PATCH 59/98] gf --- files/templates/header.html | 4 ++-- files/templates/userpage_private.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/files/templates/header.html b/files/templates/header.html index 6955dd13b..882581002 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -130,7 +130,7 @@
    @@ -190,7 +190,7 @@ {% else %}