mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-14 01:23:43 +03:00
- Integrated plugin downloader/installer. It accepts POST requests at /browser/install_plugin, containing an artifact (basically an author/repo string like you'd find on github), and a release version, then fetches the zip file from the repo releases and unzips it inside the plugin dir, after asking for user confirmation (pop-up message in the plugin menu). - Injector get_tab method. Basically get_tabs with the usual search for a specific tab. Decided to implement this because it was needed again and again, and we kept pasting the same list search one-liner. - Utilities now have access to the main PluginManager class
25 lines
833 B
Python
25 lines
833 B
Python
from aiohttp import ClientSession
|
|
|
|
class Utilities:
|
|
def __init__(self, context) -> None:
|
|
self.context = context
|
|
self.util_methods = {
|
|
"ping": self.ping,
|
|
"http_request": self.http_request,
|
|
"confirm_plugin_install": self.confirm_plugin_install
|
|
}
|
|
|
|
async def confirm_plugin_install(self, request_id):
|
|
return await self.context.plugin_browser.confirm_plugin_install(request_id)
|
|
|
|
async def http_request(self, method="", url="", **kwargs):
|
|
async with ClientSession() as web:
|
|
res = await web.request(method, url, **kwargs)
|
|
return {
|
|
"status": res.status,
|
|
"headers": dict(res.headers),
|
|
"body": await res.text()
|
|
}
|
|
|
|
async def ping(self, **kwargs):
|
|
return "pong" |