mirror of
https://github.com/fHDHR/fHDHR_NextPVR.git
synced 2025-12-06 07:56:57 -05:00
Implement access_levels and route_list
This commit is contained in:
parent
602e74f565
commit
4093a8c135
@ -34,6 +34,8 @@ class fHDHR_HTTP_Server():
|
|||||||
# Set Secret Key For Sessions
|
# Set Secret Key For Sessions
|
||||||
self.fhdhr.app.secret_key = self.fhdhr.config.dict["fhdhr"]["friendlyname"]
|
self.fhdhr.app.secret_key = self.fhdhr.config.dict["fhdhr"]["friendlyname"]
|
||||||
|
|
||||||
|
self.route_list = {}
|
||||||
|
|
||||||
self.fhdhr.logger.info("Loading HTTP Pages Endpoints.")
|
self.fhdhr.logger.info("Loading HTTP Pages Endpoints.")
|
||||||
self.pages = fHDHR_Pages(fhdhr)
|
self.pages = fHDHR_Pages(fhdhr)
|
||||||
self.add_endpoints(self.pages, "pages")
|
self.add_endpoints(self.pages, "pages")
|
||||||
@ -83,6 +85,7 @@ class fHDHR_HTTP_Server():
|
|||||||
|
|
||||||
session["session_id"] = str(uuid.uuid4())
|
session["session_id"] = str(uuid.uuid4())
|
||||||
session["instance_id"] = self.instance_id
|
session["instance_id"] = self.instance_id
|
||||||
|
session["route_list"] = self.route_list
|
||||||
|
|
||||||
session["is_internal_api"] = self.detect_internal_api(request)
|
session["is_internal_api"] = self.detect_internal_api(request)
|
||||||
if session["is_internal_api"]:
|
if session["is_internal_api"]:
|
||||||
@ -151,6 +154,10 @@ class fHDHR_HTTP_Server():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def add_endpoints(self, index_list, index_name):
|
def add_endpoints(self, index_list, index_name):
|
||||||
|
|
||||||
|
if index_name not in list(self.route_list.keys()):
|
||||||
|
self.route_list[index_name] = {}
|
||||||
|
|
||||||
item_list = [x for x in dir(index_list) if self.isapath(x)]
|
item_list = [x for x in dir(index_list) if self.isapath(x)]
|
||||||
for item in item_list:
|
for item in item_list:
|
||||||
endpoints = eval("self." + str(index_name) + "." + str(item) + ".endpoints")
|
endpoints = eval("self." + str(index_name) + "." + str(item) + ".endpoints")
|
||||||
@ -158,11 +165,38 @@ class fHDHR_HTTP_Server():
|
|||||||
endpoints = [endpoints]
|
endpoints = [endpoints]
|
||||||
handler = eval("self." + str(index_name) + "." + str(item))
|
handler = eval("self." + str(index_name) + "." + str(item))
|
||||||
endpoint_name = eval("self." + str(index_name) + "." + str(item) + ".endpoint_name")
|
endpoint_name = eval("self." + str(index_name) + "." + str(item) + ".endpoint_name")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
endpoint_methods = eval("self." + str(index_name) + "." + str(item) + ".endpoint_methods")
|
endpoint_methods = eval("self." + str(index_name) + "." + str(item) + ".endpoint_methods")
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
endpoint_methods = ['GET']
|
endpoint_methods = ['GET']
|
||||||
|
|
||||||
|
try:
|
||||||
|
endpoint_access_level = eval("self." + str(index_name) + "." + str(item) + ".endpoint_access_level")
|
||||||
|
except AttributeError:
|
||||||
|
endpoint_access_level = 0
|
||||||
|
|
||||||
|
try:
|
||||||
|
pretty_name = eval("self." + str(index_name) + "." + str(item) + ".pretty_name")
|
||||||
|
except AttributeError:
|
||||||
|
pretty_name = endpoint_name
|
||||||
|
|
||||||
|
try:
|
||||||
|
endpoint_default_parameters = eval("self." + str(index_name) + "." + str(item) + ".endpoint_default_parameters")
|
||||||
|
except AttributeError:
|
||||||
|
endpoint_default_parameters = {}
|
||||||
|
|
||||||
self.fhdhr.logger.debug("Adding endpoint %s available at %s with %s methods." % (endpoint_name, ",".join(endpoints), ",".join(endpoint_methods)))
|
self.fhdhr.logger.debug("Adding endpoint %s available at %s with %s methods." % (endpoint_name, ",".join(endpoints), ",".join(endpoint_methods)))
|
||||||
|
|
||||||
|
if endpoint_name not in list(self.route_list[index_name].keys()):
|
||||||
|
self.route_list[index_name][endpoint_name] = {}
|
||||||
|
self.route_list[index_name][endpoint_name]["name"] = endpoint_name
|
||||||
|
self.route_list[index_name][endpoint_name]["endpoints"] = endpoints
|
||||||
|
self.route_list[index_name][endpoint_name]["endpoint_methods"] = endpoint_methods
|
||||||
|
self.route_list[index_name][endpoint_name]["endpoint_access_level"] = endpoint_access_level
|
||||||
|
self.route_list[index_name][endpoint_name]["endpoint_default_parameters"] = endpoint_default_parameters
|
||||||
|
self.route_list[index_name][endpoint_name]["pretty_name"] = pretty_name
|
||||||
|
|
||||||
for endpoint in endpoints:
|
for endpoint in endpoints:
|
||||||
self.add_endpoint(endpoint=endpoint,
|
self.add_endpoint(endpoint=endpoint,
|
||||||
endpoint_name=endpoint_name,
|
endpoint_name=endpoint_name,
|
||||||
|
|||||||
@ -12,6 +12,8 @@ from .tuners import Tuners
|
|||||||
from .debug import Debug_JSON
|
from .debug import Debug_JSON
|
||||||
from .tools import API_Tools
|
from .tools import API_Tools
|
||||||
|
|
||||||
|
from .route_list import Route_List
|
||||||
|
|
||||||
from .images import Images
|
from .images import Images
|
||||||
|
|
||||||
|
|
||||||
@ -33,4 +35,6 @@ class fHDHR_API():
|
|||||||
self.debug = Debug_JSON(fhdhr)
|
self.debug = Debug_JSON(fhdhr)
|
||||||
self.tools = API_Tools(fhdhr)
|
self.tools = API_Tools(fhdhr)
|
||||||
|
|
||||||
|
self.route_list = Route_List(fhdhr)
|
||||||
|
|
||||||
self.images = Images(fhdhr)
|
self.images = Images(fhdhr)
|
||||||
|
|||||||
37
fHDHR_web/api/route_list.py
Normal file
37
fHDHR_web/api/route_list.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
from flask import Response, request, redirect, session
|
||||||
|
import urllib.parse
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
class Route_List():
|
||||||
|
endpoints = ["/api/routes"]
|
||||||
|
endpoint_name = "api_routes"
|
||||||
|
endpoint_methods = ["GET", "POST"]
|
||||||
|
|
||||||
|
def __init__(self, fhdhr):
|
||||||
|
self.fhdhr = fhdhr
|
||||||
|
|
||||||
|
def __call__(self, *args):
|
||||||
|
return self.get(*args)
|
||||||
|
|
||||||
|
def get(self, *args):
|
||||||
|
|
||||||
|
method = request.args.get('method', default="get", type=str)
|
||||||
|
|
||||||
|
redirect_url = request.args.get('redirect', default=None, type=str)
|
||||||
|
|
||||||
|
if method == "get":
|
||||||
|
|
||||||
|
return_json = json.dumps(session["route_list"], indent=4)
|
||||||
|
|
||||||
|
return Response(status=200,
|
||||||
|
response=return_json,
|
||||||
|
mimetype='application/json')
|
||||||
|
|
||||||
|
else:
|
||||||
|
return "%s Invalid Method" % method
|
||||||
|
|
||||||
|
if redirect_url:
|
||||||
|
return redirect(redirect_url + "?retmessage=" + urllib.parse.quote("%s Success" % method))
|
||||||
|
else:
|
||||||
|
return "%s Success" % method
|
||||||
@ -6,6 +6,8 @@ from fHDHR.tools import channel_sort
|
|||||||
class Channels_Editor_HTML():
|
class Channels_Editor_HTML():
|
||||||
endpoints = ["/channels_editor", "/channels_editor.html"]
|
endpoints = ["/channels_editor", "/channels_editor.html"]
|
||||||
endpoint_name = "page_channels_editor_html"
|
endpoint_name = "page_channels_editor_html"
|
||||||
|
endpoint_access_level = 2
|
||||||
|
pretty_name = "Channels Editor"
|
||||||
|
|
||||||
def __init__(self, fhdhr):
|
def __init__(self, fhdhr):
|
||||||
self.fhdhr = fhdhr
|
self.fhdhr = fhdhr
|
||||||
|
|||||||
@ -6,6 +6,8 @@ from fHDHR.tools import channel_sort
|
|||||||
class Channels_HTML():
|
class Channels_HTML():
|
||||||
endpoints = ["/channels", "/channels.html"]
|
endpoints = ["/channels", "/channels.html"]
|
||||||
endpoint_name = "page_channels_html"
|
endpoint_name = "page_channels_html"
|
||||||
|
endpoint_access_level = 0
|
||||||
|
pretty_name = "Channels"
|
||||||
|
|
||||||
def __init__(self, fhdhr):
|
def __init__(self, fhdhr):
|
||||||
self.fhdhr = fhdhr
|
self.fhdhr = fhdhr
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import urllib.parse
|
|||||||
class Cluster_HTML():
|
class Cluster_HTML():
|
||||||
endpoints = ["/cluster", "/cluster.html"]
|
endpoints = ["/cluster", "/cluster.html"]
|
||||||
endpoint_name = "page_cluster_html"
|
endpoint_name = "page_cluster_html"
|
||||||
|
endpoint_access_level = 1
|
||||||
|
pretty_name = "Cluster/SSDP"
|
||||||
|
|
||||||
def __init__(self, fhdhr):
|
def __init__(self, fhdhr):
|
||||||
self.fhdhr = fhdhr
|
self.fhdhr = fhdhr
|
||||||
|
|||||||
@ -4,6 +4,8 @@ from flask import request, render_template, session
|
|||||||
class Diagnostics_HTML():
|
class Diagnostics_HTML():
|
||||||
endpoints = ["/diagnostics", "/diagnostics.html"]
|
endpoints = ["/diagnostics", "/diagnostics.html"]
|
||||||
endpoint_name = "page_diagnostics_html"
|
endpoint_name = "page_diagnostics_html"
|
||||||
|
endpoint_access_level = 2
|
||||||
|
pretty_name = "Diagnostics"
|
||||||
|
|
||||||
def __init__(self, fhdhr):
|
def __init__(self, fhdhr):
|
||||||
self.fhdhr = fhdhr
|
self.fhdhr = fhdhr
|
||||||
@ -15,111 +17,27 @@ class Diagnostics_HTML():
|
|||||||
|
|
||||||
base_url = request.url_root[:-1]
|
base_url = request.url_root[:-1]
|
||||||
|
|
||||||
button_list = []
|
button_dict = {}
|
||||||
|
|
||||||
button_list.append({
|
for route_group in list(session["route_list"].keys()):
|
||||||
"label": "Debug Json",
|
if route_group not in ["pages", "brython", "files"]:
|
||||||
"hdhr": None,
|
button_dict[route_group] = []
|
||||||
"rmg": None,
|
for route_item in list(session["route_list"][route_group].keys()):
|
||||||
"other": "/api/debug",
|
if not session["route_list"][route_group][route_item]["name"].startswith("page_"):
|
||||||
})
|
button_link = session["route_list"][route_group][route_item]["endpoints"][0]
|
||||||
|
parameter_index = 0
|
||||||
|
for parameter in list(session["route_list"][route_group][route_item]["endpoint_default_parameters"].keys()):
|
||||||
|
parameter_val = session["route_list"][route_group][route_item]["endpoint_default_parameters"][parameter]
|
||||||
|
if not parameter_index:
|
||||||
|
button_link += "?"
|
||||||
|
else:
|
||||||
|
button_link += "&"
|
||||||
|
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({
|
||||||
|
"label": session["route_list"][route_group][route_item]["pretty_name"],
|
||||||
|
"link": button_link,
|
||||||
|
})
|
||||||
|
|
||||||
button_list.append({
|
return render_template('diagnostics.html', session=session, request=request, fhdhr=self.fhdhr, button_dict=button_dict, list=list)
|
||||||
"label": "Cluster Json",
|
|
||||||
"hdhr": None,
|
|
||||||
"rmg": None,
|
|
||||||
"other": "/api/cluster?method=get",
|
|
||||||
})
|
|
||||||
|
|
||||||
button_list.append({
|
|
||||||
"label": "Lineup XML",
|
|
||||||
"hdhr": "/lineup.xml",
|
|
||||||
"rmg": None,
|
|
||||||
"other": None,
|
|
||||||
})
|
|
||||||
|
|
||||||
button_list.append({
|
|
||||||
"label": "Lineup JSON",
|
|
||||||
"hdhr": "/hdhr/lineup.json",
|
|
||||||
"rmg": None,
|
|
||||||
"other": None,
|
|
||||||
})
|
|
||||||
|
|
||||||
button_list.append({
|
|
||||||
"label": "Lineup Status",
|
|
||||||
"hdhr": "/hdhr/lineup_status.json",
|
|
||||||
"rmg": None,
|
|
||||||
"other": None,
|
|
||||||
})
|
|
||||||
|
|
||||||
button_list.append({
|
|
||||||
"label": "Discover Json",
|
|
||||||
"hdhr": "/hdhr/discover.json",
|
|
||||||
"rmg": None,
|
|
||||||
"other": None,
|
|
||||||
})
|
|
||||||
|
|
||||||
button_list.append({
|
|
||||||
"label": "Device XML",
|
|
||||||
"hdhr": "/hdhr/device.xml",
|
|
||||||
"rmg": "/rmg/device.xml",
|
|
||||||
"other": None,
|
|
||||||
})
|
|
||||||
|
|
||||||
button_list.append({
|
|
||||||
"label": "RMG Identification XML",
|
|
||||||
"hdhr": "",
|
|
||||||
"rmg": "/rmg",
|
|
||||||
"other": None,
|
|
||||||
})
|
|
||||||
|
|
||||||
button_list.append({
|
|
||||||
"label": "RMG Devices Discover",
|
|
||||||
"hdhr": "",
|
|
||||||
"rmg": "/rmg/devices/discover",
|
|
||||||
"other": None,
|
|
||||||
})
|
|
||||||
|
|
||||||
button_list.append({
|
|
||||||
"label": "RMG Devices Probe",
|
|
||||||
"hdhr": "",
|
|
||||||
"rmg": "/rmg/devices/probe?uri=%s" % base_url,
|
|
||||||
"other": None,
|
|
||||||
})
|
|
||||||
|
|
||||||
button_list.append({
|
|
||||||
"label": "RMG Devices by DeviceKey",
|
|
||||||
"hdhr": "",
|
|
||||||
"rmg": "/rmg/devices/%s" % self.fhdhr.config.dict["main"]["uuid"],
|
|
||||||
"other": None,
|
|
||||||
})
|
|
||||||
|
|
||||||
button_list.append({
|
|
||||||
"label": "RMG Channels by DeviceKey",
|
|
||||||
"hdhr": "",
|
|
||||||
"rmg": "/rmg/devices/%s/channels" % self.fhdhr.config.dict["main"]["uuid"],
|
|
||||||
"other": None,
|
|
||||||
})
|
|
||||||
|
|
||||||
button_list.append({
|
|
||||||
"label": "RMG Scanners by DeviceKey",
|
|
||||||
"hdhr": "",
|
|
||||||
"rmg": "/rmg/devices/%s/scanners" % self.fhdhr.config.dict["main"]["uuid"],
|
|
||||||
"other": None,
|
|
||||||
})
|
|
||||||
|
|
||||||
button_list.append({
|
|
||||||
"label": "RMG Networks by DeviceKey",
|
|
||||||
"hdhr": "",
|
|
||||||
"rmg": "/rmg/devices/%s/networks" % self.fhdhr.config.dict["main"]["uuid"],
|
|
||||||
"other": None,
|
|
||||||
})
|
|
||||||
|
|
||||||
button_list.append({
|
|
||||||
"label": "RMG Scan by DeviceKey",
|
|
||||||
"hdhr": "",
|
|
||||||
"rmg": "/rmg/devices/%s/scan" % self.fhdhr.config.dict["main"]["uuid"],
|
|
||||||
"other": None,
|
|
||||||
})
|
|
||||||
|
|
||||||
return render_template('diagnostics.html', session=session, request=request, fhdhr=self.fhdhr, button_list=button_list)
|
|
||||||
|
|||||||
@ -7,6 +7,8 @@ from fHDHR.tools import humanized_time, channel_sort
|
|||||||
class Guide_HTML():
|
class Guide_HTML():
|
||||||
endpoints = ["/guide", "/guide.html"]
|
endpoints = ["/guide", "/guide.html"]
|
||||||
endpoint_name = "page_guide_html"
|
endpoint_name = "page_guide_html"
|
||||||
|
endpoint_access_level = 0
|
||||||
|
pretty_name = "Guide"
|
||||||
|
|
||||||
def __init__(self, fhdhr):
|
def __init__(self, fhdhr):
|
||||||
self.fhdhr = fhdhr
|
self.fhdhr = fhdhr
|
||||||
|
|||||||
@ -4,6 +4,8 @@ from flask import request, render_template, session
|
|||||||
class Index_HTML():
|
class Index_HTML():
|
||||||
endpoints = ["/index", "/index.html"]
|
endpoints = ["/index", "/index.html"]
|
||||||
endpoint_name = "page_index_html"
|
endpoint_name = "page_index_html"
|
||||||
|
endpoint_access_level = 0
|
||||||
|
pretty_name = "Index"
|
||||||
|
|
||||||
def __init__(self, fhdhr):
|
def __init__(self, fhdhr):
|
||||||
self.fhdhr = fhdhr
|
self.fhdhr = fhdhr
|
||||||
|
|||||||
@ -4,6 +4,8 @@ from flask import request, render_template, session
|
|||||||
class Settings_HTML():
|
class Settings_HTML():
|
||||||
endpoints = ["/settings", "/settings.html"]
|
endpoints = ["/settings", "/settings.html"]
|
||||||
endpoint_name = "page_settings_html"
|
endpoint_name = "page_settings_html"
|
||||||
|
endpoint_access_level = 1
|
||||||
|
pretty_name = "Settings"
|
||||||
|
|
||||||
def __init__(self, fhdhr):
|
def __init__(self, fhdhr):
|
||||||
self.fhdhr = fhdhr
|
self.fhdhr = fhdhr
|
||||||
|
|||||||
@ -4,6 +4,8 @@ from flask import request, render_template, session
|
|||||||
class Tools_HTML():
|
class Tools_HTML():
|
||||||
endpoints = ["/tools", "/tools.html"]
|
endpoints = ["/tools", "/tools.html"]
|
||||||
endpoint_name = "tools_html"
|
endpoint_name = "tools_html"
|
||||||
|
endpoint_access_level = 2
|
||||||
|
pretty_name = "Tools"
|
||||||
|
|
||||||
def __init__(self, fhdhr):
|
def __init__(self, fhdhr):
|
||||||
self.fhdhr = fhdhr
|
self.fhdhr = fhdhr
|
||||||
|
|||||||
@ -6,6 +6,8 @@ from fHDHR.tools import humanized_filesize
|
|||||||
class Tuners_HTML():
|
class Tuners_HTML():
|
||||||
endpoints = ["/tuners", "/tuners.html"]
|
endpoints = ["/tuners", "/tuners.html"]
|
||||||
endpoint_name = "page_streams_html"
|
endpoint_name = "page_streams_html"
|
||||||
|
endpoint_access_level = 0
|
||||||
|
pretty_name = "Tuners"
|
||||||
|
|
||||||
def __init__(self, fhdhr):
|
def __init__(self, fhdhr):
|
||||||
self.fhdhr = fhdhr
|
self.fhdhr = fhdhr
|
||||||
|
|||||||
@ -4,6 +4,8 @@ from flask import request, render_template, session
|
|||||||
class Version_HTML():
|
class Version_HTML():
|
||||||
endpoints = ["/version", "/version.html"]
|
endpoints = ["/version", "/version.html"]
|
||||||
endpoint_name = "page_version_html"
|
endpoint_name = "page_version_html"
|
||||||
|
endpoint_access_level = 1
|
||||||
|
pretty_name = "Version"
|
||||||
|
|
||||||
def __init__(self, fhdhr):
|
def __init__(self, fhdhr):
|
||||||
self.fhdhr = fhdhr
|
self.fhdhr = fhdhr
|
||||||
|
|||||||
@ -4,6 +4,8 @@ from flask import request, render_template, session
|
|||||||
class xmlTV_HTML():
|
class xmlTV_HTML():
|
||||||
endpoints = ["/xmltv", "/xmltv.html"]
|
endpoints = ["/xmltv", "/xmltv.html"]
|
||||||
endpoint_name = "page_xmltv_html"
|
endpoint_name = "page_xmltv_html"
|
||||||
|
endpoint_access_level = 1
|
||||||
|
pretty_name = "xmltv"
|
||||||
|
|
||||||
def __init__(self, fhdhr):
|
def __init__(self, fhdhr):
|
||||||
self.fhdhr = fhdhr
|
self.fhdhr = fhdhr
|
||||||
|
|||||||
@ -9,6 +9,9 @@ class RMG_Devices_Probe():
|
|||||||
endpoints = ["/devices/probe", "/rmg/devices/probe"]
|
endpoints = ["/devices/probe", "/rmg/devices/probe"]
|
||||||
endpoint_name = "rmg_devices_probe"
|
endpoint_name = "rmg_devices_probe"
|
||||||
endpoint_methods = ["GET", "POST"]
|
endpoint_methods = ["GET", "POST"]
|
||||||
|
endpoint_default_parameters = {
|
||||||
|
"uri": "<base_url>"
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(self, fhdhr):
|
def __init__(self, fhdhr):
|
||||||
self.fhdhr = fhdhr
|
self.fhdhr = fhdhr
|
||||||
|
|||||||
@ -17,45 +17,36 @@
|
|||||||
<p></p>
|
<p></p>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<button class="pull-left" onclick="OpenLink('/index')">fHDHR</a></button>
|
<button class="pull-left" onclick="OpenLink('/index')">fHDHR</button>
|
||||||
|
<button class="pull-left" onclick="OpenLink('/origin')">{{ fhdhr.config.dict["main"]["servicename"] }}</button>
|
||||||
|
|
||||||
<button class="pull-left" onclick="OpenLink('/origin')">{{ fhdhr.config.dict["main"]["servicename"] }}</a></button>
|
{% for page_dict in session["route_list"]["pages"] %}
|
||||||
|
{% if session["route_list"]["pages"][page_dict]["name"] != "page_index_html" and fhdhr.config.dict["web_ui"]["access_level"] >= session["route_list"]["pages"][page_dict]["endpoint_access_level"] %}
|
||||||
<button class="pull-left" onclick="OpenLink('/channels')">Channels</a></button>
|
<button class="pull-left" onclick="OpenLink('{{ session["route_list"]["pages"][page_dict]["endpoints"][0] }}')">{{ session["route_list"]["pages"][page_dict]["pretty_name"] }}</button>
|
||||||
|
{% endif %}
|
||||||
<button class="pull-left" onclick="OpenLink('/guide')">Guide</a></button>
|
{% endfor %}
|
||||||
|
|
||||||
<button class="pull-left" onclick="OpenLink('/cluster')">Cluster/SSDP</a></button>
|
|
||||||
|
|
||||||
<button class="pull-left" onclick="OpenLink('/tuners')">Tuners</a></button>
|
|
||||||
|
|
||||||
<button class="pull-left" onclick="OpenLink('/xmltv')">xmltv</a></button>
|
|
||||||
|
|
||||||
{% if fhdhr.config.dict["web_ui"]["advanced"] %}
|
|
||||||
<button class="pull-left" onclick="OpenLink('/version')">Version</a></button>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if fhdhr.config.dict["web_ui"]["advanced"] %}
|
|
||||||
<button class="pull-left" onclick="OpenLink('/diagnostics')">Diagnostics</a></button>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<button class="pull-left" onclick="OpenLink('/settings')">Settings</a></button>
|
|
||||||
|
|
||||||
<a class="pull-right" style="padding: 5px;" href="/api/xmltv?method=get&source={{ fhdhr.device.epg.def_method }}">xmltv</a>
|
<a class="pull-right" style="padding: 5px;" href="/api/xmltv?method=get&source={{ fhdhr.device.epg.def_method }}">xmltv</a>
|
||||||
<a class="pull-right" style="padding: 5px;" href="/api/m3u?method=get&channel=all">m3u</a>
|
<a class="pull-right" style="padding: 5px;" href="/api/m3u?method=get&channel=all">m3u</a>
|
||||||
<form class="pull-right" style="padding: 5px;" method="post" action="/api/settings?method=update&redirect={{ request.path }}">
|
<form class="pull-right" style="padding: 5px;" method="post" action="/api/settings?method=update&redirect={{ request.path }}">
|
||||||
<input type="hidden" name="config_section" value="web_ui">
|
<input type="hidden" name="config_section" value="web_ui">
|
||||||
<input type="hidden" name="config_name" value="advanced">
|
<input type="hidden" name="config_name" value="access_level">
|
||||||
{% if fhdhr.config.dict["web_ui"]["advanced"] %}
|
|
||||||
<input type="hidden" name="config_value" value=False>
|
{% if fhdhr.config.dict["web_ui"]["access_level"] == 2 %}
|
||||||
|
<input type="hidden" name="config_value" value=0>
|
||||||
|
{% elif fhdhr.config.dict["web_ui"]["access_level"] == 1 %}
|
||||||
|
<input type="hidden" name="config_value" value=2>
|
||||||
{% else %}
|
{% else %}
|
||||||
<input type="hidden" name="config_value" value=True>
|
<input type="hidden" name="config_value" value=1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<input type="hidden" name="config_default" value=False>
|
|
||||||
{% if fhdhr.config.dict["web_ui"]["advanced"] %}
|
<input type="hidden" name="config_default" value=0>
|
||||||
<a data-th="Reset"><input type="submit" value="Basic"></a>
|
{% if fhdhr.config.dict["web_ui"]["access_level"] == 2 %}
|
||||||
|
<a><input type="submit" value="Extra Advanced"></a>
|
||||||
|
{% elif fhdhr.config.dict["web_ui"]["access_level"] == 1 %}
|
||||||
|
<a><input type="submit" value="Advanced"></a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a data-th="Reset"><input type="submit" value="Advanced"></a>
|
<a><input type="submit" value="Basic"></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
@ -4,37 +4,30 @@
|
|||||||
|
|
||||||
<h4 style="text-align: center;">fHDHR Diagnostic Links</h4>
|
<h4 style="text-align: center;">fHDHR Diagnostic Links</h4>
|
||||||
|
|
||||||
<div class="container">
|
{% for route_group in list(button_dict.keys()) %}
|
||||||
<table class="table-medium center">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th>Item</th>
|
|
||||||
<th>HDHR</th>
|
|
||||||
<th>RMG</th>
|
|
||||||
<th>Non-Specific</th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
{% for button_item in button_list %}
|
<h4 style="text-align: center;">{{ route_group }}</h4>
|
||||||
<tr>
|
|
||||||
<td>{{ button_item["label"] }}</td>
|
<div class="container">
|
||||||
{% if button_item["hdhr"] %}
|
<table class="table-settings center action-col text-edit-cols">
|
||||||
<td><button onclick="OpenLink('{{ button_item["hdhr"] }}')">{{ button_item["label"] }}</a></button></td>
|
<thead>
|
||||||
{% else %}
|
<tr>
|
||||||
<td></td>
|
<th>Link</th>
|
||||||
{% endif %}
|
</tr>
|
||||||
{% if button_item["rmg"] %}
|
</thead>
|
||||||
<td><button onclick="OpenLink('{{ button_item["rmg"] }}')">{{ button_item["label"] }}</a></button></td>
|
<tbody>
|
||||||
{% else %}
|
|
||||||
<td> </td>
|
{% for button_item in button_dict[route_group] %}
|
||||||
{% endif %}
|
|
||||||
{% if button_item["other"] %}
|
<tr>
|
||||||
<td><button onclick="OpenLink('{{ button_item["other"] }}')">{{ button_item["label"] }}</a></button></td>
|
<td><button onclick="OpenLink('{{ button_item["link"] }}')">{{ button_item["label"] }}</a></button></td>
|
||||||
{% else %}
|
</tr>
|
||||||
<td></td>
|
|
||||||
{% endif %}
|
{% endfor %}
|
||||||
</tr>
|
</tbody>
|
||||||
{% endfor %}
|
</table>
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@ -66,6 +66,8 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
"config_file": true,
|
"config_file": true,
|
||||||
"config_web": true
|
"config_web": true
|
||||||
},
|
},
|
||||||
"advanced":{
|
"access_level":{
|
||||||
"value": false,
|
"value": 0,
|
||||||
"config_file": true,
|
"config_file": true,
|
||||||
"config_web": true
|
"config_web": true
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user