mirror of
https://github.com/fHDHR/fHDHR_NextPVR.git
synced 2025-12-06 04:26:57 -05:00
Enhance Diagnostics Page
This commit is contained in:
parent
d9e0cc13dd
commit
244472792e
@ -9,6 +9,9 @@ class Channels():
|
||||
endpoints = ["/api/channels"]
|
||||
endpoint_name = "api_channels"
|
||||
endpoint_methods = ["GET", "POST"]
|
||||
endpoint_default_parameters = {
|
||||
"method": "get"
|
||||
}
|
||||
|
||||
def __init__(self, fhdhr):
|
||||
self.fhdhr = fhdhr
|
||||
|
||||
@ -7,6 +7,9 @@ class Cluster():
|
||||
endpoints = ["/api/cluster"]
|
||||
endpoint_name = "api_cluster"
|
||||
endpoint_methods = ["GET", "POST"]
|
||||
endpoint_default_parameters = {
|
||||
"method": "get"
|
||||
}
|
||||
|
||||
def __init__(self, fhdhr):
|
||||
self.fhdhr = fhdhr
|
||||
|
||||
@ -5,6 +5,11 @@ class Images():
|
||||
endpoints = ["/api/images"]
|
||||
endpoint_name = "api_images"
|
||||
endpoint_methods = ["GET", "POST"]
|
||||
endpoint_default_parameters = {
|
||||
"method": "generate",
|
||||
"type": "content",
|
||||
"message": "Internal Image Handling"
|
||||
}
|
||||
|
||||
def __init__(self, fhdhr):
|
||||
self.fhdhr = fhdhr
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
from flask import request, redirect, session
|
||||
from flask import request, redirect, Response, session
|
||||
import urllib.parse
|
||||
import threading
|
||||
import time
|
||||
import json
|
||||
|
||||
|
||||
class Settings():
|
||||
@ -23,7 +24,28 @@ class Settings():
|
||||
method = request.args.get('method', default="get", type=str)
|
||||
redirect_url = request.args.get('redirect', default=None, type=str)
|
||||
|
||||
if method == "update":
|
||||
if method == "get":
|
||||
web_settings_dict = {}
|
||||
for config_section in list(self.fhdhr.config.conf_default.keys()):
|
||||
web_settings_dict[config_section] = {}
|
||||
|
||||
for config_item in list(self.fhdhr.config.conf_default[config_section].keys()):
|
||||
real_config_section = config_section
|
||||
if config_section == self.fhdhr.config.dict["main"]["dictpopname"]:
|
||||
real_config_section = "origin"
|
||||
web_settings_dict[config_section][config_item] = {
|
||||
"value": self.fhdhr.config.dict[real_config_section][config_item],
|
||||
}
|
||||
if self.fhdhr.config.conf_default[config_section][config_item]["config_web_hidden"]:
|
||||
web_settings_dict[config_section][config_item]["value"] = "***********"
|
||||
|
||||
return_json = json.dumps(web_settings_dict, indent=4)
|
||||
|
||||
return Response(status=200,
|
||||
response=return_json,
|
||||
mimetype='application/json')
|
||||
|
||||
elif method == "update":
|
||||
config_section = request.form.get('config_section', None)
|
||||
config_name = request.form.get('config_name', None)
|
||||
config_value = request.form.get('config_value', None)
|
||||
|
||||
@ -7,6 +7,9 @@ class API_Tools():
|
||||
endpoints = ["/api/tools"]
|
||||
endpoint_name = "api_tools"
|
||||
endpoint_methods = ["GET", "POST"]
|
||||
endpoint_default_parameters = {
|
||||
"method": "get"
|
||||
}
|
||||
|
||||
def __init__(self, fhdhr):
|
||||
self.fhdhr = fhdhr
|
||||
@ -20,7 +23,15 @@ class API_Tools():
|
||||
|
||||
redirect_url = request.args.get('redirect', default=None, type=str)
|
||||
|
||||
if method == "prettyjson":
|
||||
if method == "get":
|
||||
|
||||
return_json = json.dumps({"tools": "api for tools page"}, indent=4)
|
||||
|
||||
return Response(status=200,
|
||||
response=return_json,
|
||||
mimetype='application/json')
|
||||
|
||||
elif method == "prettyjson":
|
||||
|
||||
dirty_json_url = request.form.get('url', None)
|
||||
|
||||
|
||||
@ -10,6 +10,9 @@ class Tuners():
|
||||
endpoints = ["/api/tuners"]
|
||||
endpoint_name = "api_tuners"
|
||||
endpoint_methods = ["GET", "POST"]
|
||||
endpoint_default_parameters = {
|
||||
"method": "status"
|
||||
}
|
||||
|
||||
def __init__(self, fhdhr):
|
||||
self.fhdhr = fhdhr
|
||||
@ -29,7 +32,7 @@ class Tuners():
|
||||
|
||||
method = request.args.get('method', default=self.fhdhr.config.dict["fhdhr"]["stream_type"], type=str)
|
||||
|
||||
tuner_number = request.args.get('tuner', None, type=str)
|
||||
tuner_number = request.args.get('tuner', default=None, type=str)
|
||||
|
||||
redirect_url = request.args.get('redirect', default=None, type=str)
|
||||
|
||||
|
||||
@ -9,8 +9,8 @@ from .xmltv_html import xmlTV_HTML
|
||||
from .version_html import Version_HTML
|
||||
from .diagnostics_html import Diagnostics_HTML
|
||||
from .settings_html import Settings_HTML
|
||||
from .channels_editor import Channels_Editor_HTML
|
||||
from .tools import Tools_HTML
|
||||
from .channels_editor_html import Channels_Editor_HTML
|
||||
from .tools_html import Tools_HTML
|
||||
|
||||
|
||||
class fHDHR_Pages():
|
||||
@ -20,7 +20,7 @@ class fHDHR_Pages():
|
||||
|
||||
self.index_html = Index_HTML(fhdhr)
|
||||
self.channels_html = Channels_HTML(fhdhr)
|
||||
self.channels_editor = Channels_Editor_HTML(fhdhr)
|
||||
self.channels_editor_html = Channels_Editor_HTML(fhdhr)
|
||||
self.guide_html = Guide_HTML(fhdhr)
|
||||
self.cluster_html = Cluster_HTML(fhdhr)
|
||||
self.tuners_html = Tuners_HTML(fhdhr)
|
||||
@ -28,4 +28,4 @@ class fHDHR_Pages():
|
||||
self.version_html = Version_HTML(fhdhr)
|
||||
self.diagnostics_html = Diagnostics_HTML(fhdhr)
|
||||
self.settings_html = Settings_HTML(fhdhr)
|
||||
self.tools = Tools_HTML(fhdhr)
|
||||
self.tools_html = Tools_HTML(fhdhr)
|
||||
|
||||
@ -35,9 +35,15 @@ class Diagnostics_HTML():
|
||||
button_link += "%s=%s" % (parameter, parameter_val)
|
||||
button_link = button_link.replace("<devicekey>", self.fhdhr.config.dict["main"]["uuid"])
|
||||
button_link = button_link.replace("<base_url>", base_url)
|
||||
button_dict[route_group].append({
|
||||
curr_button_dict = {
|
||||
"label": session["route_list"][route_group][route_item]["pretty_name"],
|
||||
"link": button_link,
|
||||
})
|
||||
"methods": ",".join(session["route_list"][route_group][route_item]["endpoint_methods"]),
|
||||
"button": True
|
||||
}
|
||||
if ("GET" not in session["route_list"][route_group][route_item]["endpoint_methods"]
|
||||
or "<tuner_number>" in button_link or "<channel>" in button_link):
|
||||
curr_button_dict["button"] = False
|
||||
button_dict[route_group].append(curr_button_dict)
|
||||
|
||||
return render_template('diagnostics.html', session=session, request=request, fhdhr=self.fhdhr, button_dict=button_dict, list=list)
|
||||
|
||||
@ -13,12 +13,20 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Link</th>
|
||||
<th>Methods</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for button_item in button_dict[route_group] %}
|
||||
<tr>
|
||||
<td><button onclick="location.href='{{ button_item["link"] }}'" type="button">{{ button_item["label"] }}</button></td>
|
||||
<td>
|
||||
{% if button_item["button"] %}
|
||||
<button onclick="location.href='{{ button_item["link"] }}'" type="button">{{ button_item["label"] }}</button>
|
||||
{% else %}
|
||||
<a>{{ button_item["link"] }}</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td><a>{{ button_item["methods"] }}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user