diff --git a/app/src/electron.js b/app/src/electron.js index bc985cb5..18662549 100644 --- a/app/src/electron.js +++ b/app/src/electron.js @@ -205,6 +205,7 @@ function createWindow() { } else { const apiProcess = fork(path.join(__dirname, '../packages/api/dist/bundle.js'), [ '--dynport', + '--is-electron-bundle', '--native-modules', path.join(__dirname, 'nativeModules'), // '../../../src/nativeModules' diff --git a/packages/api/src/utility/directories.js b/packages/api/src/utility/directories.js index 4ead0e24..778e9b83 100644 --- a/packages/api/src/utility/directories.js +++ b/packages/api/src/utility/directories.js @@ -51,7 +51,7 @@ function packagedPluginsDir() { // node_modules return global['dbgateApiPackagedPluginsPath']; } - if (platformInfo.isElectron) { + if (platformInfo.isElectronBundle) { return path.resolve(__dirname, '../../plugins'); } return null; diff --git a/packages/api/src/utility/platformInfo.js b/packages/api/src/utility/platformInfo.js index 9f342706..523228e6 100644 --- a/packages/api/src/utility/platformInfo.js +++ b/packages/api/src/utility/platformInfo.js @@ -11,23 +11,23 @@ const isDocker = fs.existsSync('/home/dbgate-docker/build'); const isDevMode = p.env.DEVMODE == '1'; const isNpmDist = p.argv[2] == 'startNodeWeb'; -function moduleAvailable(name) { - try { - require.resolve(name); - return true; - } catch (e) { - return false; - } -} +// function moduleAvailable(name) { +// try { +// require.resolve(name); +// return true; +// } catch (e) { +// return false; +// } +// } -const isElectron = moduleAvailable('electron'); +const isElectronBundle = p.argv.indexOf('--is-electron-bundle') >= 0; const platformInfo = { isWindows, isMac, isLinux, isDocker, - isElectron, + isElectronBundle, isDevMode, isNpmDist, isSnap: p.env.ELECTRON_SNAP == 'true', diff --git a/packages/web/src/plugins/manifestExtractors.ts b/packages/web/src/plugins/manifestExtractors.ts index dd6e0d31..b993f457 100644 --- a/packages/web/src/plugins/manifestExtractors.ts +++ b/packages/web/src/plugins/manifestExtractors.ts @@ -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'; }