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);
xhr.onload=function(){
const permalink = xhr.response
console.log(permalink)
if (permalink) {
system.innerHTML = `<span class='text-danger'>This is a repost of <a href=${permalink}>${permalink}</a></span>`;
try {data = JSON.parse(xhr.response)}
catch(e) {console.log(e)}
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)

View file

@ -854,8 +854,8 @@ def api_is_repost():
Submission.deleted_utc == 0,
Submission.is_banned == False
).first()
if repost: return repost.permalink
else: return ''
if repost: return {'permalink': repost.permalink}
else: return {'permalink': ''}
@app.post("/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/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 "gif_modal.html" %}