mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 18:56:00 +00:00
install/uninstall plugin
This commit is contained in:
20
packages/web/src/plugins/manifestExtractors.js
Normal file
20
packages/web/src/plugins/manifestExtractors.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import _ from 'lodash';
|
||||
|
||||
export function extractPluginIcon(packageManifest) {
|
||||
const { links } = packageManifest || {};
|
||||
const { repository, homepage } = links || {};
|
||||
const tested = repository || homepage || packageManifest.homepage;
|
||||
|
||||
if (tested) {
|
||||
const match = tested.match(/https:\/\/github.com\/([^/]*)\/([^/]*)/);
|
||||
if (match) {
|
||||
return `https://raw.githubusercontent.com/${match[1]}/${match[2]}/master/icon.svg`;
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line no-undef
|
||||
return `${process.env.PUBLIC_URL}/unknown.svg`;
|
||||
}
|
||||
|
||||
export function extractPluginAuthor(packageManifest) {
|
||||
return _.isPlainObject(packageManifest.author) ? packageManifest.author.name : packageManifest.author;
|
||||
}
|
||||
Reference in New Issue
Block a user