From 9416852615946848a0f2bb6f8e84fb49b89600ec Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 23 Dec 2021 15:32:17 +0200 Subject: [PATCH] sfd --- files/helpers/const.py | 2 ++ files/routes/static.py | 11 ++++++++--- files/routes/users.py | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 2e3721145..e901ef531 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -84,6 +84,8 @@ SLURS = { "china flu": "SARS-CoV-2 syndemic", "china virus": "SARS-CoV-2 syndemic", "kung flu": "SARS-CoV-2 syndemic", + "elon musk": "rocket daddy", + " elon ": " rocket daddy ", } LONGPOST_REPLIES = ['Wow, you must be a JP fan.', 'This is one of the worst posts I have EVER seen. Delete it.', "No, don't reply like this, please do another wall of unhinged rant please.", '# 😴😴😴', "Ma'am we've been over this before. You need to stop.", "I've known more coherent downies.", "Your pulitzer's in the mail", "That's great and all, but I asked for my burger without cheese.", 'That degree finally paying off', "That's nice sweaty. Why don't you have a seat in the time out corner with Pizzashill until you calm down, then you can have your Capri Sun.", "All them words won't bring your pa back.", "You had a chance to not be completely worthless, but it looks like you threw it away. At least you're consistent.", 'Some people are able to display their intelligence by going on at length on a subject and never actually saying anything. This ability is most common in trades such as politics, public relations, and law. You have impressed me by being able to best them all, while still coming off as an absolute idiot.', "You can type 10,000 characters and you decided that these were the one's that you wanted.", 'Have you owned the libs yet?', "I don't know what you said, because I've seen another human naked.", 'Impressive. Normally people with such severe developmental disabilities struggle to write much more than a sentence or two. He really has exceded our expectations for the writing portion. Sadly the coherency of his writing, along with his abilities in the social skills and reading portions, are far behind his peers with similar disabilities.', "This is a really long way of saying you don't fuck.", "Sorry ma'am, looks like his delusions have gotten worse. We'll have to admit him,", ':#marseywoah:', 'If only you could put that energy into your relationships', 'Posts like this is why I do Heroine.', 'still unemployed then?', 'K', 'look im gunna have 2 ask u 2 keep ur giant dumps in the toilet not in my replys 😷😷😷', "Mommy is soooo proud of you, sweaty. Let's put this sperg out up on the fridge with all your other failures.", "Good job bobby, here's a star", "That was a mistake. You're about to find out the hard way why.", 'You sat down and wrote all this shit. You could have done so many other things with your life. What happened to your life that made you decide writing novels of bullshit on rdrama.net was the best option?', "I don't have enough spoons to read this shit", "All those words won't bring daddy back.", 'OUT!'] diff --git a/files/routes/static.py b/files/routes/static.py index d8263f205..4c90ed5d4 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -293,8 +293,11 @@ def static_service2(path): return resp @app.get('/assets/') +@app.get('/static/assets/') @limiter.exempt def static_service(path): + if request.path.startswith('/assets/'): return redirect(request.full_path.replace('/assets/', '/static/assets/')) + resp = make_response(send_from_directory('assets', path)) if request.path.endswith('.webp') or request.path.endswith('.gif') or request.path.endswith('.ttf') or request.path.endswith('.woff') or request.path.endswith('.woff2'): resp.headers.remove("Cache-Control") @@ -306,11 +309,13 @@ def static_service(path): return resp -@app.get('/images/') -@app.get('/IMAGES/') -@app.get('/hostedimages/') +@app.get('/images/') +@app.get('/hostedimages/') +@app.get("/static/images/") @limiter.exempt def images(path): + if request.path.startswith('/images/') or request.path.lower().startswith('/hostedimages/'): + return redirect(request.full_path.replace('/images/', '/static/images/').replace('/hostedimages/', '/static/images/')) resp = make_response(send_from_directory('/images', path.replace('.WEBP','.webp'))) resp.headers.remove("Cache-Control") resp.headers.add("Cache-Control", "public, max-age=2628000") diff --git a/files/routes/users.py b/files/routes/users.py index c57c7968d..6d1280f1e 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -318,11 +318,13 @@ def songs(id): try: id = int(id) except: return "", 400 user = g.db.query(User).filter_by(id=id).first() - if user and user.song: return redirect(f"/song/{user.song}.mp3") + if user and user.song: return redirect(f"/static/song/{user.song}.mp3") else: abort(404) @app.get("/song/") +@app.get("/static/song/") def song(song): + if request.path.startswith('/song/'): return redirect(request.full_path.replace('/song/', '/static/song/')) resp = make_response(send_from_directory('/songs', song)) resp.headers.remove("Cache-Control") resp.headers.add("Cache-Control", "public, max-age=2628000")