mirror of
https://github.com/sfiorini/iptv-server.git
synced 2026-04-09 07:30:44 +00:00
Added static files and favicon route
This commit is contained in:
10
src/main.py
10
src/main.py
@@ -1,7 +1,10 @@
|
||||
import os
|
||||
from fastapi.responses import RedirectResponse
|
||||
import uvicorn
|
||||
from fastapi import FastAPI
|
||||
from fastapi.security import HTTPBasic
|
||||
from routers import admin, content
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
|
||||
app = FastAPI()
|
||||
security = HTTPBasic()
|
||||
@@ -11,9 +14,16 @@ admin_security = HTTPBasic()
|
||||
async def health_check():
|
||||
return {"status": "healthy"}
|
||||
|
||||
@app.get("/favicon.ico")
|
||||
async def get_favicon():
|
||||
return RedirectResponse(url="/logo.png")
|
||||
|
||||
app.include_router(admin.router)
|
||||
app.include_router(content.router)
|
||||
|
||||
static_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static")
|
||||
app.mount("/", StaticFiles(directory=static_path, html=True), name="static")
|
||||
|
||||
if __name__ == "__main__":
|
||||
uvicorn.run(
|
||||
"main:app",
|
||||
|
||||
55
src/static/index.html
Normal file
55
src/static/index.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>IPTV Service</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
line-height: 1.6;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
.container {
|
||||
background-color: white;
|
||||
padding: 30px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
}
|
||||
h1 {
|
||||
color: #2c3e50;
|
||||
border-bottom: 2px solid #3498db;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
.api-links {
|
||||
margin-top: 20px;
|
||||
}
|
||||
a {
|
||||
color: #3498db;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Welcome to the IPTV Service</h1>
|
||||
<p>This service provides API endpoints for managing IPTV users and content.</p>
|
||||
|
||||
<div class="api-links">
|
||||
<h2>API Documentation:</h2>
|
||||
<ul>
|
||||
<li><a href="/docs">Interactive Swagger UI</a></li>
|
||||
<li><a href="/redoc">ReDoc Documentation</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p>For service administration, please use the authorized endpoints.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
src/static/logo.png
Normal file
BIN
src/static/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 121 KiB |
Reference in New Issue
Block a user