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.complete.min.js
|
||||||
lib/tom-select/tom-select.css
|
lib/tom-select/tom-select.css
|
||||||
lib/vis-9.1.2/vis-network.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,
|
default=False,
|
||||||
help="Show database statistics (most frequent sites engines and tags).",
|
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_group = parser.add_argument_group(
|
||||||
'Output options', 'Options to change verbosity and view of the console output'
|
'Output options', 'Options to change verbosity and view of the console output'
|
||||||
@@ -484,6 +492,10 @@ async def main():
|
|||||||
elif args.verbose:
|
elif args.verbose:
|
||||||
log_level = logging.WARNING
|
log_level = logging.WARNING
|
||||||
logger.setLevel(log_level)
|
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 initial list
|
||||||
usernames = {
|
usernames = {
|
||||||
|
|||||||
@@ -53,5 +53,6 @@
|
|||||||
"xmind_report": false,
|
"xmind_report": false,
|
||||||
"graph_report": false,
|
"graph_report": false,
|
||||||
"pdf_report": false,
|
"pdf_report": false,
|
||||||
"html_report": false
|
"html_report": false,
|
||||||
|
"web_interface_port": 5000
|
||||||
}
|
}
|
||||||
@@ -42,6 +42,7 @@ class Settings:
|
|||||||
pdf_report: bool
|
pdf_report: bool
|
||||||
html_report: bool
|
html_report: bool
|
||||||
graph_report: bool
|
graph_report: bool
|
||||||
|
web_interface_port: int
|
||||||
|
|
||||||
# submit mode settings
|
# submit mode settings
|
||||||
presence_strings: list
|
presence_strings: list
|
||||||
|
|||||||
+11
-14
@@ -151,20 +151,17 @@ def download_report(filename):
|
|||||||
logging.error(f"Error serving file {filename}: {str(e)}")
|
logging.error(f"Error serving file {filename}: {str(e)}")
|
||||||
return "File not found", 404
|
return "File not found", 404
|
||||||
|
|
||||||
@app.route('/view_graph/<path:graph_path>')
|
#@app.route('/view_graph/<path:graph_path>')
|
||||||
def view_graph(graph_path):
|
#def view_graph(graph_path):
|
||||||
"""Serve the graph HTML directly"""
|
# """Serve the graph HTML directly"""
|
||||||
graph_file = os.path.join(REPORTS_FOLDER, graph_path)
|
# graph_file = os.path.join(REPORTS_FOLDER, graph_path)
|
||||||
try:
|
# try:
|
||||||
with open(graph_file, 'r', encoding='utf-8') as f:
|
# with open(graph_file, 'r', encoding='utf-8') as f:
|
||||||
content = f.read()
|
# content = f.read()
|
||||||
return content
|
# return content
|
||||||
except FileNotFoundError:
|
# except Exception as e:
|
||||||
logging.error(f"Graph file not found: {graph_file}")
|
# logging.error(f"Error serving graph {graph_file}: {str(e)}")
|
||||||
return "Graph not found", 404
|
# return "Error loading graph", 500
|
||||||
except Exception as e:
|
|
||||||
logging.error(f"Error serving graph {graph_file}: {str(e)}")
|
|
||||||
return "Error loading graph", 500
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
@@ -70,6 +70,8 @@ networkx = "^2.6.3"
|
|||||||
pyvis = "^0.3.2"
|
pyvis = "^0.3.2"
|
||||||
reportlab = "^4.2.0"
|
reportlab = "^4.2.0"
|
||||||
cloudscraper = "^1.2.71"
|
cloudscraper = "^1.2.71"
|
||||||
|
flask = {extras = ["async"], version = "^3.1.0"}
|
||||||
|
asgiref = "^3.8.1"
|
||||||
|
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
|
|||||||
Reference in New Issue
Block a user