mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-15 18:13:40 +03:00
Added support for including styles/scripts in the header of html files (#29)
* Added support for including styles/scripts in the header of html files * updated route name
This commit is contained in:
@@ -69,6 +69,7 @@ class Loader:
|
||||
web.get("/plugins/reload", self.reload_plugins),
|
||||
web.post("/plugins/method_call", self.handle_plugin_method_call),
|
||||
web.get("/plugins/load_main/{name}", self.load_plugin_main_view),
|
||||
web.get("/plugins/plugin_resource/{name}/{path:.+}", self.handle_sub_route),
|
||||
web.get("/plugins/load_tile/{name}", self.load_plugin_tile_view),
|
||||
web.get("/steam_resource/{path:.+}", self.get_steam_resource)
|
||||
])
|
||||
@@ -138,10 +139,24 @@ class Loader:
|
||||
ret = """
|
||||
<script src="/static/library.js"></script>
|
||||
<script>const plugin_name = '{}' </script>
|
||||
<base href="http://127.0.0.1:1337/plugins/plugin_resource/{}/">
|
||||
{}
|
||||
""".format(plugin.name, template_data)
|
||||
""".format(plugin.name, plugin.name, template_data)
|
||||
return web.Response(text=ret, content_type="text/html")
|
||||
|
||||
async def handle_sub_route(self, request):
|
||||
plugin = self.plugins[request.match_info["name"]]
|
||||
route_path = request.match_info["path"]
|
||||
self.logger.info(path)
|
||||
|
||||
ret = ""
|
||||
|
||||
file_path = path.join(self.plugin_path, plugin._plugin_directory, route_path)
|
||||
with open(file_path, 'r') as resource_data:
|
||||
ret = resource_data.read()
|
||||
|
||||
return web.Response(text=ret)
|
||||
|
||||
async def load_plugin_tile_view(self, request):
|
||||
plugin = self.plugins[request.match_info["name"]]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user