diff --git a/packages/selenium-ide/src/api/index.js b/packages/selenium-ide/src/api/index.js index 10b68f0ab..7c22fa52c 100644 --- a/packages/selenium-ide/src/api/index.js +++ b/packages/selenium-ide/src/api/index.js @@ -17,6 +17,7 @@ import Router from '../router' import apiv1 from './v1' +import Manager from '../plugin/manager' const router = new Router() router.use('/v1', apiv1) @@ -26,6 +27,16 @@ export default function(message, _backgroundPage, sendResponse) { // The sender is always the background page since he is the one listening to the event // message.sender is the external extension id if (message.uri) { + if ( + message.uri !== '/health' && + message.uri !== '/register' && + !Manager.hasPlugin(message.payload.sender) + ) { + return sendResponse({ + error: + 'Plugin is not registered with Selenium IDE, send a request to /register first', + }) + } router .run(message) .then(sendResponse) diff --git a/packages/selenium-ide/src/api/v1/index.js b/packages/selenium-ide/src/api/v1/index.js index 61083d912..cb97682cc 100644 --- a/packages/selenium-ide/src/api/v1/index.js +++ b/packages/selenium-ide/src/api/v1/index.js @@ -63,8 +63,8 @@ router.get('/project', (_req, res) => { }) router.post('/project', (req, res) => { + const plugin = Manager.getPlugin(req.sender) if (req.project) { - const plugin = Manager.getPlugin(req.sender) if (!UiState.isSaved()) { ModalState.showAlert({ title: 'Open project without saving',