diff --git a/apps/terminal/applets/chrome/app.py b/apps/terminal/applets/chrome/app.py index b19e219d1..14654386e 100644 --- a/apps/terminal/applets/chrome/app.py +++ b/apps/terminal/applets/chrome/app.py @@ -221,10 +221,6 @@ def default_chrome_driver_options(): options.add_argument('--ignore-certificate-errors-spki-list') options.add_argument('--allow-running-insecure-content') - # 加载 extensions - extension_paths = load_extensions() - for extension_path in extension_paths: - options.add_argument('--load-extension={}'.format(extension_path)) # 禁用开发者工具 options.add_argument("--disable-dev-tools") # 禁用 密码管理器弹窗 @@ -248,6 +244,12 @@ class AppletApplication(BaseApplication): self._chrome_options = default_chrome_driver_options() self._chrome_options.add_argument("--app={}".format(self.asset.address)) self._chrome_options.add_argument("--user-data-dir={}".format(self._tmp_user_dir.name)) + protocol_setting = self.platform.get_protocol_setting(self.protocol) + if protocol_setting and protocol_setting.safe_mode: + # 加载 extensions + extension_paths = load_extensions() + for extension_path in extension_paths: + self._chrome_options.add_argument('--load-extension={}'.format(extension_path)) @wrapper_progress_bar def run(self): diff --git a/apps/terminal/applets/chrome/common.py b/apps/terminal/applets/chrome/common.py index 06d23f9fd..161150a0d 100644 --- a/apps/terminal/applets/chrome/common.py +++ b/apps/terminal/applets/chrome/common.py @@ -160,6 +160,7 @@ class ProtocolSetting(DictObj): password_selector: str submit_selector: str script: list[Step] + safe_mode: bool class PlatformProtocolSetting(DictObj):