This commit is contained in:
Aevann1 2022-04-10 02:11:06 +02:00
parent 7bbc1d75ab
commit 08203a791d
3 changed files with 11 additions and 7 deletions

View file

@ -113,10 +113,14 @@ function checkRepost(t) {
form.append("url", url); form.append("url", url);
xhr.onload=function(){ xhr.onload=function(){
const permalink = xhr.response try {data = JSON.parse(xhr.response)}
console.log(permalink) catch(e) {console.log(e)}
if (permalink) {
system.innerHTML = `<span class='text-danger'>This is a repost of <a href=${permalink}>${permalink}</a></span>`; if (data && data["permalink"]) {
const permalink = data["permalink"]
if (permalink) {
system.innerHTML = `<span class='text-danger'>This is a repost of <a href=${permalink}>${permalink}</a></span>`;
}
} }
} }
xhr.send(form) xhr.send(form)

View file

@ -854,8 +854,8 @@ def api_is_repost():
Submission.deleted_utc == 0, Submission.deleted_utc == 0,
Submission.is_banned == False Submission.is_banned == False
).first() ).first()
if repost: return repost.permalink if repost: return {'permalink': repost.permalink}
else: return '' else: return {'permalink': ''}
@app.post("/submit") @app.post("/submit")
@app.post("/h/<sub>/submit") @app.post("/h/<sub>/submit")

View file

@ -268,7 +268,7 @@
<script src="/assets/js/marked.js?v=250"></script> <script src="/assets/js/marked.js?v=250"></script>
<script src="/assets/js/formatting.js?v=240"></script> <script src="/assets/js/formatting.js?v=240"></script>
<script src="/assets/js/submit.js?v=252"></script> <script src="/assets/js/submit.js?v=253"></script>
{% include "emoji_modal.html" %} {% include "emoji_modal.html" %}
{% include "gif_modal.html" %} {% include "gif_modal.html" %}