презентация и немного кода

This commit is contained in:
2023-04-27 19:21:09 +07:00
parent a8efe9c895
commit 23a56ae0c7
6 changed files with 6 additions and 21 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

+1 -2
View File
@@ -1,10 +1,9 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<title>Login</title>
<title>audio resive</title>
<link href="{{ url_for('static', path='/css/index.css') }}" rel="stylesheet">
</head>
<body>
<div class="container">
<h1>Login</h1>
+2 -16
View File
@@ -4,41 +4,27 @@
<script src="https://kit.fontawesome.com/025ae7f87a.js" crossorigin="anonymous"></script>
<script src="{{ url_for('static', path='/js/player.js') }}"></script>
<link href="{{ url_for('static', path='/css/log.css') }}" rel="stylesheet">
<title>audio resive</title>
</head>
<body>
<div class="container">
<h1>My Audio Files</h1>
{% for lo in log %}
<div class="card-container"> <!-- изменено на card-container -->
<div class="card-container">
<div class="player-container" id="player-container-{{ loop.index }}"></div>
<script>
new AudioPlayer({container: '#player-container-{{ loop.index }}', audioFile: '{{ lo.audio_file }}'});
</script>
<div class="card">
<div class="card-title">{{ lo.title }}</div>
{% if lo.text %}
<div class="card-text"> {% for line in lo.text %} {{ line }}<br> {% endfor %}</div>
{% else %}
<div class="card-text">No text file found.</div>
{% endif %}
</div>
</div>
{% endfor %}
</div>
</body>
</html>
+1 -1
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<title>Logs</title>
<title>audio resive</title>
<link href="{{ url_for('static', path='/css/logs.css') }}" rel="stylesheet">
</head>
+2 -2
View File
@@ -23,7 +23,7 @@ async def login(password: str = Form(...)):
response = responses.RedirectResponse(url="/logs", status_code=303)
response.set_cookie(key="logged_in", value="true")
return response
return {"message": "Invalid password"}
return {"message": "Неправильный пароль"}
@app.get("/logs", response_class=responses.HTMLResponse)
@@ -31,7 +31,7 @@ async def logs(request: Request, logged_in: bool = Depends(is_logged_in)):
if logged_in:
return templates.TemplateResponse("logs.html", {"request": request, "logs": get_logs()})
else:
responses.RedirectResponse(url="/login", status_code=303)
return responses.RedirectResponse(url="/", status_code=303)
@app.get("/logs/{log_id}", response_class=responses.HTMLResponse)
Binary file not shown.