mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
fix
This commit is contained in:
parent
76e51343d0
commit
a6207f01af
@ -205,6 +205,7 @@ function createWindow() {
|
|||||||
} else {
|
} else {
|
||||||
const apiProcess = fork(path.join(__dirname, '../packages/api/dist/bundle.js'), [
|
const apiProcess = fork(path.join(__dirname, '../packages/api/dist/bundle.js'), [
|
||||||
'--dynport',
|
'--dynport',
|
||||||
|
'--is-electron-bundle',
|
||||||
'--native-modules',
|
'--native-modules',
|
||||||
path.join(__dirname, 'nativeModules'),
|
path.join(__dirname, 'nativeModules'),
|
||||||
// '../../../src/nativeModules'
|
// '../../../src/nativeModules'
|
||||||
|
@ -51,7 +51,7 @@ function packagedPluginsDir() {
|
|||||||
// node_modules
|
// node_modules
|
||||||
return global['dbgateApiPackagedPluginsPath'];
|
return global['dbgateApiPackagedPluginsPath'];
|
||||||
}
|
}
|
||||||
if (platformInfo.isElectron) {
|
if (platformInfo.isElectronBundle) {
|
||||||
return path.resolve(__dirname, '../../plugins');
|
return path.resolve(__dirname, '../../plugins');
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -11,23 +11,23 @@ const isDocker = fs.existsSync('/home/dbgate-docker/build');
|
|||||||
const isDevMode = p.env.DEVMODE == '1';
|
const isDevMode = p.env.DEVMODE == '1';
|
||||||
const isNpmDist = p.argv[2] == 'startNodeWeb';
|
const isNpmDist = p.argv[2] == 'startNodeWeb';
|
||||||
|
|
||||||
function moduleAvailable(name) {
|
// function moduleAvailable(name) {
|
||||||
try {
|
// try {
|
||||||
require.resolve(name);
|
// require.resolve(name);
|
||||||
return true;
|
// return true;
|
||||||
} catch (e) {
|
// } catch (e) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
const isElectron = moduleAvailable('electron');
|
const isElectronBundle = p.argv.indexOf('--is-electron-bundle') >= 0;
|
||||||
|
|
||||||
const platformInfo = {
|
const platformInfo = {
|
||||||
isWindows,
|
isWindows,
|
||||||
isMac,
|
isMac,
|
||||||
isLinux,
|
isLinux,
|
||||||
isDocker,
|
isDocker,
|
||||||
isElectron,
|
isElectronBundle,
|
||||||
isDevMode,
|
isDevMode,
|
||||||
isNpmDist,
|
isNpmDist,
|
||||||
isSnap: p.env.ELECTRON_SNAP == 'true',
|
isSnap: p.env.ELECTRON_SNAP == 'true',
|
||||||
|
@ -6,15 +6,16 @@ export function extractPluginIcon(packageManifest) {
|
|||||||
const homepage = (links && links.homepage) || packageManifest.homepage;
|
const homepage = (links && links.homepage) || packageManifest.homepage;
|
||||||
const tested = repository || 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) {
|
if (tested) {
|
||||||
const match = tested.match(/https:\/\/github.com\/([^/]*)\/([^/]*)/);
|
const match = tested.match(/https:\/\/github.com\/([^/]*)\/([^/]*)/);
|
||||||
if (match) {
|
if (match) {
|
||||||
return `https://raw.githubusercontent.com/${match[1]}/${match[2]}/master/icon.svg`;
|
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';
|
return 'unknown.svg';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user