Skip to content

Commit

Permalink
more easter egg
Browse files Browse the repository at this point in the history
Co-authored-by: pbaekgaard <pbaekgaard@users.noreply.github.com>
  • Loading branch information
FredTheNoob and pbaekgaard committed Nov 23, 2023
1 parent 58a0ebf commit d0e88e1
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 15 deletions.
31 changes: 18 additions & 13 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,30 @@
from fastapi import FastAPI, HTTPException, Request
from fastapi.responses import HTMLResponse
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
from pathlib import Path
from fastapi.templating import Jinja2Templates

app = FastAPI()

app.mount("/public", StaticFiles(directory="public"), name="public")

templates = Jinja2Templates(directory="public")
app = FastAPI(title="API")

# @app.on_event("startup")
# async def startEvent():
# await main()

@app.get("/", response_class=HTMLResponse)
async def mainpage():
app.mount(
"/static",
StaticFiles(directory="static"),
name="static",
)

@app.get('/')
async def root(request: Request):
return templates.TemplateResponse(
"index.html", {"request": request}
)

return """
<link rel="stylesheet" href="/public/style.css">
<html>
<audio id="important" autoplay loop src="/public/boombastic.mp3"></audio>
</html>
"""



@app.get("/entitymentions")
Expand Down Expand Up @@ -114,4 +119,4 @@ async def main():
)

with open("entity_mentions.json", "w", encoding="utf8") as entityJson:
json.dump(entsJSON, entityJson, ensure_ascii=False, indent=4)
json.dump(entsJSON, entityJson, ensure_ascii=False, indent=4)
Binary file removed public/boombastic.mp3
Binary file not shown.
21 changes: 21 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<link href="{{ url_for('static', path='/style.css') }}" rel="stylesheet">
<html>
<body id="root" style='background-image: url("{{ url_for('static', path='/kurt.webp') }}"); background-position: center; background-repeat: no-repeat; background-size: cover;'>
<div id="background">
<audio allow="autoplay" id="important" autoplay loop src="{{ url_for('static', path='/boombastic.mp3') }}"></audio>
</div>
</body>
</html>
<script>
const background = document.getElementById('background')
const audio = document.getElementById("important")
let playing = false
background.onclick = () => {
if (playing) {
audio.pause()
playing = false
} else
audio.play()
playing = true
}
</script>
Binary file added static/boombastic.mp3
Binary file not shown.
File renamed without changes.
14 changes: 12 additions & 2 deletions public/style.css → static/style.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
* {
background-image: url("/public/important_images/kurt.webp");
#background {
width: 100%;
height: 100%;
overflow: hidden;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}

* {
margin: 0;
padding: 0;
height: 100vh;
width: 100vw;
}

0 comments on commit d0e88e1

Please sign in to comment.