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

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