mirror of
https://github.com/soxoj/maigret.git
synced 2026-05-06 22:19:01 +00:00
update webinterface
This commit is contained in:
@@ -48,3 +48,6 @@ lib/bindings/utils.js
|
||||
lib/tom-select/tom-select.complete.min.js
|
||||
lib/tom-select/tom-select.css
|
||||
lib/vis-9.1.2/vis-network.css
|
||||
poetry.lock
|
||||
filetree.sh
|
||||
poetry.lock
|
||||
|
||||
@@ -324,6 +324,14 @@ def setup_arguments_parser(settings: Settings):
|
||||
default=False,
|
||||
help="Show database statistics (most frequent sites engines and tags).",
|
||||
)
|
||||
modes_group.add_argument(
|
||||
"--web",
|
||||
action="store",
|
||||
metavar='PORT',
|
||||
type=int,
|
||||
default=settings.web_interface_port,
|
||||
help="Launches the web interface on the specified port (Default: 5000).",
|
||||
)
|
||||
|
||||
output_group = parser.add_argument_group(
|
||||
'Output options', 'Options to change verbosity and view of the console output'
|
||||
@@ -484,6 +492,10 @@ async def main():
|
||||
elif args.verbose:
|
||||
log_level = logging.WARNING
|
||||
logger.setLevel(log_level)
|
||||
|
||||
if args.web:
|
||||
from maigret.web.app import app
|
||||
app.run(port=args.web) # Use the port from arguments
|
||||
|
||||
# Usernames initial list
|
||||
usernames = {
|
||||
|
||||
@@ -53,5 +53,6 @@
|
||||
"xmind_report": false,
|
||||
"graph_report": false,
|
||||
"pdf_report": false,
|
||||
"html_report": false
|
||||
"html_report": false,
|
||||
"web_interface_port": 5000
|
||||
}
|
||||
@@ -42,6 +42,7 @@ class Settings:
|
||||
pdf_report: bool
|
||||
html_report: bool
|
||||
graph_report: bool
|
||||
web_interface_port: int
|
||||
|
||||
# submit mode settings
|
||||
presence_strings: list
|
||||
|
||||
+11
-14
@@ -151,20 +151,17 @@ def download_report(filename):
|
||||
logging.error(f"Error serving file {filename}: {str(e)}")
|
||||
return "File not found", 404
|
||||
|
||||
@app.route('/view_graph/<path:graph_path>')
|
||||
def view_graph(graph_path):
|
||||
"""Serve the graph HTML directly"""
|
||||
graph_file = os.path.join(REPORTS_FOLDER, graph_path)
|
||||
try:
|
||||
with open(graph_file, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
return content
|
||||
except FileNotFoundError:
|
||||
logging.error(f"Graph file not found: {graph_file}")
|
||||
return "Graph not found", 404
|
||||
except Exception as e:
|
||||
logging.error(f"Error serving graph {graph_file}: {str(e)}")
|
||||
return "Error loading graph", 500
|
||||
#@app.route('/view_graph/<path:graph_path>')
|
||||
#def view_graph(graph_path):
|
||||
# """Serve the graph HTML directly"""
|
||||
# graph_file = os.path.join(REPORTS_FOLDER, graph_path)
|
||||
# try:
|
||||
# with open(graph_file, 'r', encoding='utf-8') as f:
|
||||
# content = f.read()
|
||||
# return content
|
||||
# except Exception as e:
|
||||
# logging.error(f"Error serving graph {graph_file}: {str(e)}")
|
||||
# return "Error loading graph", 500
|
||||
|
||||
if __name__ == '__main__':
|
||||
logging.basicConfig(
|
||||
@@ -70,6 +70,8 @@ networkx = "^2.6.3"
|
||||
pyvis = "^0.3.2"
|
||||
reportlab = "^4.2.0"
|
||||
cloudscraper = "^1.2.71"
|
||||
flask = {extras = ["async"], version = "^3.1.0"}
|
||||
asgiref = "^3.8.1"
|
||||
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
|
||||
Reference in New Issue
Block a user