modified: app.py
modified: templates/playlists.html
This commit is contained in:
3
app.py
3
app.py
@@ -320,7 +320,8 @@ def invite():
|
|||||||
expires = datetime.utcnow() + timedelta(minutes=duration)
|
expires = datetime.utcnow() + timedelta(minutes=duration)
|
||||||
invites[token] = expires
|
invites[token] = expires
|
||||||
invite_link = url_for('guest_join', token=token, _external=True)
|
invite_link = url_for('guest_join', token=token, _external=True)
|
||||||
return render_template("invite.html", invite_link=invite_link, expires=expires)
|
# Gib nur den Link als Klartext zurück!
|
||||||
|
return invite_link
|
||||||
|
|
||||||
@app.route("/invite/<token>")
|
@app.route("/invite/<token>")
|
||||||
def guest_join(token):
|
def guest_join(token):
|
||||||
|
|||||||
@@ -200,18 +200,10 @@ function generateInviteLink() {
|
|||||||
const duration = document.getElementById('inviteDuration').value || 60;
|
const duration = document.getElementById('inviteDuration').value || 60;
|
||||||
fetch(`/invite?duration=${duration}`)
|
fetch(`/invite?duration=${duration}`)
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(html => {
|
.then(link => {
|
||||||
// Extrahiere den Link aus dem HTML (da /invite ein Template rendert)
|
document.getElementById('inviteLinkInput').value = link;
|
||||||
const match = html.match(/href="([^"]+)"/);
|
|
||||||
if (match) {
|
|
||||||
document.getElementById('inviteLinkInput').value = match[1];
|
|
||||||
document.getElementById('inviteLinkInput').style.display = '';
|
document.getElementById('inviteLinkInput').style.display = '';
|
||||||
document.getElementById('copyInviteBtn').style.display = '';
|
document.getElementById('copyInviteBtn').style.display = '';
|
||||||
} else {
|
|
||||||
document.getElementById('inviteLinkInput').value = "Error generating link.";
|
|
||||||
document.getElementById('inviteLinkInput').style.display = '';
|
|
||||||
document.getElementById('copyInviteBtn').style.display = 'none';
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function copyInviteLink() {
|
function copyInviteLink() {
|
||||||
|
|||||||
Reference in New Issue
Block a user