mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 13:13:58 +00:00
replaced executeJavaScript with IPC event
This commit is contained in:
@@ -121,19 +121,7 @@ function start() {
|
||||
}
|
||||
}
|
||||
|
||||
if (processArgs.dynport) {
|
||||
childProcessChecker();
|
||||
|
||||
authorization = crypto.randomBytes(32).toString('hex');
|
||||
|
||||
getPort().then(port => {
|
||||
checkLocalhostOrigin = `localhost:${port}`;
|
||||
server.listen(port, () => {
|
||||
console.log(`DbGate API listening on port ${port}`);
|
||||
process.send({ msgtype: 'listening', port, authorization });
|
||||
});
|
||||
});
|
||||
} else if (platformInfo.isNpmDist) {
|
||||
if (platformInfo.isNpmDist) {
|
||||
app.use(express.static(path.join(__dirname, '../../dbgate-web/public')));
|
||||
getPort({ port: 5000 }).then(port => {
|
||||
server.listen(port, () => {
|
||||
@@ -141,7 +129,7 @@ function start() {
|
||||
});
|
||||
});
|
||||
} else {
|
||||
server.listen(3000);
|
||||
server.listen(process.env.PORT || 3000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ export default function runCommand(id) {
|
||||
}
|
||||
}
|
||||
|
||||
window['dbgate_runCommand'] = runCommand;
|
||||
|
||||
export function runGroupCommand(group) {
|
||||
const commandsValue = getCommands();
|
||||
const values = Object.values(commandsValue) as GlobalCommand[];
|
||||
@@ -32,3 +30,4 @@ export function findCommand(id) {
|
||||
const command = commandsValue[id];
|
||||
return command;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import InputTextModal from '../modals/InputTextModal.svelte';
|
||||
import { removeLocalStorage } from '../utility/storageCache';
|
||||
import { showSnackbarSuccess } from '../utility/snackbar';
|
||||
import { apiCall } from '../utility/api';
|
||||
import runCommand from './runCommand';
|
||||
|
||||
function themeCommand(theme: ThemeDefinition) {
|
||||
return {
|
||||
@@ -533,3 +534,8 @@ export function registerFileCommands({
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const electron = getElectron();
|
||||
if (electron) {
|
||||
electron.addEventListener('run-command', (e, commandId) => runCommand(commandId));
|
||||
}
|
||||
|
||||
@@ -45,15 +45,6 @@ class ElectronApi {
|
||||
}
|
||||
}
|
||||
|
||||
// function initializeElectron(args) {
|
||||
// apiInstance = new ElectronApi(args);
|
||||
// if (window['dbgate_recreateSocket']) {
|
||||
// window['dbgate_recreateSocket']();
|
||||
// }
|
||||
// }
|
||||
|
||||
// window['dbgate_initializeElectron'] = initializeElectron;
|
||||
|
||||
function getIpcRenderer() {
|
||||
if (window['require']) {
|
||||
const electron = window['require']('electron');
|
||||
@@ -62,10 +53,6 @@ function getIpcRenderer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// export function shouldWaitForElectronInitialize() {
|
||||
// return !!getIpcRenderer() && !apiInstance;
|
||||
// }
|
||||
|
||||
export function isElectronAvailable() {
|
||||
return !!getIpcRenderer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user