@trops/dash-core 0.1.80 → 0.1.82
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/dist/electron/index.js +26 -12
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +370 -56
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +370 -56
- package/dist/index.js.map +1 -1
- package/dist/mcp/servers/{servers/google-drive.js → google-drive.js} +26 -25
- package/package.json +2 -2
|
@@ -153,33 +153,12 @@ if (process.argv[2] === "auth") {
|
|
|
153
153
|
const { URL } = require("url");
|
|
154
154
|
const { client_id, client_secret } = getClientCredentials();
|
|
155
155
|
|
|
156
|
-
const keysFile = JSON.parse(fs.readFileSync(oauthKeysPath, "utf8"));
|
|
157
|
-
const keyData = keysFile.installed || keysFile.web;
|
|
158
|
-
const redirectUri =
|
|
159
|
-
keyData.redirect_uris?.[0] || "http://localhost:3000/oauth2callback";
|
|
160
|
-
|
|
161
|
-
// Extract port from redirect URI
|
|
162
|
-
const redirectUrl = new URL(redirectUri);
|
|
163
|
-
const port = parseInt(redirectUrl.port, 10) || 3000;
|
|
164
|
-
|
|
165
156
|
const scopes = ["https://www.googleapis.com/auth/drive.readonly"];
|
|
166
|
-
|
|
167
|
-
const authUrl =
|
|
168
|
-
`https://accounts.google.com/o/oauth2/v2/auth?` +
|
|
169
|
-
`client_id=${encodeURIComponent(client_id)}` +
|
|
170
|
-
`&redirect_uri=${encodeURIComponent(redirectUri)}` +
|
|
171
|
-
`&response_type=code` +
|
|
172
|
-
`&scope=${encodeURIComponent(scopes.join(" "))}` +
|
|
173
|
-
`&access_type=offline` +
|
|
174
|
-
`&prompt=consent`;
|
|
175
|
-
|
|
176
|
-
console.log(
|
|
177
|
-
`\nOpen this URL in your browser to authorize:\n\n${authUrl}\n`,
|
|
178
|
-
);
|
|
157
|
+
let redirectUri;
|
|
179
158
|
|
|
180
159
|
// Start local server to catch the callback
|
|
181
160
|
const server = http.createServer(async (req, res) => {
|
|
182
|
-
const reqUrl = new URL(req.url,
|
|
161
|
+
const reqUrl = new URL(req.url, redirectUri);
|
|
183
162
|
const code = reqUrl.searchParams.get("code");
|
|
184
163
|
if (!code) {
|
|
185
164
|
res.writeHead(400);
|
|
@@ -255,8 +234,30 @@ if (process.argv[2] === "auth") {
|
|
|
255
234
|
}
|
|
256
235
|
});
|
|
257
236
|
|
|
258
|
-
server.
|
|
259
|
-
console.
|
|
237
|
+
server.on("error", (err) => {
|
|
238
|
+
console.error("OAuth server error:", err.message);
|
|
239
|
+
process.exit(1);
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
// Use ephemeral port (0) — OS assigns a free port
|
|
243
|
+
server.listen(0, () => {
|
|
244
|
+
const actualPort = server.address().port;
|
|
245
|
+
redirectUri = `http://localhost:${actualPort}`;
|
|
246
|
+
|
|
247
|
+
const authUrl =
|
|
248
|
+
`https://accounts.google.com/o/oauth2/v2/auth?` +
|
|
249
|
+
`client_id=${encodeURIComponent(client_id)}` +
|
|
250
|
+
`&redirect_uri=${encodeURIComponent(redirectUri)}` +
|
|
251
|
+
`&response_type=code` +
|
|
252
|
+
`&scope=${encodeURIComponent(scopes.join(" "))}` +
|
|
253
|
+
`&access_type=offline` +
|
|
254
|
+
`&prompt=consent`;
|
|
255
|
+
|
|
256
|
+
const { exec } = require("child_process");
|
|
257
|
+
exec(`open "${authUrl}"`);
|
|
258
|
+
console.log(
|
|
259
|
+
`\nOpening browser for authorization (port ${actualPort})...\n`,
|
|
260
|
+
);
|
|
260
261
|
});
|
|
261
262
|
} catch (err) {
|
|
262
263
|
console.error("Auth error:", err.message);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trops/dash-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.82",
|
|
4
4
|
"description": "Core framework for Dash dashboard applications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "npm run build:renderer && npm run build:electron",
|
|
21
21
|
"build:renderer": "rollup -c rollup.config.renderer.mjs",
|
|
22
|
-
"build:electron": "rollup -c rollup.config.electron.mjs && mkdir -p dist/mcp
|
|
22
|
+
"build:electron": "rollup -c rollup.config.electron.mjs && mkdir -p dist/mcp && cp electron/mcp/mcpServerCatalog.json dist/mcp/ && rm -rf dist/mcp/servers && cp -r electron/mcp/servers dist/mcp/",
|
|
23
23
|
"clean": "rm -rf dist",
|
|
24
24
|
"prepublishOnly": "npm run clean && npm run build",
|
|
25
25
|
"test:mcp": "node --test electron/controller/mcpController.test.js electron/mcp/mcpServerCatalog.test.js",
|