From 9f1692b33d58e497c5c6cee65a9fffc28ec4da9b Mon Sep 17 00:00:00 2001 From: YuF-9468 Date: Mon, 9 Mar 2026 11:41:42 +0800 Subject: [PATCH 1/2] fix(plugin): prepend API prefix for plugin remoteEntry URL --- app/core/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/core/plugin.py b/app/core/plugin.py index 37eea819..827882d8 100644 --- a/app/core/plugin.py +++ b/app/core/plugin.py @@ -779,7 +779,7 @@ class PluginManager(ConfigReloadMixin, metaclass=Singleton): dist_path = dist_path[1:] if dist_path.endswith("/"): dist_path = dist_path[:-1] - return f"/plugin/file/{plugin_id.lower()}/{dist_path}/remoteEntry.js" + return f"{settings.API_V1_STR}/plugin/file/{plugin_id.lower()}/{dist_path}/remoteEntry.js" def get_plugin_remotes(self, pid: Optional[str] = None) -> List[Dict[str, Any]]: """ From 770cd776320e5f524563169ab9c5326305c8f7a0 Mon Sep 17 00:00:00 2001 From: YuF-9468 <9157130+YuF-9468@users.noreply.github.com> Date: Mon, 9 Mar 2026 11:53:28 +0800 Subject: [PATCH 2/2] refactor(plugin): build remoteEntry path with posixpath.join --- app/core/plugin.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/core/plugin.py b/app/core/plugin.py index 827882d8..10e90aa7 100644 --- a/app/core/plugin.py +++ b/app/core/plugin.py @@ -5,6 +5,7 @@ import concurrent.futures import importlib.util import inspect import os +import posixpath import sys import threading import time @@ -775,11 +776,19 @@ class PluginManager(ConfigReloadMixin, metaclass=Singleton): :param dist_path: 插件的分发路径 :return: 远程入口地址 """ - if dist_path.startswith("/"): - dist_path = dist_path[1:] - if dist_path.endswith("/"): - dist_path = dist_path[:-1] - return f"{settings.API_V1_STR}/plugin/file/{plugin_id.lower()}/{dist_path}/remoteEntry.js" + dist_path = dist_path.strip("/") + api_prefix = settings.API_V1_STR.rstrip("/") + path = posixpath.join( + api_prefix, + "plugin", + "file", + plugin_id.lower(), + dist_path, + "remoteEntry.js", + ) + if not path.startswith("/"): + path = "/" + path + return path def get_plugin_remotes(self, pid: Optional[str] = None) -> List[Dict[str, Any]]: """