From 4b753197140c87b53c0b865fcffe7a088639c3d5 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 28 Dec 2021 08:28:18 +0200 Subject: [PATCH] fdsfds --- files/__main__.py | 12 +- files/routes/comments.py | 8 +- files/routes/login.py | 2 +- files/routes/posts.py | 8 +- files/templates/award_modal.html | 7 +- files/templates/submission.html | 14 +- files/templates/submission_listing.html | 683 +----------------- .../templates/submission_listing_desktop.html | 490 +++++++++++++ .../templates/submission_listing_mobile.html | 554 ++++++++++++++ 9 files changed, 1072 insertions(+), 706 deletions(-) create mode 100644 files/templates/submission_listing_desktop.html create mode 100644 files/templates/submission_listing_mobile.html diff --git a/files/__main__.py b/files/__main__.py index 550bfb785..f999ea96c 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -101,13 +101,11 @@ def before_request(): url = request.url.replace("http://", "https://", 1) return redirect(url, code=301) - ua=request.headers.get("User-Agent","") - if "CriOS/" in ua: g.system="ios/chrome" - elif "Version/" in ua: g.system="android/webview" - elif "Mobile Safari/" in ua: g.system="android/chrome" - elif "Safari/" in ua: g.system="ios/safari" - elif "Mobile/" in ua: g.system="ios/webview" - else: g.system="other/other" + g.system = 'desktop' + ua = request.headers.get("User-Agent","") + + for i in ('Version','Android','webOS','iPhone','iPad','iPod','BlackBerry','IEMobile','Opera Mini','Mobile','mobile','CriOS'): + if i in ua: g.system = 'mobile' @app.teardown_appcontext def teardown_request(error): diff --git a/files/routes/comments.py b/files/routes/comments.py index 993952f77..d02efb0b4 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -361,7 +361,7 @@ def api_comment(v): - c_jannied = Comment(author_id=AUTOJANNY_ID, + c_jannied = Comment(author_id=NOTIFICATIONS_ID, parent_submission=parent_submission, distinguish_level=6, parent_comment_id=c.id, @@ -394,7 +394,7 @@ def api_comment(v): - c_jannied = Comment(author_id=AUTOJANNY_ID, + c_jannied = Comment(author_id=NOTIFICATIONS_ID, parent_submission=parent_submission, distinguish_level=6, parent_comment_id=c.id, @@ -743,7 +743,7 @@ def edit_comment(cid, v): - c_jannied = Comment(author_id=AUTOJANNY_ID, + c_jannied = Comment(author_id=NOTIFICATIONS_ID, parent_submission=c.parent_submission, distinguish_level=6, parent_comment_id=c.id, @@ -777,7 +777,7 @@ def edit_comment(cid, v): - c_jannied = Comment(author_id=AUTOJANNY_ID, + c_jannied = Comment(author_id=NOTIFICATIONS_ID, parent_submission=c.parent_submission, distinguish_level=6, parent_comment_id=c.id, diff --git a/files/routes/login.py b/files/routes/login.py index 2b41a0692..469a1ada5 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -311,7 +311,7 @@ def sign_up_post(v): id_1 = g.db.query(User.id).filter_by(id=7).count() users_count = g.db.query(User.id).count() - if id_1 == 0 and users_count < 7: admin_level=3 + if id_1 == 0 and users_count == 7: admin_level=3 else: admin_level=0 new_user = User( diff --git a/files/routes/posts.py b/files/routes/posts.py index 3691e5d23..4d2078b0c 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -508,7 +508,7 @@ def edit_post(pid, v): body_jannied_html = sanitize(body_md) - c_jannied = Comment(author_id=AUTOJANNY_ID, + c_jannied = Comment(author_id=NOTIFICATIONS_ID, parent_submission=p.id, level=1, over_18=False, @@ -540,7 +540,7 @@ def edit_post(pid, v): body_jannied_html = sanitize(body_md) - c_jannied = Comment(author_id=AUTOJANNY_ID, + c_jannied = Comment(author_id=NOTIFICATIONS_ID, parent_submission=p.id, level=1, over_18=False, @@ -1080,7 +1080,7 @@ def submit_post(v): body_jannied_html = sanitize(body_md) - c_jannied = Comment(author_id=AUTOJANNY_ID, + c_jannied = Comment(author_id=NOTIFICATIONS_ID, parent_submission=new_post.id, level=1, over_18=False, @@ -1112,7 +1112,7 @@ def submit_post(v): - c_jannied = Comment(author_id=AUTOJANNY_ID, + c_jannied = Comment(author_id=NOTIFICATIONS_ID, parent_submission=new_post.id, level=1, over_18=False, diff --git a/files/templates/award_modal.html b/files/templates/award_modal.html index 9d432c607..6f7100a38 100644 --- a/files/templates/award_modal.html +++ b/files/templates/award_modal.html @@ -23,11 +23,6 @@
{{award.owned}} owned
{% endfor %} - - -
 
-
 
-
@@ -72,7 +67,7 @@ } .award-columns { - column-count: 2; + column-count: 1; } @media (min-width: 767.98px) { diff --git a/files/templates/submission.html b/files/templates/submission.html index 3d4602588..0bf6e6438 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -203,8 +203,10 @@ {% endif %} - - + {% if request.path.startswith('/@') %} + + + {% endif %} {% if p.deleted_utc > 0 %} @@ -534,9 +536,11 @@ {% endif %} {% if v and v.id==p.author_id %} - Pin to profile - Unpin from profile - + {% if request.path.startswith('/@') %} + Pin to profile + Unpin from profile + {% endif %} + {% if p.deleted_utc > 0 %} Undelete {% else %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 1c468ebaf..f49f467e1 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -1,680 +1,5 @@ -{% if v %} - {% include "award_modal.html" %} -{% endif %} - -{% if request.host == 'pcmemes.net' %} - {% set cc='SPLASH MOUNTAIN' %} +{% if g.system == 'mobile' %} + {% include "submission_listing_mobile.html" %} {% else %} - {% set cc='COUNTRY CLUB' %} -{% endif %} - -{% if not v or v.highlightcomments %} - -{% endif %} - - - - - -{% for p in listing %} - - - -{% set ups=p.upvotes %} -{% set downs=p.downvotes %} -{% set score=ups-downs %} - -{% if v %} - {% set voted= p.voted %} -{% else %} - {% set voted=-2 %} -{% endif %} - -{% if p.active_flags %} -
- Reported by: -

-		
-	
-{% endif %} - -
- -
- - {% if not postembed %} -
- {% if v and request.path.startswith('/@') and not v.admin_level %} - - {% if voted==1 %} -
- {% endif %} - - {{score}} - - {% if voted==-1 %} -
- {% endif %} - - {% elif v %} - -
- - {{score}} - -
- - {% else %} - -
- - {{score}} - -
- - {% endif %} - -
- {% endif %} - -
- -
- {% if p.club and not (v and (v.paid_dues or v.id == p.author_id)) %} - post thumnail - {% elif not p.url %} - - post thumnail - - {% elif p.is_image %} - - post thumnail - - {% elif (p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm'))) or (p.embed_url and "youtu" in p.domain) or (p.url and "streamable.com/e/" in p.url) %} - - post thumnail - - {% else %} - - post thumnail - - {% endif %} -
- - -
- - -
- - - -
- {% if p.club %}{{cc}}{% endif %} - {% if p.flair %}{{p.flair | safe}}{% endif %} - {{p.realtitle(v) | safe}} -
- -
- -
-
-
- - - -{% if v %} - -{% endif %} - -{% if v and v.admin_level > 1 %} - -{% endif %} - - - - - - -
- -{% if not p.club or v and (v.paid_dues or v.id == p.author_id) %} - {% if p.realbody(v) %} -
- {{p.realbody(v) | safe}} - - {% if p.author.sig_html and (p.author_id == 1904 or not (v and v.sigs_disabled)) %} -
- {{p.author.sig_html | safe}} - {% endif %} -
- {% endif %} - - {% if p.is_image and not p.over_18 and ((v and v.cardview) or (not v and environ.get('CARD_VIEW') == '1')) %} -
- - Unable to load image - -
- {% elif p.is_video %} -
- -
- {% elif p.embed_url and p.domain in ['youtu.be','youtube.com'] and p.embed_url.startswith(' - {{p.embed_url | safe}} - - {% endif %} -{% endif %} - -{% else %} - -{% if request.path.endswith('/admin/queue') %} - -
-
-
-
This queue is empty. (That's a good thing.)
-
-
-
- - -{% elif u %} -{% if v and v.id == u.id %} -
-
-
- - - - -

You haven't {% if "saved" in request.full_path %}saved{% else %}made{% endif %} a post yet

-

Your {% if "saved" in request.full_path %}saved posts{% else %}posting history{% endif %} will show here.

- {% if "saved" not in request.full_path %}Create a post{% endif %} -
-
-
- - -{% else %} -
-
-
- - - - -

@{{u.username}} hasn't made a post yet

-

Their posting history will show here.

-
-			
-
-
-
-{% endif %} - -{% else %} -
-
-
- - - - -

There are no posts here.

-
-
-
- - -{% endif %} - -{% endfor %} - -{% if v %} - {% include "delete_post_modal.html" %} - {% include "report_post_modal.html" %} - {% if v.admin_level > 1 %} - {% include "ban_modal.html" %} - {% endif %} -{% endif %} -{% include "expanded_image_modal.html" %} - - - - - - \ No newline at end of file + {% include "submission_listing_desktop.html" %} +{% endif %} \ No newline at end of file diff --git a/files/templates/submission_listing_desktop.html b/files/templates/submission_listing_desktop.html new file mode 100644 index 000000000..c2e0813b6 --- /dev/null +++ b/files/templates/submission_listing_desktop.html @@ -0,0 +1,490 @@ + +{% if v %} +{% include "award_modal.html" %} +{% endif %} + +{% if request.host == 'pcmemes.net' %} +{% set cc='SPLASH MOUNTAIN' %} +{% else %} +{% set cc='COUNTRY CLUB' %} +{% endif %} + +{% if not v or v.highlightcomments %} + +{% endif %} + + + + + +{% for p in listing %} + + + +{% set ups=p.upvotes %} +{% set downs=p.downvotes %} +{% set score=ups-downs %} + +{% if v %} +{% set voted= p.voted %} +{% else %} +{% set voted=-2 %} +{% endif %} + +{% if p.active_flags %} +
+ Reported by: +

+    
    + {% for f in p.ordered_flags %} +
  • {{f.user.username}}{% if f.reason %}: {{f.realreason(v) | safe}}{% endif %} {% if v and v.admin_level > 1 %}[remove]{% endif %}
  • + {% endfor %} +
+
+{% endif %} + +
+ +
+ + {% if not postembed %} +
+ {% if v and request.path.startswith('/@') and not v.admin_level %} + + {% if voted==1 %} +
+ {% endif %} + + {{score}} + + {% if voted==-1 %} +
+ {% endif %} + + {% elif v %} + +
+ + {{score}} + +
+ + {% else %} + +
+ + {{score}} + +
+ + {% endif %} + +
+ {% endif %} + +
+ +
+ {% if p.club and not (v and (v.paid_dues or v.id == p.author_id)) %} + post thumnail + {% elif not p.url %} + + post thumnail + + {% elif p.is_image %} + + post thumnail + + {% elif (p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm'))) or (p.embed_url and "youtu" in p.domain) or (p.url and "streamable.com/e/" in p.url) %} + + post thumnail + + {% else %} + + post thumnail + + {% endif %} +
+ + +
+ + +
+ + + +
+ {% if p.club %}{{cc}}{% endif %} + {% if p.flair %}{{p.flair | safe}}{% endif %} + {{p.realtitle(v) | safe}} +
+ +
+ +
+
+
+ +
+ +{% if not p.club or v and (v.paid_dues or v.id == p.author_id) %} +{% if p.realbody(v) %} +
+ {{p.realbody(v) | safe}} + + {% if p.author.sig_html and (p.author_id == 1904 or not (v and v.sigs_disabled)) %} +
+ {{p.author.sig_html | safe}} + {% endif %} +
+{% endif %} + +{% if p.is_image and not p.over_18 and ((v and v.cardview) or (not v and environ.get('CARD_VIEW') == '1')) %} +
+ + Unable to load image + +
+{% elif p.is_video %} +
+ +
+{% elif p.embed_url and p.domain in ['youtu.be','youtube.com'] and p.embed_url.startswith(' + {{p.embed_url | safe}} + +{% endif %} +{% endif %} + +{% else %} + +{% if request.path.endswith('/admin/queue') %} + +
+
+
+
This queue is empty. (That's a good thing.)
+
+
+
+ + +{% elif u %} +{% if v and v.id == u.id %} +
+
+
+ + + + +

You haven't {% if "saved" in request.full_path %}saved{% else %}made{% endif %} a post yet

+

Your {% if "saved" in request.full_path %}saved posts{% else %}posting history{% endif %} will show here.

+ {% if "saved" not in request.full_path %}Create a post{% endif %} +
+
+
+ + +{% else %} +
+
+
+ + + + +

@{{u.username}} hasn't made a post yet

+

Their posting history will show here.

+
+        
+
+
+
+{% endif %} + +{% else %} +
+
+
+ + + + +

There are no posts here.

+
+
+
+ + +{% endif %} + +{% endfor %} + +{% if v %} +{% include "delete_post_modal.html" %} +{% include "report_post_modal.html" %} +{% if v.admin_level > 1 %} + {% include "ban_modal.html" %} +{% endif %} +{% endif %} +{% include "expanded_image_modal.html" %} + + + + + + \ No newline at end of file diff --git a/files/templates/submission_listing_mobile.html b/files/templates/submission_listing_mobile.html new file mode 100644 index 000000000..6c1dc4fad --- /dev/null +++ b/files/templates/submission_listing_mobile.html @@ -0,0 +1,554 @@ +{% if v %} + {% include "award_modal.html" %} +{% endif %} + +{% if request.host == 'pcmemes.net' %} + {% set cc='SPLASH MOUNTAIN' %} +{% else %} + {% set cc='COUNTRY CLUB' %} +{% endif %} + +{% if not v or v.highlightcomments %} + +{% endif %} + + + + + +{% for p in listing %} + + + +{% set ups=p.upvotes %} +{% set downs=p.downvotes %} +{% set score=ups-downs %} + +{% if v %} + {% set voted= p.voted %} +{% else %} + {% set voted=-2 %} +{% endif %} + +{% if p.active_flags %} +
+ Reported by: +

+		
    + {% for f in p.ordered_flags %} +
  • {{f.user.username}}{% if f.reason %}: {{f.realreason(v) | safe}}{% endif %} {% if v and v.admin_level > 1 %}[remove]{% endif %}
  • + {% endfor %} +
+
+{% endif %} + +
+ +
+ +
+ +
+ {% if p.club and not (v and (v.paid_dues or v.id == p.author_id)) %} + post thumnail + {% elif not p.url %} + + post thumnail + + {% elif p.is_image %} + + post thumnail + + {% elif (p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm'))) or (p.embed_url and "youtu" in p.domain) or (p.url and "streamable.com/e/" in p.url) %} + + post thumnail + + {% else %} + + post thumnail + + {% endif %} +
+ + +
+ + +
+ + + +
+ {% if p.club %}{{cc}}{% endif %} + {% if p.flair %}{{p.flair | safe}}{% endif %} + {{p.realtitle(v) | safe}} +
+
+
+ + + +{% if v %} + +{% endif %} + +{% if v and v.admin_level > 1 %} + +{% endif %} + + + + + + +
+ +{% if not p.club or v and (v.paid_dues or v.id == p.author_id) %} + {% if p.realbody(v) %} +
+ {{p.realbody(v) | safe}} + + {% if p.author.sig_html and (p.author_id == 1904 or not (v and v.sigs_disabled)) %} +
+ {{p.author.sig_html | safe}} + {% endif %} +
+ {% endif %} + + {% if p.is_image and not p.over_18 and ((v and v.cardview) or (not v and environ.get('CARD_VIEW') == '1')) %} +
+ + Unable to load image + +
+ {% elif p.is_video %} +
+ +
+ {% elif p.embed_url and p.domain in ['youtu.be','youtube.com'] and p.embed_url.startswith(' + {{p.embed_url | safe}} + + {% endif %} +{% endif %} + +{% else %} + +{% if request.path.endswith('/admin/queue') %} + +
+
+
+
This queue is empty. (That's a good thing.)
+
+
+
+ + +{% elif u %} +{% if v and v.id == u.id %} +
+
+
+ + + + +

You haven't {% if "saved" in request.full_path %}saved{% else %}made{% endif %} a post yet

+

Your {% if "saved" in request.full_path %}saved posts{% else %}posting history{% endif %} will show here.

+ {% if "saved" not in request.full_path %}Create a post{% endif %} +
+
+
+ + +{% else %} +
+
+
+ + + + +

@{{u.username}} hasn't made a post yet

+

Their posting history will show here.

+
+			
+
+
+
+{% endif %} + +{% else %} +
+
+
+ + + + +

There are no posts here.

+
+
+
+ + +{% endif %} + +{% endfor %} + +{% if v %} + {% include "delete_post_modal.html" %} + {% include "report_post_modal.html" %} + {% if v.admin_level > 1 %} + {% include "ban_modal.html" %} + {% endif %} +{% endif %} +{% include "expanded_image_modal.html" %} + + + + + + \ No newline at end of file