forked from MarseyWorld/MarseyWorld
fdsfsd
parent
b06a69600f
commit
159dd1387e
|
@ -316,6 +316,7 @@ class Comment(Base):
|
|||
url_noquery = url.split('?')[0]
|
||||
body = body.replace(url, f"{url_noquery}?{urlencode(p, True)}")
|
||||
|
||||
if self.author.sig_html: return body + '<hr>' + self.author.sig_html
|
||||
return body
|
||||
|
||||
def plainbody(self, v):
|
||||
|
|
|
@ -316,6 +316,7 @@ class Submission(Base):
|
|||
|
||||
if v and not v.oldreddit: body = body.replace("old.reddit.com", "reddit.com")
|
||||
if v and v.nitter: body = body.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net")
|
||||
if self.author.sig_html: return body + '<hr>' + self.author.sig_html
|
||||
return body
|
||||
|
||||
def plainbody(self, v):
|
||||
|
|
|
@ -84,6 +84,8 @@ class User(Base):
|
|||
controversial = Column(Boolean, default=False)
|
||||
bio = Column(String)
|
||||
bio_html = Column(String)
|
||||
sig = Column(String)
|
||||
sig_html = Column(String)
|
||||
is_banned = Column(Integer, default=0)
|
||||
unban_utc = Column(Integer, default=0)
|
||||
ban_reason = Column(String)
|
||||
|
|
|
@ -148,6 +148,87 @@ def settings_profile_post(v):
|
|||
msg="Your bio has been updated.")
|
||||
|
||||
|
||||
if v.patron and request.values.get("sig"):
|
||||
sig = request.values.get("sig")[:1500]
|
||||
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', sig, re.MULTILINE):
|
||||
if "wikipedia" not in i.group(1): sig = sig.replace(i.group(1), f'![]({i.group(1)})')
|
||||
sig = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', sig)
|
||||
|
||||
sig_html = CustomRenderer().render(mistletoe.Document(sig))
|
||||
sig_html = sanitize(sig_html)
|
||||
bans = filter_comment_html(sig_html)
|
||||
|
||||
if len(sig_html) > 10000:
|
||||
return render_template("settings_profile.html",
|
||||
v=v,
|
||||
error="Your sig is too long")
|
||||
|
||||
if bans:
|
||||
ban = bans[0]
|
||||
reason = f"Remove the {ban.domain} link from your sig and try again."
|
||||
if ban.reason:
|
||||
reason += f" {ban.reason}"
|
||||
|
||||
return {"error": reason}, 401
|
||||
|
||||
if len(sig_html) > 10000: abort(400)
|
||||
|
||||
v.sig = sig[:1500]
|
||||
v.sig_html=sig_html
|
||||
g.db.add(v)
|
||||
g.db.commit()
|
||||
return render_template("settings_profile.html",
|
||||
v=v,
|
||||
msg="Your sig has been updated.")
|
||||
|
||||
|
||||
if request.values.get("bio") or request.files.get('file') and request.headers.get("cf-ipcountry") != "T1":
|
||||
bio = request.values.get("bio")[:1500]
|
||||
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', bio, re.MULTILINE):
|
||||
if "wikipedia" not in i.group(1): bio = bio.replace(i.group(1), f'![]({i.group(1)})')
|
||||
bio = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', bio)
|
||||
|
||||
if request.files.get('file'):
|
||||
file = request.files['file']
|
||||
if not file.content_type.startswith('image/'):
|
||||
if request.headers.get("Authorization"): return {"error": f"Image files only"}, 400
|
||||
else: return render_template("settings_profile.html", v=v, error=f"Image files only."), 400
|
||||
|
||||
name = f'/images/{int(time.time())}{secrets.token_urlsafe(2)}.gif'
|
||||
file.save(name)
|
||||
url = request.host_url[:-1] + process_image(name)
|
||||
|
||||
bio += f"\n\n![]({url})"
|
||||
|
||||
bio_html = CustomRenderer().render(mistletoe.Document(bio))
|
||||
bio_html = sanitize(bio_html)
|
||||
bans = filter_comment_html(bio_html)
|
||||
|
||||
if len(bio_html) > 10000:
|
||||
return render_template("settings_profile.html",
|
||||
v=v,
|
||||
error="Your bio is too long")
|
||||
|
||||
if bans:
|
||||
ban = bans[0]
|
||||
reason = f"Remove the {ban.domain} link from your bio and try again."
|
||||
if ban.reason:
|
||||
reason += f" {ban.reason}"
|
||||
|
||||
return {"error": reason}, 401
|
||||
|
||||
if len(bio_html) > 10000: abort(400)
|
||||
|
||||
v.bio = bio[:1500]
|
||||
v.bio_html=bio_html
|
||||
g.db.add(v)
|
||||
g.db.commit()
|
||||
return render_template("settings_profile.html",
|
||||
v=v,
|
||||
msg="Your bio has been updated.")
|
||||
|
||||
|
||||
frontsize = request.values.get("frontsize")
|
||||
if frontsize:
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=105"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=96">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=106"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=96">
|
||||
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=96">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=105"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=96">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=106"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=96">
|
||||
{% endif %}
|
||||
|
||||
</head>
|
||||
|
|
|
@ -254,12 +254,12 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=105">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=106">
|
||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=96">
|
||||
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=96">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=105"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=96">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=106"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=96">
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=105"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=96">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=106"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=96">
|
||||
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=96">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=105"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=96">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=106"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=96">
|
||||
{% endif %}
|
||||
|
||||
<div class="row justify-content-around">
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<title>2-Step Login - {{'SITE_NAME' | app_config}}</title>
|
||||
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=105"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=96">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=106"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=96">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=105"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=96">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=106"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=96">
|
||||
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=96">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
|
||||
|
||||
<link href="/assets/css/fa.css?v=52" rel="stylesheet">
|
||||
|
|
|
@ -40,10 +40,10 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=105"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=96">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=106"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=96">
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=105"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=96">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=106"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=96">
|
||||
{% endif %}
|
||||
|
||||
<link href="/assets/css/fa.css?v=52" rel="stylesheet">
|
||||
|
|
|
@ -587,6 +587,38 @@
|
|||
|
||||
</div>
|
||||
|
||||
{% if v.patron %}
|
||||
<div class="body d-lg-flex border-bottom">
|
||||
<label class="text-black w-lg-25">Signature</label>
|
||||
|
||||
<div class="w-lg-100">
|
||||
<form id="profile-sig" action="/settings/profile" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||
<div class="input-group mb-2">
|
||||
<textarea id="sig-text" class="form-control rounded" aria-label="With textarea" placeholder="Tell the community a bit about yourself." rows="3" name="sig" form="profile-sig" maxlength="200">{% if v.sig %}{{v.sig}}{% endif %}</textarea>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<pre style="padding-top:0.7rem" class="btn btn-secondary format d-inline-block m-0 fas fa-bold" aria-hidden="true" onclick="makeBold('sig-text')" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Bold"></pre>
|
||||
|
||||
<pre style="padding-top:0.7rem" class="btn btn-secondary format d-inline-block m-0 fas fa-italic" aria-hidden="true" onclick="makeItalics('sig-text')" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Italicize"></pre>
|
||||
|
||||
<pre style="padding-top:0.7rem" class="btn btn-secondary format d-inline-block m-0 fas fa-quote-right" aria-hidden="true" onclick="makeQuote('sig-text')" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Quote"></pre>
|
||||
|
||||
<pre style="padding-top:0.7rem;line-height:1;" class="btn btn-secondary format d-inline-block m-0 font-weight-bolder text-uppercase" onclick="commentForm('sig-text');getGif()" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#gifModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Add GIF">GIF</pre>
|
||||
|
||||
<pre style="padding-top:0.7rem" class="btn btn-secondary format d-inline-block m-0 fas fa-smile-beam" onclick="loadEmojis('sig-text')" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Add Emoji"></pre>
|
||||
</div>
|
||||
<pre></pre>
|
||||
<div class="d-flex">
|
||||
<small>Limit of 200 characters</small>
|
||||
<input class="btn btn-primary ml-auto" id="sigSave" type="submit" value="Save Changes">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="d-lg-flex border-bottom">
|
||||
|
||||
<div class="title w-lg-25">
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600&display=swap" rel="stylesheet">
|
||||
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=105"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=96">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=106"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=96">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600&display=swap" rel="stylesheet">
|
||||
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=105"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=96">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=106"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=96">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
{% block stylesheets %}
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=105"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=96">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=106"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=96">
|
||||
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=96">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=105">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=106">
|
||||
<link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=96">
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue