Merge branch 'master' into mistletoe

remotes/1693045480750635534/spooky-22
kek7198 2021-11-30 19:15:22 -06:00
commit ce262e1c80
24 changed files with 69 additions and 69 deletions

View File

@ -251,11 +251,11 @@ class User(Base):
elif sort == "old":
posts = posts.order_by(Submission.created_utc.asc())
elif sort == "controversial":
posts = posts.order_by(-1 * Submission.realupvotes * Submission.downvotes * Submission.downvotes)
posts = posts.order_by(-1 * Submission.upvotes * Submission.downvotes * Submission.downvotes)
elif sort == "top":
posts = posts.order_by(Submission.downvotes - Submission.realupvotes)
posts = posts.order_by(Submission.downvotes - Submission.upvotes)
elif sort == "bottom":
posts = posts.order_by(Submission.realupvotes - Submission.downvotes)
posts = posts.order_by(Submission.upvotes - Submission.downvotes)
elif sort == "comments":
posts = posts.order_by(Submission.comment_count.desc())
@ -411,7 +411,7 @@ class User(Base):
@lazy
def banner_url(self):
if self.bannerurl: return self.bannerurl
else: return f"http://{site}/assets/images/{site_name}/preview.webp?v=2"
else: return f"http://{site}/assets/images/{site_name}/preview.webp?v=3"
@property
@lazy

View File

@ -237,17 +237,17 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
if sort == "hot":
ti = int(time.time()) + 3600
posts = posts.order_by(-1000000*(Submission.realupvotes + Submission.downvotes + 1 + Submission.comment_count/5)/(func.power(((ti - Submission.created_utc)/1000), 1.35)))
posts = posts.order_by(-1000000*(Submission.realupvotes + 1 + Submission.comment_count/5)/(func.power(((ti - Submission.created_utc)/1000), 1.35)))
elif sort == "new":
posts = posts.order_by(Submission.created_utc.desc())
elif sort == "old":
posts = posts.order_by(Submission.created_utc.asc())
elif sort == "controversial":
posts = posts.order_by(-1 * Submission.realupvotes * Submission.downvotes * Submission.downvotes)
posts = posts.order_by(-1 * Submission.upvotes * Submission.downvotes * Submission.downvotes)
elif sort == "top":
posts = posts.order_by(Submission.downvotes - Submission.realupvotes)
posts = posts.order_by(Submission.downvotes - Submission.upvotes)
elif sort == "bottom":
posts = posts.order_by(Submission.realupvotes - Submission.downvotes)
posts = posts.order_by(Submission.upvotes - Submission.downvotes)
elif sort == "comments":
posts = posts.order_by(Submission.comment_count.desc())
@ -340,11 +340,11 @@ def changeloglist(v=None, sort="new", page=1 ,t="all"):
elif sort == "old":
posts = posts.order_by(Submission.created_utc.asc())
elif sort == "controversial":
posts = posts.order_by(-1 * Submission.realupvotes * Submission.downvotes * Submission.downvotes)
posts = posts.order_by(-1 * Submission.upvotes * Submission.downvotes * Submission.downvotes)
elif sort == "top":
posts = posts.order_by(Submission.downvotes - Submission.realupvotes)
posts = posts.order_by(Submission.downvotes - Submission.upvotes)
elif sort == "bottom":
posts = posts.order_by(Submission.realupvotes - Submission.downvotes)
posts = posts.order_by(Submission.upvotes - Submission.downvotes)
elif sort == "comments":
posts = posts.order_by(Submission.comment_count.desc())
@ -407,11 +407,11 @@ def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all"):
elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial":
comments = comments.order_by(-1 * Comment.realupvotes * Comment.downvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes)
elif sort == "top":
comments = comments.order_by(Comment.downvotes - Comment.realupvotes)
comments = comments.order_by(Comment.realupvotes.desc())
elif sort == "bottom":
comments = comments.order_by(Comment.realupvotes - Comment.downvotes)
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
comments = comments.offset(25 * (page - 1)).limit(26).all()
return [x[0] for x in comments]

View File

@ -167,11 +167,11 @@ def post_id(pid, anything=None, v=None):
elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial":
comments = comments.order_by(-1 * Comment.realupvotes * Comment.downvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes)
elif sort == "top":
comments = comments.order_by(-Comment.realupvotes - Comment.downvotes)
comments = comments.order_by(-Comment.upvotes - Comment.downvotes)
elif sort == "bottom":
comments = comments.order_by(Comment.realupvotes - Comment.downvotes)
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
output = []
for c in comments.all():
@ -191,11 +191,11 @@ def post_id(pid, anything=None, v=None):
elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial":
comments = comments.order_by(-1 * Comment.realupvotes * Comment.downvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes)
elif sort == "top":
comments = comments.order_by(-Comment.realupvotes - Comment.downvotes)
comments = comments.order_by(-Comment.upvotes - Comment.downvotes)
elif sort == "bottom":
comments = comments.order_by(Comment.realupvotes - Comment.downvotes)
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
post.replies = comments.filter(Comment.is_pinned != None).all() + comments.filter(Comment.level == 1, Comment.is_pinned == None).all()

View File

@ -131,11 +131,11 @@ def searchposts(v):
elif sort == "old":
posts = posts.order_by(Submission.created_utc.asc())
elif sort == "controversial":
posts = posts.order_by(-1 * Submission.realupvotes * Submission.downvotes * Submission.downvotes)
posts = posts.order_by(-1 * Submission.upvotes * Submission.downvotes * Submission.downvotes)
elif sort == "top":
posts = posts.order_by(Submission.downvotes - Submission.realupvotes)
posts = posts.order_by(Submission.downvotes - Submission.upvotes)
elif sort == "bottom":
posts = posts.order_by(Submission.realupvotes - Submission.downvotes)
posts = posts.order_by(Submission.upvotes - Submission.downvotes)
elif sort == "comments":
posts = posts.order_by(Submission.comment_count.desc())
@ -230,11 +230,11 @@ def searchcomments(v):
elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial":
comments = comments.order_by(-1 * Comment.realupvotes * Comment.downvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes)
elif sort == "top":
comments = comments.order_by(Comment.downvotes - Comment.realupvotes)
comments = comments.order_by(Comment.realupvotes.desc())
elif sort == "bottom":
comments = comments.order_by(Comment.realupvotes - Comment.downvotes)
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
total = comments.count()

View File

@ -690,11 +690,11 @@ def u_username_comments(username, v=None):
elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial":
comments = comments.order_by(-1 * Comment.realupvotes * Comment.downvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes)
elif sort == "top":
comments = comments.order_by(Comment.downvotes - Comment.realupvotes)
comments = comments.order_by(Comment.realupvotes.desc())
elif sort == "bottom":
comments = comments.order_by(Comment.realupvotes - Comment.downvotes)
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
comments = comments.offset(25 * (page - 1)).limit(26).all()
ids = [x.id for x in comments]

View File

@ -119,7 +119,7 @@ def api_vote_post(post_id, new, v):
g.db.flush()
post.upvotes = g.db.query(Vote.id).filter_by(submission_id=post.id, vote_type=1).count()
post.downvotes = g.db.query(Vote.id).filter_by(submission_id=post.id, vote_type=-1).count()
post.realupvotes = g.db.query(Vote.id).filter_by(submission_id=post.id, vote_type=1, real=True).count()
post.realupvotes = g.db.query(Vote.id).filter_by(submission_id=post.id, vote_type=1, real=True).count() - g.db.query(Vote.id).filter_by(submission_id=post.id, vote_type=1, real=False).count() - g.db.query(Vote.id).filter_by(submission_id=post.id, vote_type=-1, real=True).count() + g.db.query(Vote.id).filter_by(submission_id=post.id, vote_type=-1, real=False).count()
g.db.add(post)
g.db.commit()
except: g.db.rollback()
@ -187,7 +187,7 @@ def api_vote_comment(comment_id, new, v):
g.db.flush()
comment.upvotes = g.db.query(CommentVote.id).filter_by(comment_id=comment.id, vote_type=1).count()
comment.downvotes = g.db.query(CommentVote.id).filter_by(comment_id=comment.id, vote_type=-1).count()
comment.realupvotes = g.db.query(CommentVote.id).filter_by(comment_id=comment.id, vote_type=1, real=True).count()
comment.realupvotes = g.db.query(CommentVote.id).filter_by(comment_id=comment.id, vote_type=1, real=True).count() - g.db.query(CommentVote.id).filter_by(comment_id=comment.id, vote_type=1, real=False).count() - g.db.query(CommentVote.id).filter_by(comment_id=comment.id, vote_type=-1, real=True).count() + g.db.query(CommentVote.id).filter_by(comment_id=comment.id, vote_type=-1, real=False).count()
g.db.add(comment)
g.db.commit()
except: g.db.rollback()

