🚑️ hotfix: install remote plugins

This commit is contained in:
xtaodada 2023-07-02 13:37:22 +08:00
parent 0c87310f77
commit f19293ca12
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -63,10 +63,11 @@ class RemotePlugin(LocalPlugin):
supported: bool supported: bool
des: str = "" des: str = ""
des_short: str = "" des_short: str = ""
remote_source: str
... ...
async def install(self) -> bool: async def install(self) -> bool:
html = await client.get(f"{Config.GIT_SOURCE}{self.name}/main.py") html = await client.get(f"{self.remote_source}{self.name}/main.py")
if html.status_code == 200: if html.status_code == 200:
self.remove() self.remove()
with open(plugins_path / f"{self.name}.py", mode="wb") as f: with open(plugins_path / f"{self.name}.py", mode="wb") as f:
@ -221,7 +222,7 @@ class PluginManager:
self.remote_manager.enable_remote(remote) self.remote_manager.enable_remote(remote)
for plugin in plugin_list: for plugin in plugin_list:
try: try:
plugin_model = RemotePlugin(**plugin, status=False) plugin_model = RemotePlugin(**plugin, status=False, remote_source=remote)
if plugin_model.name in plugins_name: if plugin_model.name in plugins_name:
continue continue
plugins.append(plugin_model) plugins.append(plugin_model)