diff --git a/files/assets/js/userpage.js b/files/assets/js/userpage.js index 4c63e7afe..eb72ee595 100644 --- a/files/assets/js/userpage.js +++ b/files/assets/js/userpage.js @@ -1,12 +1,12 @@ const playing = localStorage.getItem("playing") -let uid = document.getElementById('uid') +let u_username = document.getElementById('u_username') -if (uid) +if (u_username) { - uid = uid.innerHTML + u_username = u_username.innerHTML - let audio = new Audio(`/songs/${uid}`); + let audio = new Audio(`/@${u_username}/song`); audio.loop=true; function toggle() { @@ -37,14 +37,14 @@ if (uid) } else { - let uid = document.getElementById('vid') - if (uid) + let v_username = document.getElementById('v_username') + if (v_username) { - uid = uid.innerHTML + v_username = v_username.innerHTML const paused = localStorage.getItem("paused") - let audio = new Audio(`/songs/${uid}`); + let audio = new Audio(`/@${v_username}/song`); audio.loop=true; function toggle() { diff --git a/files/routes/users.py b/files/routes/users.py index 81e48cf2d..1263e6a73 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -397,14 +397,6 @@ def get_profilecss(v, username): resp.headers.add("Content-Type", "text/css") return resp -@app.get("/songs/") -def songs(id): - try: id = int(id) - except: return "", 400 - user = g.db.query(User).filter_by(id=id).one_or_none() - if user and user.song: return redirect(f"/static/song/{user.song}.mp3") - else: abort(404) - @app.get("/@/song") def usersong(username): user = get_user(username) diff --git a/files/templates/userpage.html b/files/templates/userpage.html index a4b8528de..8822d9cbc 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -686,9 +686,9 @@ {% if u.song%} {% if v and v.id == u.id %} -
{{v.id}}
+
{{v.username}}
{% else %} -
{{u.id}}
+
{{u.username}}
{% endif %} {% endif %} @@ -698,7 +698,7 @@
{{u.username}}
{% endif %} - + {% endblock %} diff --git a/files/templates/userpage_comments.html b/files/templates/userpage_comments.html index dd61690bf..32cfef2ee 100644 --- a/files/templates/userpage_comments.html +++ b/files/templates/userpage_comments.html @@ -114,5 +114,5 @@
{{u.username}}
{% endif %} - + {% endblock %} \ No newline at end of file diff --git a/files/templates/userpage_private.html b/files/templates/userpage_private.html index 8077dd551..a166116da 100644 --- a/files/templates/userpage_private.html +++ b/files/templates/userpage_private.html @@ -48,5 +48,5 @@
{{u.username}}
{% endif %} - + {% endblock %} \ No newline at end of file