fdsfds
This commit is contained in:
parent
9552e3b01b
commit
71325bcf57
10 changed files with 53 additions and 29 deletions
|
@ -16,6 +16,9 @@ const EMOJIS_STRINGS = [
|
|||
marseysob: ['cry','tear'],
|
||||
marseytears: ['cry','sob'],
|
||||
marseycarpcrying: ['fish','sob','tear'],
|
||||
marseyfeelsgood:[ 'happy','pepe'],
|
||||
marseyhomofascist: ['kiss'],
|
||||
marseycapy: ['happy','aevann','rodent']
|
||||
},
|
||||
|
||||
emojis: ['marseylaugh','marseyblowkiss','marseyshook','marseythumbsup','marseylove','marseyreading','marseywave','marseyjamming','marseyready','marseyscarf','marseymad','marseycry','marseyinabox','marseysad','marseyexcited','marseysleep','marseyangel','marseydead','marseyparty','marseyrain','marseyagree','marseydisagree','marseyjam','marseygasp','marseytwerking','marseysipping','marseyshrug','marseyglow','marseycope','marseyseethe','marseymerchant','marseyno','marseywalking','marseyhearts','marseybegging','marseytrans2','marseygigaretard','marseysneed','marseybaited','marseyeyeroll','marseydepressed','marseypat','marseyking','marseylong1','marseylong2','marseylong3',
|
||||
|
|
|
@ -20,18 +20,9 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||
const userName = document.getElementById("username-register").value;
|
||||
const id = document.getElementById("usernameHelpRegister");
|
||||
|
||||
const API = '/is_available/' + userName;
|
||||
if (userName.length >= 3) {
|
||||
fetch(API)
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
if (!json[userName]) {
|
||||
id.innerHTML = '<span class="form-text font-weight-bold text-danger mt-1">Username already taken :(</span>';
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (!/[^a-zA-Z0-9_\-$]/.test(userName)) {
|
||||
if (/[^a-zA-Z0-9_\-$]/.test(userName)) {
|
||||
id.innerHTML = '<span class="form-text font-weight-bold text-danger mt-1">No special characters or spaces allowed.</span>';
|
||||
} else {
|
||||
id.innerHTML = '<span class="form-text font-weight-bold text-success mt-1">Username is a-okay!</span>';
|
||||
|
||||
if (userName.length < 3) {
|
||||
|
@ -39,10 +30,16 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||
} else if (userName.length > 25) {
|
||||
id.innerHTML = '<span class="form-text font-weight-bold text-danger mt-1">Username must be 25 characters or less.</span>';
|
||||
}
|
||||
} else {
|
||||
id.innerHTML = '<span class="form-text font-weight-bold text-danger mt-1">No special characters or spaces allowed.</span>';
|
||||
else {
|
||||
fetch('/is_available/' + userName)
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
if (!json[userName]) {
|
||||
id.innerHTML = '<span class="form-text font-weight-bold text-danger mt-1">Username already taken :(</span>';
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
|
@ -95,7 +95,7 @@ class ModAction(Base):
|
|||
elif self.target_post:
|
||||
if self.target_post.club: return f'<a href="{self.target_post.permalink}">{cc.upper()} ONLY</a>'
|
||||
return f'<a href="{self.target_post.permalink}">{self.target_post.title.replace("<","").replace(">","")}</a>'
|
||||
elif self.target_comment_id: return f'<a href="/comment/{self.target_comment_id}">comment</a>'
|
||||
elif self.target_comment_id: return f'<a href="/comment/{self.target_comment_id}?context=9#context">comment</a>'
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -167,6 +167,24 @@ def front_all(v):
|
|||
g.db.add(v)
|
||||
g.db.commit()
|
||||
|
||||
if v.marseyawarded and v.marseyawarded < time.time():
|
||||
v.marseyawarded = None
|
||||
send_notification(v.id, "Your marsey award has expired!")
|
||||
g.db.add(v)
|
||||
g.db.commit()
|
||||
|
||||
if v.longpost and v.longpost < time.time():
|
||||
v.longpost = None
|
||||
send_notification(v.id, "Your pizzashill award has expired!")
|
||||
g.db.add(v)
|
||||
g.db.commit()
|
||||
|
||||
if v.bird and v.bird < time.time():
|
||||
v.bird = None
|
||||
send_notification(v.id, "Your bird site award has expired!")
|
||||
g.db.add(v)
|
||||
g.db.commit()
|
||||
|
||||
if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists}
|
||||
else: return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page)
|
||||
|
||||
|
|
|
@ -155,6 +155,13 @@ def settings_profile_post(v):
|
|||
msg="Your bio has been updated.")
|
||||
|
||||
|
||||
elif request.values.get("bio") == "":
|
||||
v.bio = None
|
||||
v.bio_html = None
|
||||
g.db.add(v)
|
||||
g.db.commit()
|
||||
return render_template("settings_profile.html", v=v, msg="Your bio has been updated.")
|
||||
|
||||
elif request.values.get("sig") == "":
|
||||
v.sig = None
|
||||
v.sig_html = None
|
||||
|
|
|
@ -454,12 +454,12 @@ def api_is_available(name, v):
|
|||
if len(name)<3 or len(name)>25:
|
||||
return {name:False}
|
||||
|
||||
name=name.replace('_','\_')
|
||||
name2 = name.replace('_','\_')
|
||||
|
||||
x= g.db.query(User).filter(
|
||||
or_(
|
||||
User.username.ilike(name),
|
||||
User.original_username.ilike(name)
|
||||
User.username.ilike(name2),
|
||||
User.original_username.ilike(name2)
|
||||
)
|
||||
).first()
|
||||
|
||||
|
@ -468,7 +468,6 @@ def api_is_available(name, v):
|
|||
else:
|
||||
return {name: True}
|
||||
|
||||
|
||||
@app.get("/id/<id>")
|
||||
def user_id(id):
|
||||
|
||||
|
@ -556,12 +555,12 @@ def u_username(username, v=None):
|
|||
else: return render_template("userpage_private.html", time=int(time.time()), u=u, v=v)
|
||||
|
||||
|
||||
if hasattr(u, 'is_blocking') and u.is_blocking and (not v or v.admin_level < 2):
|
||||
if v and hasattr(u, 'is_blocking') and u.is_blocking:
|
||||
if request.headers.get("Authorization"): return {"error": f"You are blocking @{u.username}."}
|
||||
else: return render_template("userpage_blocking.html", u=u, v=v)
|
||||
|
||||
|
||||
if hasattr(u, 'is_blocked') and u.is_blocked and (not v or v.admin_level < 2):
|
||||
if v and v.admin_level < 2 and hasattr(u, 'is_blocked') and u.is_blocked:
|
||||
if request.headers.get("Authorization"): return {"error": "This person is blocking you."}
|
||||
else: return render_template("userpage_blocked.html", u=u, v=v)
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
{{single_comment(reply, level=level+1)}}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% elif "notifications" in request.path %}
|
||||
{% elif replies and "notifications" in request.path %}
|
||||
<div id="replies-of-{{c.id}}" class="d-none d-md-block">
|
||||
{% set standalone=False %}
|
||||
{% for reply in replies %}
|
||||
|
@ -579,7 +579,7 @@
|
|||
{{single_comment(reply, level=level+1)}}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% elif "notifications" in request.path %}
|
||||
{% elif replies and "notifications" in request.path %}
|
||||
<div id="replies-of-{{c.id}}" class="d-none d-md-block">
|
||||
{% set standalone=False %}
|
||||
{% for reply in replies %}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<script src="/assets/js/emoji_modal.js?v=120"></script>
|
||||
<script src="/assets/js/emoji_modal.js?v=121"></script>
|
||||
|
||||
<style>
|
||||
a.emojitab {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<head>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
<script src="/assets/js/signup.js?v=53"></script>
|
||||
<script src="/assets/js/signup.js?v=63"></script>
|
||||
|
||||
{% if hcaptcha %}
|
||||
<script src="https://hcaptcha.com/1/api.js"></script>
|
||||
|
@ -89,7 +89,7 @@
|
|||
<label for="username-register" class="mt-3">Username</label>
|
||||
|
||||
<input class="form-control" id="username-register"
|
||||
aria-describedby="usernameHelpRegister" type="text" name="username" pattern="[a-zA-Z0-9_\-]{3,25}" required="">
|
||||
aria-describedby="usernameHelpRegister" type="text" name="username" pattern="[a-zA-Z0-9_\-]{3,25}" min="3" max="25" required="">
|
||||
<small id="usernameHelpRegister"></small>
|
||||
|
||||
<label for="email-register" class="mt-3">Email Address</label>
|
||||
|
|
|
@ -147,7 +147,7 @@
|
|||
</span>
|
||||
{% endif %}
|
||||
{% if v and v.has_follower(u) %}
|
||||
<span class="followsyou text-primary badge badge-secondary text-small align-middle ml-2">Follows you</span>
|
||||
<span class="followsyou badge badge-secondary text-small align-middle ml-2">Follows you</span>
|
||||
{% endif %}
|
||||
<div class="profile-actions align-middle d-none ml-2">
|
||||
{% if v and v.id != u.id %}
|
||||
|
@ -446,7 +446,7 @@
|
|||
</span>
|
||||
{% endif %}
|
||||
{% if v and v.has_follower(u) and not v.is_nofollow %}
|
||||
<span class="followsyou text-primary badge badge-secondary text-small align-middle mx-1">Follows you</span>
|
||||
<span class="followsyou badge badge-secondary text-small align-middle mx-1">Follows you</span>
|
||||
{% endif %}
|
||||
{% if u.customtitle %}<p style="color: #{{u.titlecolor}}">{% if u.quadrant %}<img loading="lazy" height="20" src="/assets/images/quadrants/{{u.quadrant}}.webp?v=1">{% endif %}{{u.customtitle | safe}}</p>
|
||||
{% else %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue