dbgate-api-premium 7.2.0 → 7.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/main.js CHANGED
@@ -31,6 +31,8 @@ const scheduler = require('./controllers/scheduler');
31
31
  const queryHistory = require('./controllers/queryHistory');
32
32
  const cloud = require('./controllers/cloud');
33
33
  const teamFiles = require('./controllers/teamFiles');
34
+ const mcpAdmin = require('./controllers/mcpAdmin');
35
+ const mcp = require('./mcp');
34
36
 
35
37
  const onFinished = require('on-finished');
36
38
  const processArgs = require('./utility/processArgs');
@@ -94,6 +96,7 @@ function start() {
94
96
  // console.log('process.argv', process.argv);
95
97
 
96
98
  const app = express();
99
+ app.set('trust proxy', 'loopback, linklocal, uniquelocal');
97
100
 
98
101
  const server = http.createServer(app);
99
102
 
@@ -175,6 +178,17 @@ function start() {
175
178
  });
176
179
 
177
180
  app.use(bodyParser.json({ limit: '50mb' }));
181
+ app.use(bodyParser.urlencoded({ extended: false }));
182
+
183
+ app.get(getExpressPath('/.well-known/oauth-protected-resource'), mcp.handleOAuthProtectedResourceMetadata);
184
+ app.get(getExpressPath('/.well-known/oauth-protected-resource/mcp'), mcp.handleOAuthProtectedResourceMetadata);
185
+ app.get(getExpressPath('/.well-known/oauth-authorization-server'), mcp.handleOAuthAuthorizationServerMetadata);
186
+ app.get(getExpressPath('/.well-known/openid-configuration'), mcp.handleOAuthAuthorizationServerMetadata);
187
+ app.get(getExpressPath('/authorize'), mcp.handleOAuthAuthorize);
188
+ app.post(getExpressPath('/token'), mcp.handleOAuthToken);
189
+ app.get(getExpressPath('/mcp/oauth/authorize'), mcp.handleOAuthAuthorize);
190
+ app.post(getExpressPath('/mcp/oauth/token'), mcp.handleOAuthToken);
191
+ app.post(getExpressPath('/mcp'), mcp.handleMcpRequest);
178
192
 
179
193
  app.use(
180
194
  getExpressPath('/uploads'),
@@ -269,6 +283,7 @@ function useAllControllers(app, electron) {
269
283
  useController(app, electron, '/cloud', cloud);
270
284
  useController(app, electron, '/team-files', teamFiles);
271
285
  useController(app, electron, '/rest-connections', restConnections);
286
+ useController(app, electron, '/mcp-admin', mcpAdmin);
272
287
  }
273
288
 
274
289
  function setElectronSender(electronSender) {