Revert back to using goqr.me API for comment QR

DDG doesn't seem to work in "production" for some reason, while it works
perfectly fine locally :/
This commit is contained in:
daudix
2024-03-30 21:38:06 +03:00
parent 790e77d615
commit 1dd9b457ca
3 changed files with 5 additions and 16 deletions

View File

@ -17,18 +17,7 @@
<section id="comments">
{% if config.extra.comments.show_qr %}
<img id="qrcode" class="no-hover pixels" alt="QR code to a Mastodon post" src="">
<script>
const apiUrl = "http://api.duckduckgo.com/?q=qr%20https://{{ host }}/@{{ username }}/{{ id }}&format=json";
fetch(apiUrl)
.then(response => response.json())
.then(data => {
const base64Data = data.Answer.match(/src="([^"]*)"/)[1];
document.getElementById("qrcode").src = base64Data;
})
.catch(error => console.error("Error fetching QR code:", error));
</script>
<img id="qrcode" class="no-hover pixels" alt="QR code to a Mastodon post" src="https://api.qrserver.com/v1/create-qr-code/?data=https://{{ host }}/@{{ username }}/{{ id }}&format=gif" />
{% endif %}
<h2>Comments</h2>
<p>