mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
This commit is contained in:
parent
a6822dd293
commit
25fb3b71ca
@ -243,12 +243,13 @@ module.exports = {
|
||||
},
|
||||
|
||||
saveVolatile_meta: true,
|
||||
async saveVolatile({ conid, user, password, test }) {
|
||||
async saveVolatile({ conid, user = undefined, password = undefined, accessToken = undefined, test = false }) {
|
||||
const old = await this.getCore({ conid });
|
||||
const res = {
|
||||
...old,
|
||||
_id: crypto.randomUUID(),
|
||||
password,
|
||||
accessToken,
|
||||
passwordMode: undefined,
|
||||
unsaved: true,
|
||||
};
|
||||
@ -397,7 +398,9 @@ module.exports = {
|
||||
async dbloginToken({ code, conid, redirectUri }) {
|
||||
const connection = await this.getCore({ conid });
|
||||
const driver = requireEngineDriver(connection);
|
||||
const token = await driver.getAuthTokenFromCode(connection, { code, redirectUri });
|
||||
console.log('******************************** WE HAVE ACCESS TOKEN', token);
|
||||
const accessToken = await driver.getAuthTokenFromCode(connection, { code, redirectUri });
|
||||
const volatile = await this.saveVolatile({ conid, accessToken });
|
||||
console.log('******************************** WE HAVE ACCESS TOKEN', accessToken);
|
||||
socket.emit('got-volatile-token', { conid, volatileConId: volatile._id });
|
||||
},
|
||||
};
|
||||
|
@ -14,7 +14,7 @@
|
||||
// import { shouldWaitForElectronInitialize } from './utility/getElectron';
|
||||
import { subscribeConnectionPingers } from './utility/connectionsPinger';
|
||||
import { subscribePermissionCompiler } from './utility/hasPermission';
|
||||
import { apiCall } from './utility/api';
|
||||
import { apiCall, installNewVolatileConnectionListener } from './utility/api';
|
||||
import { getConfig, getSettings, getUsedApps } from './utility/metadataLoaders';
|
||||
import AppTitleProvider from './utility/AppTitleProvider.svelte';
|
||||
import getElectron from './utility/getElectron';
|
||||
@ -48,6 +48,7 @@
|
||||
subscribeApiDependendStores();
|
||||
subscribeConnectionPingers();
|
||||
subscribePermissionCompiler();
|
||||
installNewVolatileConnectionListener();
|
||||
}
|
||||
|
||||
loadedApi = loadedApiValue;
|
||||
|
@ -223,6 +223,12 @@ export function getVolatileConnections() {
|
||||
return Object.values(volatileConnectionMap);
|
||||
}
|
||||
|
||||
export function installNewVolatileConnectionListener() {
|
||||
apiOn('got-volatile-token', ({ conid, volatileConId }) => {
|
||||
setVolatileConnectionRemapping(conid, volatileConId);
|
||||
});
|
||||
}
|
||||
|
||||
function enableApiLog() {
|
||||
apiLogging = true;
|
||||
console.log('API loggin enabled');
|
||||
|
Loading…
Reference in New Issue
Block a user