-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to the WebGUI: changes to jinja2 templates, uses FastAPI serv…
…er, hides login button when session_store is null, fixes double slash issue.
- Loading branch information
Showing
20 changed files
with
359 additions
and
334 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +0,0 @@ | ||
"""Python __init__ file that provides the path to the module | ||
SPDX-FileCopyrightText: 2020 IntelMQ Team <[email protected]> | ||
SPDX-License-Identifier: AGPL-3.0-or-later | ||
""" | ||
import pathlib | ||
from .version import __version__, __version_info__ # noqa | ||
|
||
path = pathlib.Path(__file__).parent | ||
This file was deleted.
Oops, something went wrong.
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,101 @@ | ||
# SPDX-FileCopyrightText: 2023 IntelMQ Team | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
import collections | ||
import pathlib | ||
|
||
from fastapi import APIRouter, Request | ||
from fastapi.responses import HTMLResponse | ||
from fastapi.templating import Jinja2Templates | ||
|
||
from intelmq.app.config import config | ||
|
||
SHOW_LOGIN = True if config.session_store else False | ||
|
||
router = APIRouter(default_response_class=HTMLResponse) | ||
templates_dir = pathlib.Path(__file__).parent / "templates" | ||
templates = Jinja2Templates(directory=templates_dir) | ||
Page = collections.namedtuple("Page", ["name", "title", "url", "icon_url"]) | ||
|
||
|
||
def get_pages(request: Request): | ||
return [ | ||
Page( | ||
name="configs", | ||
title="Configuration", | ||
url=request.url_for('get_configuration'), | ||
icon_url=request.url_for('static', path='images/configuration.png'), | ||
), | ||
Page( | ||
name="management", | ||
title="Management", | ||
url=request.url_for('get_management'), | ||
icon_url=request.url_for('static', path='images/management.png'), | ||
), | ||
Page( | ||
name="monitor", | ||
title="Monitor", | ||
url=request.url_for('get_monitor'), | ||
icon_url=request.url_for('static', path='images/monitor.png'), | ||
), | ||
Page( | ||
name="check", | ||
title="Check", | ||
url=request.url_for('get_check'), | ||
icon_url=request.url_for('static', path='images/check.png'), | ||
), | ||
Page( | ||
name="about", | ||
title="About", | ||
url=request.url_for('get_about'), | ||
icon_url=request.url_for('static', path='images/about.png'), | ||
) | ||
] | ||
|
||
|
||
@router.get("/", include_in_schema=False) | ||
async def get_index(request: Request): | ||
return templates.TemplateResponse("index.html", { | ||
"request": request, | ||
"pages": get_pages(request) | ||
}) | ||
|
||
|
||
@router.get("/configuration", include_in_schema=False) | ||
async def get_configuration(request: Request): | ||
return templates.TemplateResponse("configuration.html", { | ||
"request": request, | ||
"pages": get_pages(request) | ||
}) | ||
|
||
|
||
@router.get("/management", include_in_schema=False) | ||
def get_management(request: Request): | ||
return templates.TemplateResponse("management.html", { | ||
"request": request, | ||
"pages": get_pages(request) | ||
}) | ||
|
||
|
||
@router.get("/monitor", include_in_schema=False) | ||
def get_monitor(request: Request): | ||
return templates.TemplateResponse("monitor.html", { | ||
"request": request, | ||
"pages": get_pages(request) | ||
}) | ||
|
||
|
||
@router.get("/check", include_in_schema=False) | ||
def get_check(request: Request): | ||
return templates.TemplateResponse("check.html", { | ||
"request": request, | ||
"pages": get_pages(request) | ||
}) | ||
|
||
|
||
@router.get("/about", include_in_schema=False) | ||
def get_about(request: Request): | ||
return templates.TemplateResponse("about.html", { | ||
"request": request, | ||
"pages": get_pages(request) | ||
}) |
File renamed without changes
File renamed without changes
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
This file was deleted.
Oops, something went wrong.
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,8 +1,11 @@ | ||
## SPDX-FileCopyrightText: 2020 IntelMQ Team <[email protected]> | ||
## SPDX-License-Identifier: AGPL-3.0-or-later | ||
{#SPDX-FileCopyrightText: 2020 IntelMQ Team <intelmq-team@cert.at>#} | ||
{#SPDX-License-Identifier: AGPL-3.0-or-later#} | ||
|
||
<%inherit file="base.mako" /> | ||
{% extends "base.html" %} | ||
|
||
{% block title %}About{% endblock %} | ||
|
||
{% block content %} | ||
<!-- Page Content --> | ||
<div id="page-wrapper"> | ||
<div class="row" style="padding: 20px"> | ||
|
@@ -51,8 +54,6 @@ | |
<h2>Version</h2> | ||
<table class="table"> | ||
<tr><td>IntelMQ<td><td id="intelmq-version"></td></tr> | ||
<tr><td>IntelMQ API<td><td id="intelmq-api-version"></td></tr> | ||
<tr><td>IntelMQ Manager<td><td id="intelmq-manager-version"></td></tr> | ||
</table> | ||
</div> | ||
</div> | ||
|
@@ -63,3 +64,8 @@ <h2 id="debugging-heading" class="waiting">Debugging</h2> | |
</div> | ||
</div> | ||
</div> | ||
{% endblock %} | ||
|
||
{% block javascript %} | ||
<script src="{{ url_for('static', path='js/about.js') }}"></script> | ||
{% endblock %} |
Oops, something went wrong.