-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(api): bump v0.2.0 (#minor) app version Signed-off-by: hayk96 <hayko5999@gmail.com> --------- Signed-off-by: hayk96 <hayko5999@gmail.com>
- Loading branch information
Showing
17 changed files
with
1,370 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from .. v1.endpoints import reverse_proxy, rules | ||
from .. v1.endpoints import reverse_proxy, rules, web | ||
from fastapi import APIRouter | ||
|
||
api_router = APIRouter() | ||
api_router.include_router(rules.router, prefix="/api/v1") | ||
api_router.include_router(web.router, prefix="") | ||
api_router.add_route("/{path:path}", reverse_proxy._reverse_proxy, ["GET", "POST", "PUT"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from starlette.responses import FileResponse | ||
from fastapi.responses import HTMLResponse | ||
from src.utils.arguments import arg_parser | ||
from src.utils.log import logger | ||
from fastapi import APIRouter | ||
from fastapi import Request | ||
|
||
router = APIRouter() | ||
|
||
if arg_parser().get("web.enable_ui") == "true": | ||
rules_management = "ui/rules-management" | ||
logger.info("Starting web management UI") | ||
|
||
@router.get("/", response_class=HTMLResponse, | ||
description="Renders home page of this application", | ||
include_in_schema=False) | ||
async def homepage(): | ||
return FileResponse("ui/homepage/index.html") | ||
|
||
@router.get("/rules-management", | ||
description="Renders rules management HTML page of this application", | ||
include_in_schema=False) | ||
async def rules_management_page(): | ||
return FileResponse(f"{rules_management}/index.html") | ||
|
||
@router.get( | ||
"/rules-management/{path}", | ||
description="Returns JavaScript and CSS files of the rules management page", | ||
include_in_schema=False) | ||
async def rules_management_files(path, request: Request): | ||
if path in ["script.js", "style.css"]: | ||
return FileResponse(f"{rules_management}/{path}") | ||
sts, msg = "404", "Not Found" | ||
logger.info( | ||
msg=msg, | ||
extra={ | ||
"status": sts, | ||
"method": request.method, | ||
"request_path": request.url.path}) | ||
return f"{sts} {msg}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.