@@ -640,14 +640,14 @@ export const useExtensionPage = () => {
640640
641641 pluginMarketData . value . forEach ( ( plugin ) => {
642642 if ( plugin . repo ) {
643- onlinePluginsMap . set ( plugin . repo . toLowerCase ( ) , plugin ) ;
643+ onlinePluginsMap . set ( normalizeInstallUrl ( plugin . repo ) . toLowerCase ( ) , plugin ) ;
644644 }
645645 onlinePluginsNameMap . set ( plugin . name , plugin ) ;
646646 } ) ;
647647
648648 const data = Array . isArray ( extension_data ?. data ) ? extension_data . data : [ ] ;
649649 data . forEach ( ( extension ) => {
650- const repoKey = extension . repo ?. toLowerCase ( ) ;
650+ const repoKey = extension . repo ? normalizeInstallUrl ( extension . repo ) . toLowerCase ( ) : undefined ;
651651 const onlinePlugin = repoKey ? onlinePluginsMap . get ( repoKey ) : null ;
652652 const onlinePluginByName = onlinePluginsNameMap . get ( extension . name ) ;
653653 const matchedPlugin = onlinePlugin || onlinePluginByName ;
@@ -1233,21 +1233,21 @@ export const useExtensionPage = () => {
12331233
12341234 const checkAlreadyInstalled = ( ) => {
12351235 const data = Array . isArray ( extension_data ?. data ) ? extension_data . data : [ ] ;
1236- const installedRepos = new Set ( data . map ( ( ext ) => ext . repo ?. toLowerCase ( ) ) ) ;
1237- const installedNames = new Set (
1238- data . map ( ( ext ) => normalizeStr ( ext . name ) . replace ( / _ / g, "-" ) ) ,
1239- ) ; //统一格式,以防下面的匹配不生效
12401236 const installedByRepo = new Map (
12411237 data
12421238 . filter ( ( ext ) => ext . repo )
1243- . map ( ( ext ) => [ ext . repo . toLowerCase ( ) , ext ] ) ,
1239+ . map ( ( ext ) => [ normalizeInstallUrl ( ext . repo ) . toLowerCase ( ) , ext ] ) ,
12441240 ) ;
1241+ const installedRepos = new Set ( installedByRepo . keys ( ) ) ;
1242+ const installedNames = new Set (
1243+ data . map ( ( ext ) => normalizeStr ( ext . name ) . replace ( / _ / g, "-" ) ) ,
1244+ ) ; //统一格式,以防下面的匹配不生效
12451245 const installedByName = new Map ( data . map ( ( ext ) => [ ext . name , ext ] ) ) ;
12461246
12471247 for ( let i = 0 ; i < pluginMarketData . value . length ; i ++ ) {
12481248 const plugin = pluginMarketData . value [ i ] ;
12491249 const matchedInstalled =
1250- ( plugin . repo && installedByRepo . get ( plugin . repo . toLowerCase ( ) ) ) ||
1250+ ( plugin . repo && installedByRepo . get ( normalizeInstallUrl ( plugin . repo ) . toLowerCase ( ) ) ) ||
12511251 installedByName . get ( plugin . name ) ;
12521252
12531253 // 兜底:市场源未提供字段时,回填本地已安装插件中的元数据,便于在市场页直接展示
@@ -1265,7 +1265,7 @@ export const useExtensionPage = () => {
12651265 }
12661266
12671267 plugin . installed =
1268- installedRepos . has ( plugin . repo ? .toLowerCase ( ) ) ||
1268+ ( plugin . repo && installedRepos . has ( normalizeInstallUrl ( plugin . repo ) . toLowerCase ( ) ) ) ||
12691269 installedNames . has ( normalizeStr ( plugin . name ) . replace ( / _ / g, "-" ) ) ; //统一格式,防止匹配失败
12701270 }
12711271
0 commit comments