This commit is contained in:
Jan Prochazka
2021-04-17 11:01:42 +02:00
parent 76e51343d0
commit a6207f01af
4 changed files with 17 additions and 15 deletions

View File

@@ -6,15 +6,16 @@ export function extractPluginIcon(packageManifest) {
const homepage = (links && links.homepage) || packageManifest.homepage;
const tested = repository || homepage || packageManifest.homepage;
if (tested == 'https://dbgate.org' || tested == 'https://github.com/dbgate/dbgate') {
// monorepo plugin
return `https://github.com/dbgate/dbgate/raw/master/plugins/${packageManifest.name}/icon.svg`;
}
if (tested) {
const match = tested.match(/https:\/\/github.com\/([^/]*)\/([^/]*)/);
if (match) {
return `https://raw.githubusercontent.com/${match[1]}/${match[2]}/master/icon.svg`;
}
if (tested == 'https://dbgate.org') {
return `https://github.com/dbgate/dbgate/raw/master/plugins/${packageManifest.name}/icon.svg`;
}
}
return 'unknown.svg';
}