allow hole jannies to change the hole marsey + cachebust all site assets
parent
75ad5b34f2
commit
11d7f34ad0
|
@ -2,7 +2,7 @@
|
||||||
<browserconfig>
|
<browserconfig>
|
||||||
<msapplication>
|
<msapplication>
|
||||||
<tile>
|
<tile>
|
||||||
<square150x150logo src="/i/icon.webp?v=3000">
|
<square150x150logo src="/i/icon.webp?v=3009">
|
||||||
<TileColor>#FF66AC</TileColor>
|
<TileColor>#FF66AC</TileColor>
|
||||||
</tile>
|
</tile>
|
||||||
</msapplication>
|
</msapplication>
|
||||||
|
|
|
@ -24,13 +24,13 @@ function flash(){
|
||||||
alert=false;
|
alert=false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
icon.href = escapeHTML(`/assets/images/${site_name}/icon.webp?v=3000`)
|
icon.href = escapeHTML(`/assets/images/${site_name}/icon.webp?v=3009`)
|
||||||
alert=true;
|
alert=true;
|
||||||
}
|
}
|
||||||
setTimeout(flash, 500)
|
setTimeout(flash, 500)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
icon.href = escapeHTML(`/assets/images/${site_name}/icon.webp?v=3000`)
|
icon.href = escapeHTML(`/assets/images/${site_name}/icon.webp?v=3009`)
|
||||||
notifs = 0
|
notifs = 0
|
||||||
title.innerHTML = 'Chat';
|
title.innerHTML = 'Chat';
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ class Sub(Base):
|
||||||
sidebar_html = Column(String)
|
sidebar_html = Column(String)
|
||||||
sidebarurl = Column(String)
|
sidebarurl = Column(String)
|
||||||
bannerurl = Column(String)
|
bannerurl = Column(String)
|
||||||
|
marseyurl = Column(String)
|
||||||
css = Column(String)
|
css = Column(String)
|
||||||
stealth = Column(Boolean)
|
stealth = Column(Boolean)
|
||||||
|
|
||||||
|
@ -31,13 +32,19 @@ class Sub(Base):
|
||||||
@lazy
|
@lazy
|
||||||
def sidebar_url(self):
|
def sidebar_url(self):
|
||||||
if self.sidebarurl: return SITE_FULL + self.sidebarurl
|
if self.sidebarurl: return SITE_FULL + self.sidebarurl
|
||||||
return f'/i/{SITE_NAME}/sidebar.webp?v=3000'
|
return f'/i/{SITE_NAME}/sidebar.webp?v=3009'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def banner_url(self):
|
def banner_url(self):
|
||||||
if self.bannerurl: return SITE_FULL + self.bannerurl
|
if self.bannerurl: return SITE_FULL + self.bannerurl
|
||||||
return f'/i/{SITE_NAME}/banner.webp?v=3001'
|
return f'/i/{SITE_NAME}/banner.webp?v=3009'
|
||||||
|
|
||||||
|
@property
|
||||||
|
@lazy
|
||||||
|
def marsey_url(self):
|
||||||
|
if self.marseyurl: return SITE_FULL + self.marseyurl
|
||||||
|
return f'/i/{SITE_NAME}/headericon.webp?v=3009'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
|
|
|
@ -224,7 +224,7 @@ class Submission(Base):
|
||||||
return self.thumburl
|
return self.thumburl
|
||||||
elif self.is_youtube or self.is_video: return f"{SITE_FULL}/assets/images/default_thumb_video.webp?v=1"
|
elif self.is_youtube or self.is_video: return f"{SITE_FULL}/assets/images/default_thumb_video.webp?v=1"
|
||||||
elif self.is_audio: return f"{SITE_FULL}/assets/images/default_thumb_audio.webp?v=1"
|
elif self.is_audio: return f"{SITE_FULL}/assets/images/default_thumb_audio.webp?v=1"
|
||||||
elif self.domain == SITE: return f"{SITE_FULL}/assets/images/{SITE_NAME}/site_preview.webp?v=3008"
|
elif self.domain == SITE: return f"{SITE_FULL}/assets/images/{SITE_NAME}/site_preview.webp?v=3009"
|
||||||
else: return f"{SITE_FULL}/assets/images/default_thumb_link.webp?v=1"
|
else: return f"{SITE_FULL}/assets/images/default_thumb_link.webp?v=1"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -607,7 +607,7 @@ class User(Base):
|
||||||
def banner_url(self):
|
def banner_url(self):
|
||||||
if FEATURES['USERS_PROFILE_BANNER'] and self.bannerurl:
|
if FEATURES['USERS_PROFILE_BANNER'] and self.bannerurl:
|
||||||
return self.bannerurl
|
return self.bannerurl
|
||||||
return f"/i/{SITE_NAME}/site_preview.webp?v=3008"
|
return f"/i/{SITE_NAME}/site_preview.webp?v=3009"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
|
|
|
@ -113,7 +113,7 @@ if PUSHER_ID != 'blahblahblah':
|
||||||
'title': title,
|
'title': title,
|
||||||
'body': notifbody,
|
'body': notifbody,
|
||||||
'deep_link': url,
|
'deep_link': url,
|
||||||
'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp?v=3000',
|
'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp?v=3009',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'fcm': {
|
'fcm': {
|
||||||
|
|
|
@ -468,6 +468,32 @@ def sub_sidebar(v, sub):
|
||||||
|
|
||||||
return redirect(f'/h/{sub.name}/settings')
|
return redirect(f'/h/{sub.name}/settings')
|
||||||
|
|
||||||
|
@app.post("/h/<sub>/marsey_image")
|
||||||
|
@limiter.limit("1/second;10/day")
|
||||||
|
@limiter.limit("1/second;10/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
|
||||||
|
@is_not_permabanned
|
||||||
|
def sub_marsey(v, sub):
|
||||||
|
if request.headers.get("cf-ipcountry") == "T1": return {"error":"Image uploads are not allowed through TOR."}, 403
|
||||||
|
|
||||||
|
sub = g.db.query(Sub).filter_by(name=sub.lower().strip()).one_or_none()
|
||||||
|
if not sub: abort(404)
|
||||||
|
|
||||||
|
if not v.mods(sub.name): abort(403)
|
||||||
|
|
||||||
|
file = request.files["marsey"]
|
||||||
|
name = f'/images/{time.time()}'.replace('.','') + '.webp'
|
||||||
|
file.save(name)
|
||||||
|
marseyurl = process_image(name)
|
||||||
|
|
||||||
|
if marseyurl:
|
||||||
|
if sub.marseyurl and '/images/' in sub.marseyurl:
|
||||||
|
fpath = '/images/' + sub.marseyurl.split('/images/')[1]
|
||||||
|
if path.isfile(fpath): os.remove(fpath)
|
||||||
|
sub.marseyurl = marseyurl
|
||||||
|
g.db.add(sub)
|
||||||
|
|
||||||
|
return redirect(f'/h/{sub.name}/settings')
|
||||||
|
|
||||||
@app.get("/holes")
|
@app.get("/holes")
|
||||||
@auth_desired_with_logingate
|
@auth_desired_with_logingate
|
||||||
def subs(v):
|
def subs(v):
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
<div class="navbar navbar-expand-md navbar-light" id="navbar">
|
<div class="navbar navbar-expand-md navbar-light" id="navbar">
|
||||||
<div class="container-fluid" style="padding:0;">
|
<div class="container-fluid" style="padding:0;">
|
||||||
<a href="/" class="navbar-brand mr-auto {% if not has_logo and not sub %}flex-grow-1{% endif %}">
|
<a href="/" class="navbar-brand mr-auto {% if not has_logo and not sub %}flex-grow-1{% endif %}">
|
||||||
<img id="header--icon" alt="header icon" src="{{asset_siteimg('headericon.webp')}}">
|
<img id="header--icon" alt="header icon" {% if sub %}src="{{sub.marsey_url}}"{% else %}src="{{asset_siteimg('headericon.webp')}}"{% endif %}>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
{% if sub %}
|
{% if sub %}
|
||||||
|
|
|
@ -231,7 +231,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-small text-muted mt-3">JPG, PNG, GIF files are supported. Max file size is {% if v and v.patron %}8{% else %}4{% endif %} MB.</div>
|
<div class="text-small text-muted mt-3">JPG, PNG, GIF files are supported. Max file size is {% if v and v.patron %}16{% else %}8{% endif %} MB.</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-small text-muted mt-3">JPG, PNG, GIF files are supported. Max file size is {% if v and v.patron %}8{% else %}4{% endif %} MB.</div>
|
<div class="text-small text-muted mt-3">JPG, PNG, GIF files are supported. Max file size is {% if v and v.patron %}16{% else %}8{% endif %} MB.</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
{% if sub %}
|
{% if sub %}
|
||||||
{% set image=sub.sidebar_url %}
|
{% set image=sub.sidebar_url %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set image='/i/' + SITE_NAME + '/sidebar.webp?v=3000' %}
|
{% set image='/i/' + SITE_NAME + '/sidebar.webp?v=3009' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if request.path != '/sidebar' %}
|
{% if request.path != '/sidebar' %}
|
||||||
|
|
|
@ -40,6 +40,42 @@
|
||||||
<span class="text-small text-muted">Hide posts in this hole from the main feed by default (users can opt-in to see it there).</span>
|
<span class="text-small text-muted">Hide posts in this hole from the main feed by default (users can opt-in to see it there).</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<h2 class="h5 mt-5">Marsey</h2>
|
||||||
|
|
||||||
|
<div class="settings-section rounded">
|
||||||
|
|
||||||
|
<div class="d-flex">
|
||||||
|
|
||||||
|
<div class="title w-lg-25 text-md-center">
|
||||||
|
<img loading="lazy" alt="sub marsey picture" src="{{sub.marsey_url}}" class="profile-pic-75">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="body w-lg-100 my-auto">
|
||||||
|
|
||||||
|
<div class="d-flex">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<form action="/h/{{sub.name}}/marsey_image" method="post" enctype="multipart/form-data">
|
||||||
|
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||||
|
<label class="btn btn-secondary text-capitalize mr-2 mb-0">
|
||||||
|
Update<input autocomplete="off" type="file" accept="image/*" {% if request.headers.get('cf-ipcountry')=="T1" %}disabled{% endif %} hidden name="marsey" onchange="form.submit()">
|
||||||
|
</label>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-small text-muted mt-3">JPG, PNG, GIF files are supported. Max file size is {% if v and v.patron %}16{% else %}8{% endif %} MB.</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<h2 class="h5 mt-5">Sidebar Picture</h2>
|
<h2 class="h5 mt-5">Sidebar Picture</h2>
|
||||||
|
|
||||||
<div class="settings-section rounded">
|
<div class="settings-section rounded">
|
||||||
|
@ -66,7 +102,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-small text-muted mt-3">JPG, PNG, GIF files are supported. Max file size is {% if v and v.patron %}8{% else %}4{% endif %} MB.</div>
|
<div class="text-small text-muted mt-3">JPG, PNG, GIF files are supported. Max file size is {% if v and v.patron %}16{% else %}8{% endif %} MB.</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -102,7 +138,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-small text-muted mt-3">JPG, PNG, GIF files are supported. Max file size is {% if v and v.patron %}8{% else %}4{% endif %} MB.</div>
|
<div class="text-small text-muted mt-3">JPG, PNG, GIF files are supported. Max file size is {% if v and v.patron %}16{% else %}8{% endif %} MB.</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -40,5 +40,5 @@ set CACHE_VER = {
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
{%- macro asset_siteimg(name) -%}
|
{%- macro asset_siteimg(name) -%}
|
||||||
/i/{{SITE_NAME}}/{{name}}?v=3000
|
/i/{{SITE_NAME}}/{{name}}?v=3009
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
|
Loading…
Reference in New Issue