View File

@ -12,7 +12,7 @@
{% block fixedMobileBarJS %}
<script>
window.addEventListener('DOMContentLoaded', function() {
window.onload = function() {
var prevScrollpos = window.pageYOffset;
window.onscroll = function () {
var currentScrollPos = window.pageYOffset;
@ -33,7 +33,7 @@ window.addEventListener('DOMContentLoaded', function() {
prevScrollpos = currentScrollPos;
}
});
};
</script>
{% endblock %}

View File

@ -40,7 +40,7 @@
{% block fixedMobileBarJS %}
<script>
window.addEventListener('DOMContentLoaded', function() {
window.onload = function() {
var prevScrollpos = window.pageYOffset;
window.onscroll = function () {
var currentScrollPos = window.pageYOffset;
@ -61,7 +61,7 @@ window.addEventListener('DOMContentLoaded', function() {
prevScrollpos = currentScrollPos;
}
});
};
</script>
{% endblock %}

View File

@ -1,6 +1,6 @@
<script>
window.addEventListener('DOMContentLoaded', function() {
window.onload = function() {
const banModal = function(link, id, name) {
document.getElementById("banModalTitle").innerHTML = `Ban @${name}`;
document.getElementById("ban-modal-link").value = link;
@ -24,7 +24,7 @@ window.addEventListener('DOMContentLoaded', function() {
}
};
});
};
</script>
<div class="modal fade" id="banModal" tabindex="-1" role="dialog" aria-labelledby="banModalTitle" aria-hidden="true">

View File

@ -2,8 +2,8 @@
<script defer src="/assets/js/twitter.js" charset="utf-8">
</script>
<script>
window.addEventListener('DOMContentLoaded', function() {
window.onload = function() {
document.getElementById('twitter-widget-0').setAttribute('sandbox','')
});
};
</script>

View File

@ -2,8 +2,8 @@
<script defer src="https://platform.twitter.com/widgets.js" charset="utf-8">
</script>
<script>
window.addEventListener('DOMContentLoaded', function() {
window.onload = function() {
document.getElementById('twitter-widget-0').setAttribute('sandbox','')
});
};
</script>

View File

@ -84,7 +84,7 @@
</div>
</div>
<script defer src="/assets/js/emoji_modal.js?v=122"></script>
<script defer src="/assets/js/emoji_modal.js?v=123"></script>
<style>
a.emojitab {

View File

@ -1,14 +1,14 @@
{% extends "default.html" %}
{% block content %}
<script>
window.addEventListener('DOMContentLoaded', function() {
window.onload = function() {
function removeFollower(event, username) {
post_toast('/remove_follow/' + username);
let table = document.getElementById("followers-table");
table.removeChild(event.target.parentElement.parentElement);
}
});
};
</script>
<pre>

View File

@ -1,14 +1,14 @@
{% extends "default.html" %}
{% block content %}
<script>
window.addEventListener('DOMContentLoaded', function() {
window.onload = function() {
function removeFollower(event, username) {
post_toast('/unfollow/' + username);
let table = document.getElementById("followers-table");
table.removeChild(event.target.parentElement.parentElement);
}
});
};
</script>
<pre>

View File

@ -112,7 +112,7 @@
<button class="dropdown-item copy-link" data-clipboard-text="/signup?ref={{v.username}}"><i class="fad fa-user-friends fa-fw text-left mr-3"></i>Invite friends</button>
</div>
<div class="px-2">
<a class="dropdown-item" href="/assets/{{'SITE_NAME' | app_config}}.apk?v=2"><i class="fab fa-android fa-fw text-left mr-3"></i>Android app</a>
<a class="dropdown-item" href="/assets/{{'SITE_NAME' | app_config}}.apk?v=3"><i class="fab fa-android fa-fw text-left mr-3"></i>Android app</a>
<a class="dropdown-item" href="/rules"><i class="fas fa-balance-scale fa-fw text-left mr-3"></i>Rules</a>
@ -176,7 +176,7 @@
<li class="nav-item">
<a class="nav-link" href="/settings"><i class="fas fa-cog fa-fw mr-3"></i>Settings</a>
</li>
<a class="nav-item nav-link" href="/assets/{{'SITE_NAME' | app_config}}.apk?v=2"><i class="fab fa-android fa-fw mr-3"></i>Android app</a>
<a class="nav-item nav-link" href="/assets/{{'SITE_NAME' | app_config}}.apk?v=3"><i class="fab fa-android fa-fw mr-3"></i>Android app</a>
<a class="nav-item nav-link" href="/rules"><i class="fas fa-balance-scale fa-fw mr-3"></i>Rules</a>

View File

@ -7,13 +7,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<meta name="thumbnail" content="/assets/images/{{'SITE_NAME' | app_config}}/preview.webp?v=2">
<meta name="thumbnail" content="/assets/images/{{'SITE_NAME' | app_config}}/preview.webp?v=3">
<link rel="icon" type="image/png" href="/assets/images/{{'SITE_NAME' | app_config}}/icon.webp?v=4">
<meta property="og:type" content="article" >
<meta property="og:title" content="{{'SITE_NAME' | app_config}}" >
<meta property="og:site_name" content="{{request.host}}" >
<meta property="og:image" content="{{'SITE_NAME' | app_config}}/assets/images/{{'SITE_NAME' | app_config}}/preview.webp?v=2" >
<meta property="og:image" content="{{'SITE_NAME' | app_config}}/assets/images/{{'SITE_NAME' | app_config}}/preview.webp?v=3" >
<meta property="og:url" content="{{request.path | full_link}}">
<meta property="og:description" name="description" content="{{'SITE_NAME' | app_config}} - {{'SLOGAN' | app_config}}">
<meta property="og:author" name="author" content="{{request.host_url}}" >
@ -24,7 +24,7 @@
<meta name="twitter:title" content="{{'SITE_NAME' | app_config}}" >
<meta name="twitter:creator" content="{{request.host_url}}">
<meta name="twitter:description" content="{{'SITE_NAME' | app_config}} - {{'SLOGAN' | app_config}}" >
<meta name="twitter:image" content="/assets/images/{{'SITE_NAME' | app_config}}/preview.webp?v=2" >
<meta name="twitter:image" content="/assets/images/{{'SITE_NAME' | app_config}}/preview.webp?v=3" >
<meta name="twitter:url" content="{{request.path | full_link}}" >

View File

@ -6,7 +6,7 @@
<script>
window.addEventListener('DOMContentLoaded', function() {
window.onload = function() {
block_user=function() {
var exileForm = document.getElementById("exile-form");
@ -41,7 +41,7 @@ window.addEventListener('DOMContentLoaded', function() {
}
}
});
};
</script>
<div class="row">

View File

@ -38,7 +38,7 @@
</div>
{% if v.agendaposter %}
<script>
window.addEventListener('DOMContentLoaded', function() {
window.onload = function() {
const flip = (e) => {
e.preventDefault();
document.getElementsByTagName("body")[0].setAttribute("style", "-moz-transform: scale(-1, -1);-o-transform: scale(-1, -1);-webkit-transform: scale(-1, -1);transform: scale(-1, -1);");
@ -46,7 +46,7 @@ window.addEventListener('DOMContentLoaded', function() {
document.getElementById("submit-btn").onclick = flip;
});
};
</script>
{% endif %}
</div>

View File

@ -9,7 +9,7 @@
<meta property="og:type" content="article" >
<meta property="og:title" content="{{'SITE_NAME' | app_config}}" >
<meta property="og:site_name" content="{{request.host}}" >
<meta property="og:image" content="{{'SITE_NAME' | app_config}}/assets/images/{{'SITE_NAME' | app_config}}/preview.webp?v=2" >
<meta property="og:image" content="{{'SITE_NAME' | app_config}}/assets/images/{{'SITE_NAME' | app_config}}/preview.webp?v=3" >
<meta property="og:url" content="{{request.host}}">
<meta property="og:description" name="description" content="{{'SITE_NAME' | app_config}} - {{'SLOGAN' | app_config}}">
<meta property="og:author" name="author" content="{{request.host_url}}" >
@ -20,7 +20,7 @@
<meta name="twitter:title" content="{{'SITE_NAME' | app_config}}" >
<meta name="twitter:creator" content="{{request.host_url}}">
<meta name="twitter:description" content="{{'SITE_NAME' | app_config}} - {{'SLOGAN' | app_config}}" >
<meta name="twitter:image" content="{{'SITE_NAME' | app_config}}/assets/images/{{'SITE_NAME' | app_config}}/preview.webp?v=2" >
<meta name="twitter:image" content="{{'SITE_NAME' | app_config}}/assets/images/{{'SITE_NAME' | app_config}}/preview.webp?v=3" >
<meta name="twitter:url" content="{{request.host}}" >
<title>{% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}Sign up - {{'SITE_NAME' | app_config}}{% endif %}</title>

View File

@ -10,7 +10,7 @@
<meta property="og:type" content="article" >
<meta property="og:title" content="{{'SITE_NAME' | app_config}}" >
<meta property="og:site_name" content="{{request.host}}" >
<meta property="og:image" content="{{'SITE_NAME' | app_config}}/assets/images/{{'SITE_NAME' | app_config}}/preview.webp?v=2" >
<meta property="og:image" content="{{'SITE_NAME' | app_config}}/assets/images/{{'SITE_NAME' | app_config}}/preview.webp?v=3" >
<meta property="og:url" content="{{request.host}}">
<meta property="og:description" name="description" content="{{'SITE_NAME' | app_config}} - {{'SLOGAN' | app_config}}">
<meta property="og:author" name="author" content="{{request.host_url}}" >
@ -21,7 +21,7 @@
<meta name="twitter:title" content="{{'SITE_NAME' | app_config}}" >
<meta name="twitter:creator" content="{{request.host_url}}">
<meta name="twitter:description" content="{{'SITE_NAME' | app_config}} - {{'SLOGAN' | app_config}}" >
<meta name="twitter:image" content="{{'SITE_NAME' | app_config}}/assets/images/{{'SITE_NAME' | app_config}}/preview.webp?v=2" >
<meta name="twitter:image" content="{{'SITE_NAME' | app_config}}/assets/images/{{'SITE_NAME' | app_config}}/preview.webp?v=3" >
<meta name="twitter:url" content="{{request.host}}" >
<title>{% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}{{'SITE_NAME' | app_config}}{% endif %}</title>

View File

@ -35,7 +35,7 @@
{% if v %}
<script>
window.addEventListener('DOMContentLoaded', function() {
window.onload = function() {
const TRANSFER_TAX = {% if v.patron or u.patron %}0{% else %}0.03{% endif %};
function updateTax(mobile=false) {
@ -68,13 +68,13 @@ window.addEventListener('DOMContentLoaded', function() {
setTimeout(_ => t.disabled = false, 2000);
}
});
};
</script>
{% endif %}
{% if u.song %}
<script>
window.addEventListener('DOMContentLoaded', function() {
window.onload = function() {
var audio = new Audio('/songs/{{u.id}}');
audio.loop=true;
@ -104,7 +104,7 @@ window.addEventListener('DOMContentLoaded', function() {
});
});
};
</script>
{% endif %}

View File

@ -4,7 +4,7 @@
{% block fixedMobileBarJS %}
<script>
window.addEventListener('DOMContentLoaded', function() {
window.onload = function() {
var prevScrollpos = window.pageYOffset;
window.onscroll = function () {
var currentScrollPos = window.pageYOffset;
@ -25,7 +25,7 @@ window.addEventListener('DOMContentLoaded', function() {
prevScrollpos = currentScrollPos;
}
});
};
</script>
{% endblock %}

View File

@ -4,7 +4,7 @@
{% block fixedMobileBarJS %}
<script>
window.addEventListener('DOMContentLoaded', function() {
window.onload = function() {
var prevScrollpos = window.pageYOffset;
window.onscroll = function () {
var currentScrollPos = window.pageYOffset;
@ -25,7 +25,7 @@ window.addEventListener('DOMContentLoaded', function() {
prevScrollpos = currentScrollPos;
}
});
};
</script>
{% endblock %}

View File

@ -4,7 +4,7 @@
{% block fixedMobileBarJS %}
<script>
window.addEventListener('DOMContentLoaded', function() {
window.onload = function() {
var prevScrollpos = window.pageYOffset;
window.onscroll = function () {
var currentScrollPos = window.pageYOffset;
@ -25,7 +25,7 @@ window.addEventListener('DOMContentLoaded', function() {
prevScrollpos = currentScrollPos;
}
});
};
</script>
{% endblock %}