* 删除搜索引擎
(engineId: string)
| 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 = [ |
no test coverage detected