diff --git a/app/src/mainMenuDefinition.js b/app/src/mainMenuDefinition.js index 3cfa0bec..06e5a251 100644 --- a/app/src/mainMenuDefinition.js +++ b/app/src/mainMenuDefinition.js @@ -17,6 +17,7 @@ module.exports = [ { command: 'group.saveAs', hideDisabled: true }, { divider: true }, { command: 'file.exit', hideDisabled: true }, + { command: 'app.logout', hideDisabled: true }, ], }, { diff --git a/packages/api/src/controllers/config.js b/packages/api/src/controllers/config.js index acac6038..acd61ccc 100644 --- a/packages/api/src/controllers/config.js +++ b/packages/api/src/controllers/config.js @@ -38,10 +38,19 @@ module.exports = { allowShellConnection: platformInfo.allowShellConnection, allowShellScripting: platformInfo.allowShellConnection, permissions, + login, ...currentVersion, }; }, + logout_meta: { + method: 'get', + raw: true, + }, + logout(req, res) { + res.status(401).send('Logged out
Back to DbGate'); + }, + platformInfo_meta: true, async platformInfo() { return platformInfo; diff --git a/packages/web/src/commands/stdCommands.ts b/packages/web/src/commands/stdCommands.ts index b464a5c5..46d1ff00 100644 --- a/packages/web/src/commands/stdCommands.ts +++ b/packages/web/src/commands/stdCommands.ts @@ -486,6 +486,16 @@ registerCommand({ onClick: () => getElectron().send('close-window'), }); +registerCommand({ + id: 'app.logout', + category: 'App', + name: 'Logout', + testEnabled: () => getCurrentConfig()?.login != null, + onClick: () => { + window.location.href = 'config/logout'; + }, +}); + export function registerFileCommands({ idPrefix, category,