forked from rDrama/rDrama
use audio tags so i can use preload="None" and hopefully help site speed
parent
78237167e3
commit
b39c2ad216
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 %}
|
||||
|
|
Loading…
Reference in New Issue