X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/982001658e3e55d320d747717fcf8e56c2cec1b6..954106887a9b77a26753c5613ff368ce4c997044:/lib/python/Plugins/Extensions/WebInterface/plugin.py diff --git a/lib/python/Plugins/Extensions/WebInterface/plugin.py b/lib/python/Plugins/Extensions/WebInterface/plugin.py index 84a82331..cc9a546b 100644 --- a/lib/python/Plugins/Extensions/WebInterface/plugin.py +++ b/lib/python/Plugins/Extensions/WebInterface/plugin.py @@ -5,18 +5,30 @@ sessions = [ ] def startWebserver(): from twisted.internet import reactor from twisted.web2 import server, http, static, resource, stream, http_headers, responsecode + from twisted.python import util import webif class ScreenPage(resource.Resource): + def __init__(self, path): + self.path = path + def render(self, req): global sessions if sessions == [ ]: return http.Response(200, stream="please wait until enigma has booted") s = stream.ProducerStream() - webif.renderPage(s, req, sessions[0]) # login? + webif.renderPage(s, self.path, sessions[0]) # login? return http.Response(stream=s) + def locateChild(self, request, segments): + path = '/'.join(["web"] + segments) + if path[-1:] == "/": + path += "index" + + path += ".xml" + return ScreenPage(path), () + class Toplevel(resource.Resource): addSlash = True @@ -24,8 +36,9 @@ def startWebserver(): return http.Response(responsecode.OK, {'Content-type': http_headers.MimeType('text', 'html')}, stream='Hello! you want probably go to the test instead.') - child_test = ScreenPage() # "/test" + child_web = ScreenPage("/") # "/web" child_hdd = static.File("/hdd") + child_webdata = static.File(util.sibpath(__file__, "web-data")) site = server.Site(Toplevel())