diff --git a/web/app.py b/web/app.py
index 3c7f820..18c4cf7 100644
--- a/web/app.py
+++ b/web/app.py
@@ -1,53 +1,18 @@
-from fastapi import FastAPI, Form, UploadFile
+from fastapi import FastAPI, Form, Request
from fastapi.responses import FileResponse, HTMLResponse
-import asyncio
+from fastapi.templating import Jinja2Templates
import os
app = FastAPI()
+# Указываем директории для статических файлов и шаблонов
+templates = Jinja2Templates(directory=os.path.dirname(os.path.realpath(__file__)))
+app.mount("/static", StaticFiles(directory="static"), name="static")
+
@app.get("/")
-async def get_form():
- html_content = """
-
-
-
-
-
- DNS Resolver Settings
-
-
- Настройки
-
-
-
- """
- return HTMLResponse(content=html_content)
+async def get_form(request: Request):
+ # Загружаем HTML шаблон (index.html) и передаем в него данные
+ return templates.TemplateResponse("index.html", {"request": request})
@app.post("/run")
async def run_dns_resolver(
@@ -55,7 +20,9 @@ async def run_dns_resolver(
dns_servers: list[str] = Form(...),
cloudflare: str = Form(...),
aggregation: str = Form(...),
- format: str = Form(...)
+ format: str = Form(...),
+ gateway: str = Form(None),
+ commentary: str = Form(None)
):
# Генерация config.ini
config_path = "config.ini"
@@ -66,6 +33,10 @@ async def run_dns_resolver(
config.write(f"cloudflare={cloudflare}\n")
config.write(f"subnet={aggregation}\n")
config.write(f"filetype={format}\n")
+ if gateway:
+ config.write(f"gateway={gateway}\n")
+ if commentary:
+ config.write(f"commentary={commentary}\n")
# Запуск скрипта
result_file = "output.txt"
diff --git a/web/index.html b/web/index.html
index 7f0614e..facb130 100644
--- a/web/index.html
+++ b/web/index.html
@@ -185,4 +185,4 @@
Прогресс выполнения будет отображаться здесь...