nothumanallowed 12.6.5 → 12.6.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nothumanallowed",
3
- "version": "12.6.5",
3
+ "version": "12.6.6",
4
4
  "description": "NotHumanAllowed — 38 AI agents, 80 tools. Email, calendar, browser automation, screen capture, canvas, cron/heartbeat, Alexandria E2E messaging, GitHub, Notion, Slack, voice chat, free AI (Liara), 28 languages. Zero-dependency CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -335,21 +335,40 @@ export async function cmdUI(args) {
335
335
 
336
336
  // POST /api/google/auth — trigger Google OAuth flow from web UI
337
337
  if (method === 'POST' && pathname === '/api/google/auth') {
338
+ // Check if Google credentials are configured first
339
+ const clientId = config.google?.clientId || '';
340
+ const clientSecret = config.google?.clientSecret || '';
341
+ if (!clientId) {
342
+ sendJSON(res, 200, {
343
+ ok: false,
344
+ needsSetup: true,
345
+ message: 'Google OAuth not configured yet.\n\n' +
346
+ 'To connect Google services, you need OAuth credentials:\n\n' +
347
+ '1. Go to https://console.cloud.google.com/apis/credentials\n' +
348
+ '2. Create an OAuth 2.0 Client ID (Desktop app type)\n' +
349
+ '3. Enable Gmail API, Calendar API, Drive API, People API, Tasks API\n' +
350
+ '4. Add authorized redirect URIs: http://127.0.0.1:19847/callback through http://127.0.0.1:19851/callback\n' +
351
+ '5. In the NHA terminal, run:\n' +
352
+ ' nha config set google-client-id YOUR_CLIENT_ID\n' +
353
+ ' nha config set google-client-secret YOUR_CLIENT_SECRET\n' +
354
+ '6. Then click "Connect Google" again.',
355
+ });
356
+ logRequest(method, pathname, 200, Date.now() - start);
357
+ return;
358
+ }
338
359
  try {
339
360
  const { runAuthFlow } = await import('../services/google-oauth.mjs');
340
- // Run auth flow — opens browser, waits for callback
341
361
  const success = await runAuthFlow(config);
342
362
  if (success) {
343
363
  config._googleConnected = true;
344
- // Reload config to pick up new tokens
345
364
  const freshConfig = await loadConfig();
346
365
  Object.assign(config, freshConfig);
347
366
  sendJSON(res, 200, { ok: true, message: 'Google connected successfully! You can now use email, calendar, contacts, and Drive.' });
348
367
  } else {
349
- sendJSON(res, 200, { ok: false, message: 'Google OAuth failed. Make sure you authorized the app in the browser window.' });
368
+ sendJSON(res, 200, { ok: false, message: 'Google OAuth failed. The browser window should have opened at accounts.google.com. If it didn\'t, try running "nha google" from the terminal.' });
350
369
  }
351
370
  } catch (e) {
352
- sendJSON(res, 500, { error: `Google OAuth error: ${e.message}. Run "nha google" from terminal for manual setup.` });
371
+ sendJSON(res, 500, { error: `Google OAuth error: ${e.message}. Try running "nha google" from the terminal.` });
353
372
  }
354
373
  logRequest(method, pathname, 200, Date.now() - start);
355
374
  return;
package/src/constants.mjs CHANGED
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';
5
5
  const __filename = fileURLToPath(import.meta.url);
6
6
  const __dirname = path.dirname(__filename);
7
7
 
8
- export const VERSION = '12.6.5';
8
+ export const VERSION = '12.6.6';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -44,9 +44,14 @@ function generatePKCE() {
44
44
  function openBrowser(url) {
45
45
  const platform = os.platform();
46
46
  try {
47
- if (platform === 'darwin') execSync(`open "${url}"`);
48
- else if (platform === 'win32') execSync(`start "" "${url}"`);
49
- else execSync(`xdg-open "${url}"`);
47
+ if (platform === 'darwin') {
48
+ execSync(`open "${url}"`);
49
+ } else if (platform === 'win32') {
50
+ // Use rundll32 — more reliable than 'start' in batch/npm contexts
51
+ execSync(`rundll32 url.dll,FileProtocolHandler "${url}"`);
52
+ } else {
53
+ execSync(`xdg-open "${url}"`);
54
+ }
50
55
  } catch {
51
56
  warn('Could not open browser automatically.');
52
57
  info(`Open this URL manually:\n\n ${url}\n`);