forked from rDrama/rDrama
1
0
Fork 0

use audio tags so i can use preload="None" and hopefully help site speed

master
Aevann 2023-10-12 22:58:28 +03:00
parent 78237167e3
commit b39c2ad216
3 changed files with 2 additions and 18 deletions

View File

@ -1,5 +1,6 @@
let u_username = document.getElementById('u_username')
const audio = document.getElementById('profile-song')
const anthem_button = document.getElementById('toggle-anthem')
const anthem_button_mobile = document.getElementById('toggle-anthem-mobile')
@ -23,9 +24,6 @@ if (u_username)
{
u_username = u_username.innerHTML
let audio = new Audio(`/@${u_username}/song`);
audio.loop = true;
function toggle() {
if (audio.paused) {
play_audio(audio);
@ -53,9 +51,6 @@ else
const paused = localStorage.getItem("paused")
let audio = new Audio(`/@${v_username}/song`);
audio.loop = true;
function toggle() {
if (audio.paused)
{

View File

@ -570,18 +570,6 @@ def get_profilecss(username):
resp.headers["Content-Type"] = "text/css"
return resp
@app.get("/@<username>/song")
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
def usersong(username):
user = get_user(username)
if not user.song:
abort(404)
resp = make_response(redirect(f"/songs/{user.song}.mp3"))
resp.headers["Cache-Control"] = "no-store"
return resp
@app.post("/subscribe/<int:post_id>")
@limiter.limit('1/second', scope=rpath)
@limiter.limit('1/second', scope=rpath, key_func=get_ID)

View File

@ -28,6 +28,7 @@
{% endif %}
<script defer src="{{'js/userpage.js' | asset}}"></script>
{% if can_see(v, u) and u.song %}
<audio id="profile-song" hidden preload="none" src="/songs/{{u.song}}.mp3" loop></audio>
<script defer src="{{'js/profile_song.js' | asset}}"></script>
{% endif %}
{% endblock %}