diff --git a/files/assets/css/main.css b/files/assets/css/main.css index 410c49f73c..9b84f0eca3 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -6646,12 +6646,6 @@ body > .container { } } -@media (max-width: 768px) { - #livecommit { - font-size: 0.8rem; - } -} - @media (min-width: 1400px) { .awardmodal { max-width: min(90%, 1200px) !important diff --git a/files/routes/front.py b/files/routes/front.py index 050eab98f2..4e486f5808 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -10,21 +10,6 @@ from files.helpers.sorting_and_time import * from files.routes.wrappers import * from files.__main__ import app, cache, limiter -def git_head(): - # Note: doing zero sanitization. Git branch names are extremely permissive. - # However, they forbid '..', so I don't see an obvious dir traversal attack. - # Also, a malicious branch name would mean someone already owned the server - # or repo, so I think this isn't a weak link. - try: - with open('.git/HEAD', encoding='utf_8') as head_f: - head_txt = head_f.read() - head_path = git_regex.match(head_txt).group(1) - with open('.git/' + head_path, encoding='utf_8') as ref_f: - gitref = ref_f.read()[:7] - except: - return '', '' - return (gitref, head_txt) - @app.get("/") @app.get("/h/") @app.get("/s/") @@ -85,7 +70,7 @@ def front_all(v, sub=None, subdomain=None): award_timers(v) if v and v.client: return {"data": [x.json(g.db) for x in posts], "next_exists": next_exists} - return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page, sub=sub, home=True, pins=pins, holes=holes, gitref=git_head()) + return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page, sub=sub, home=True, pins=pins, holes=holes) @cache.memoize(timeout=86400) diff --git a/files/routes/jinja2.py b/files/routes/jinja2.py index aa65152298..df8d3b04e8 100644 --- a/files/routes/jinja2.py +++ b/files/routes/jinja2.py @@ -11,6 +11,7 @@ from jinja2 import pass_context from files.classes.user import User from files.helpers.assetcache import assetcache_path from files.helpers.config.const import * +from files.helpers.regex import * from files.helpers.settings import get_settings from files.helpers.sorting_and_time import make_age_string from files.routes.routehelpers import get_alt_graph, get_formkey @@ -81,6 +82,18 @@ def calc_users(): def current_registered_users(): return "{:,}".format(g.db.query(User).count()) +def git_head(): + # Note: doing zero sanitization. Git branch names are extremely permissive. + # However, they forbid '..', so I don't see an obvious dir traversal attack. + # Also, a malicious branch name would mean someone already owned the server + # or repo, so I think this isn't a weak link. + with open('.git/HEAD', encoding='utf_8') as head_f: + head_txt = head_f.read() + head_path = git_regex.match(head_txt).group(1) + with open('.git/' + head_path, encoding='utf_8') as ref_f: + gitref = ref_f.read()[:7] + return (gitref, head_txt) + @app.context_processor def inject_constants(): return {"environ":environ, "SITE":SITE, "SITE_NAME":SITE_NAME, "SITE_FULL":SITE_FULL, @@ -103,5 +116,5 @@ def inject_constants(): "HOUSE_JOIN_COST":HOUSE_JOIN_COST, "HOUSE_SWITCH_COST":HOUSE_SWITCH_COST, "IMAGE_FORMATS":','.join(IMAGE_FORMATS), "PAGE_SIZES":PAGE_SIZES, "THEMES":THEMES, "COMMENT_SORTS":COMMENT_SORTS, "SORTS":SORTS, "TIME_FILTERS":TIME_FILTERS, "HOUSES":HOUSES, "TIERS_ID_TO_NAME":TIERS_ID_TO_NAME, - "DEFAULT_CONFIG_VALUE":DEFAULT_CONFIG_VALUE, "IS_LOCALHOST":IS_LOCALHOST, "BACKGROUND_CATEGORIES":BACKGROUND_CATEGORIES, "PAGE_SIZE":PAGE_SIZE, "TAGLINES":TAGLINES, "IS_FISTMAS":IS_FISTMAS, "get_alt_graph":get_alt_graph, "current_registered_users":current_registered_users + "DEFAULT_CONFIG_VALUE":DEFAULT_CONFIG_VALUE, "IS_LOCALHOST":IS_LOCALHOST, "BACKGROUND_CATEGORIES":BACKGROUND_CATEGORIES, "PAGE_SIZE":PAGE_SIZE, "TAGLINES":TAGLINES, "IS_FISTMAS":IS_FISTMAS, "get_alt_graph":get_alt_graph, "current_registered_users":current_registered_users, "gitref":git_head() } diff --git a/files/templates/home.html b/files/templates/home.html index 51ab632dde..669d51ada8 100644 --- a/files/templates/home.html +++ b/files/templates/home.html @@ -177,8 +177,4 @@ {% endif %} -
- Live Commit: {{gitref[0]}} -
- {% endblock %} diff --git a/files/templates/rules_rDrama.html b/files/templates/rules_rDrama.html index 22f1c99d53..d0313fdab3 100644 --- a/files/templates/rules_rDrama.html +++ b/files/templates/rules_rDrama.html @@ -64,4 +64,4 @@

This is an entertainment comedy website. Any and all posts and comments are parody with no basis in reality.

-

𝐜𝐚𝐫𝐩 𝐰𝐨𝐳 𝐞𝐫𝐞

\ No newline at end of file +

𝐜𝐚𝐫𝐩 𝐰𝐨𝐳 𝐞𝐫𝐞

diff --git a/files/templates/sidebar_WPD.html b/files/templates/sidebar_WPD.html index 9b5ce9f621..f1323e6d98 100644 --- a/files/templates/sidebar_WPD.html +++ b/files/templates/sidebar_WPD.html @@ -78,6 +78,11 @@ {% set rules = "rules_" ~ SITE_NAME ~ ".html" %} {% include rules %} + +
+
+ Live commit: {{gitref[0]}} +
{% if IS_FISTMAS() %} diff --git a/files/templates/sidebar_rDrama.html b/files/templates/sidebar_rDrama.html index 5755ebde73..8778fb4876 100644 --- a/files/templates/sidebar_rDrama.html +++ b/files/templates/sidebar_rDrama.html @@ -63,6 +63,11 @@ {% set rules = "rules_" ~ SITE_NAME ~ ".html" %} {% include rules %} + +
+
+ Live commit: {{gitref[0]}} +
{% endif %}