()
| 706 | }; |
| 707 | |
| 708 | const checkUpdate = async () => { |
| 709 | const data = Array.isArray(extension_data?.data) ? extension_data.data : []; |
| 710 | const sourcePlugins = new Map(); |
| 711 | |
| 712 | data.forEach((extension) => { |
| 713 | extension.online_version = ""; |
| 714 | extension.has_update = false; |
| 715 | extension.update_market_plugin = null; |
| 716 | |
| 717 | const source = extension.install_source; |
| 718 | if ( |
| 719 | !extension.updates_enabled || |
| 720 | !source || |
| 721 | source.implicit === true || |
| 722 | source.install_method !== "market" |
| 723 | ) { |
| 724 | return; |
| 725 | } |
| 726 | |
| 727 | const registryUrl = normalizeRegistryUrl(source.registry_url); |
| 728 | if (!sourcePlugins.has(registryUrl)) { |
| 729 | sourcePlugins.set(registryUrl, []); |
| 730 | } |
| 731 | sourcePlugins.get(registryUrl).push(extension); |
| 732 | }); |
| 733 | |
| 734 | await Promise.all( |
| 735 | [...sourcePlugins.entries()].map(async ([registryUrl, extensions]) => { |
| 736 | let marketPlugins = []; |
| 737 | try { |
| 738 | marketPlugins = |
| 739 | registryUrl === normalizeRegistryUrl(selectedSource.value) |
| 740 | ? pluginMarketData.value |
| 741 | : await commonStore.getPluginCollections( |
| 742 | false, |
| 743 | registryUrl || null, |
| 744 | ); |
| 745 | } catch (error) { |
| 746 | console.warn("Failed to load plugin source for update check:", error); |
| 747 | return; |
| 748 | } |
| 749 | |
| 750 | const lookup = buildMarketPluginLookup(marketPlugins); |
| 751 | extensions.forEach((extension) => { |
| 752 | const source = extension.install_source || {}; |
| 753 | const sourceIdentifier = String(source.market_plugin_id || "").trim(); |
| 754 | const sourceRepo = normalizeInstallUrl(source.repo).toLowerCase(); |
| 755 | const normalizedExtensionName = normalizeStr( |
| 756 | extension.marketplace_name, |
| 757 | ); |
| 758 | const matchedPlugin = |
| 759 | (sourceIdentifier && lookup.byIdentifier.get(sourceIdentifier)) || |
| 760 | (sourceRepo && lookup.byRepo.get(sourceRepo)) || |
| 761 | lookup.byName.get(normalizedExtensionName); |
| 762 | |
| 763 | if (!matchedPlugin) { |
| 764 | return; |
| 765 | } |
no test coverage detected