MCPcopy
hub / github.com/ZToolsCenter/ZTools / setupPluginSession

Method setupPluginSession

src/main/managers/pluginManager.ts:215–232  ·  view source on GitHub ↗

* 创建并配置插件的 session(注册 preload、代理、图标协议)

(
    pluginName: string,
    pluginPath: string
  )

Source from the content-addressed store, hash-verified

213 * 创建并配置插件的 session(注册 preload、代理、图标协议)
214 */
215 private async setupPluginSession(
216 pluginName: string,
217 pluginPath: string
218 ): Promise<Electron.Session> {
219 const partition = getPluginSessionPartition(pluginName)
220 console.log('[Plugin] 设置插件 Session:', {
221 pluginName,
222 pluginPath,
223 partition
224 })
225 const sess = session.fromPartition(partition)
226 sess.registerPreloadScript({ type: 'frame', filePath: mainPreload })
227 await proxyManager.applyProxyToSession(sess, `插件 ${pluginName}`)
228 if (isBundledInternalPlugin(pluginName)) {
229 registerIconProtocolForSession(sess)
230 }
231 return sess
232 }
233
234 /**
235 * 创建插件的 WebContentsView 实例

Callers 3

createNewPluginViewMethod · 0.95
preloadPluginMethod · 0.95

Calls 4

isBundledInternalPluginFunction · 0.90
applyProxyToSessionMethod · 0.80

Tested by

no test coverage detected