@hmduc16031996/claude-mb-bridge 2.4.9 → 2.5.1

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/index.js CHANGED
@@ -3,21 +3,17 @@ import { Command } from 'commander';
3
3
  import { CloudflareTunnel } from './tunnel.js';
4
4
  import { startTerminalServer } from './server.js';
5
5
  const program = new Command();
6
- const CLOUDFLARE_TUNNEL_TOKEN = 'eyJhIjoiZmM5YTQ4ZTU3NjY4NjI3MjY2OWE3YzBiMTliNTcyYzgiLCJ0IjoiMjgzM2E5NjMtNTBiYi00YThjLWJhMGMtNDI4NWE4ZTJkZmJjIiwicyI6IllqYzVaakF3T1RJdFpEWXdZeTAwWkRFNUxUZzVNR0l0WXpBeE1UazJNamc1T1dZeCJ9';
7
- const CLOUDFLARE_PUBLIC_URL = 'https://mobileideforusers.kanddlabs.com';
8
6
  program
9
7
  .name('claude-mobile-bridge')
10
8
  .description('Bridge Claude Code CLI to mobile via WebView')
11
9
  .version('2.4.1')
12
10
  .option('--token <token>', 'Pairing token from mobile app')
13
- .option('--server <url>', 'Backend server URL', 'https://mobileide.kanddlabs.com')
11
+ .option('--server <url>', 'Backend server URL', 'http://127.0.0.1:3110')
14
12
  .option('--path <path>', 'Working directory', process.cwd())
15
13
  .option('--port <port>', 'Local port for terminal server', '38473')
16
14
  .option('--ide <type>', 'IDE type: claude_code or cursor', 'claude_code')
17
- .option('--tunnel-token <token>', 'Cloudflare Tunnel token (managed tunnel)', CLOUDFLARE_TUNNEL_TOKEN)
18
- .option('--public-url <url>', 'Static public URL for the tunnel', CLOUDFLARE_PUBLIC_URL)
19
15
  .action(async (options) => {
20
- const { token, server, path, port, ide, tunnelToken, publicUrl } = options;
16
+ const { token, server, path, port, ide } = options;
21
17
  if (!token) {
22
18
  console.error('Error: --token is required');
23
19
  process.exit(1);
@@ -43,14 +39,12 @@ program
43
39
  // 2. Start Cloudflare Tunnel
44
40
  console.log('🌐 Establishing secure tunnel...');
45
41
  const tunnel = new CloudflareTunnel();
46
- const tunnelResult = await tunnel.start(actualPort, tunnelToken);
47
- // If using a token, use the provided publicUrl or hardcoded one
48
- const finalUrl = tunnelToken ? publicUrl : tunnelResult.url;
49
- if (!finalUrl) {
50
- console.error('❌ Failed to establish secure tunnel.');
42
+ const tunnelResult = await tunnel.start(actualPort);
43
+ if (!tunnelResult.url) {
44
+ console.error('❌ Failed to start Cloudflare Tunnel.');
51
45
  process.exit(1);
52
46
  }
53
- console.log(`✅ Secure tunnel established at ${finalUrl}`);
47
+ console.log('✅ Secure tunnel established');
54
48
  // 3. Validate token and report public URL to central server
55
49
  console.log('🔑 Validating session token...');
56
50
  try {
@@ -60,7 +54,7 @@ program
60
54
  'Content-Type': 'application/json'
61
55
  },
62
56
  body: JSON.stringify({
63
- public_url: finalUrl
57
+ public_url: tunnelResult.url
64
58
  })
65
59
  });
66
60
  if (!res.ok) {
package/dist/tunnel.d.ts CHANGED
@@ -4,6 +4,6 @@ export interface TunnelResult {
4
4
  }
5
5
  export declare class CloudflareTunnel {
6
6
  private process;
7
- start(port: number, token?: string): Promise<TunnelResult>;
7
+ start(port: number): Promise<TunnelResult>;
8
8
  private cleanup;
9
9
  }
package/dist/tunnel.js CHANGED
@@ -1,23 +1,13 @@
1
1
  import { spawn } from 'child_process';
2
2
  export class CloudflareTunnel {
3
3
  process = null;
4
- async start(port, token) {
4
+ async start(port) {
5
5
  return new Promise((resolve) => {
6
6
  try {
7
- const args = token
8
- ? ['tunnel', 'run', '--token', token]
9
- : ['tunnel', '--url', `http://localhost:${port}`];
10
- const proc = spawn('cloudflared', args, {
7
+ const proc = spawn('cloudflared', ['tunnel', '--url', `http://localhost:${port}`], {
11
8
  stdio: ['ignore', 'pipe', 'pipe'],
12
9
  });
13
10
  this.process = proc;
14
- if (token) {
15
- // For named tunnels, resolve immediately after a short delay
16
- setTimeout(() => {
17
- resolve({ url: null, cleanup: () => this.cleanup() });
18
- }, 2000);
19
- return;
20
- }
21
11
  let output = '';
22
12
  const timeout = setTimeout(() => {
23
13
  resolve({ url: null, cleanup: () => this.cleanup() });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmduc16031996/claude-mb-bridge",
3
- "version": "2.4.9",
3
+ "version": "2.5.1",
4
4
  "description": "Bridge between Claude Code CLI and your mobile app via WebView",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",