MCPcopy Create free account
hub / github.com/ZToolsCenter/ZTools / deleteEngine

Method deleteEngine

src/main/api/renderer/webSearch.ts:171–187  ·  view source on GitHub ↗

* 删除搜索引擎

(engineId: string)

Source from the content-addressed store, hash-verified

169 * 删除搜索引擎
170 */
171 public async deleteEngine(engineId: string): Promise<{ success: boolean; error?: string }> {
172 const engines = this.getAllEngines()
173 const index = engines.findIndex((e) => e.id === engineId)
174 if (index === -1) {
175 return { success: false, error: '未找到该搜索引擎' }
176 }
177
178 const featureCode = `web-search-${engines[index].id}`
179
180 engines.splice(index, 1)
181 databaseAPI.dbPut(this.DB_KEY, engines)
182
183 this.cleanupDeletedFeatureReferences(featureCode)
184 this.notifyCommandsChanged()
185
186 return { success: true }
187 }
188
189 private cleanupDeletedFeatureReferences(featureCode: string): void {
190 const cleanupTargets = [

Callers 3

setupIPCMethod · 0.95
setupIPCMethod · 0.80
webSearch.test.tsFile · 0.80

Calls 4

getAllEnginesMethod · 0.95
notifyCommandsChangedMethod · 0.95
dbPutMethod · 0.45

Tested by

no test coverage detected