@@ -6,15 +6,10 @@ let isConnected = false;
66let checkInterval = null ;
77const DEBUG = true ;
88
9- // 🎯 BUSINESS LOGIC: Detect if we're on Tailnet or localhost
9+ // 🎯 BUSINESS LOGIC: Only Tailscale domain gets interactive features
1010const currentDomain = window . location . hostname ;
1111const IS_INTERACTIVE_DOMAIN = currentDomain === '1minds3t.echo-universe.ts.net' || currentDomain === 'localhost' || currentDomain === '127.0.0.1' ;
1212
13- // Use Tailscale proxy when accessing remotely
14- const BRIDGE_URL = currentDomain === '1minds3t.echo-universe.ts.net'
15- ? 'https://1minds3t.echo-universe.ts.net/omnipkg-api' // Tailscale proxy
16- : `http://127.0.0.1:${ PORT } ` ; // Direct localhost
17-
1813const SAFE_TELEMETRY_KEYS = new Set ( [
1914 'command' , 'path' , 'title' , 'port' , 'package' ,
2015 'method' , 'error' , 'duration' , 'success'
@@ -140,34 +135,27 @@ function createStatusBanner() {
140135async function checkHealth ( ) {
141136 if ( ! IS_INTERACTIVE_DOMAIN ) return ;
142137
143- debug ( `Health check: ${ BRIDGE_URL } ` ) ;
144-
145- // 📊 TELEMETRY: Always notify Cloudflare of health checks
146- sendTelemetry ( "health_check" , { method : currentDomain === '1minds3t.echo-universe.ts.net' ? 'tailnet' : 'direct' } ) ;
138+ debug ( `Health check: Direct connection to localhost:${ PORT } ` ) ;
147139
148140 try {
149- const res = await fetch ( `${ BRIDGE_URL } /health` , { // ← USE BRIDGE_URL
141+ // 🔥 DIRECT CONNECTION: No worker proxy needed
142+ const res = await fetch ( `http://127.0.0.1:${ PORT } /health` , {
150143 method : 'GET' ,
151144 headers : { 'Content-Type' : 'application/json' }
152145 } ) ;
153146
154147 if ( res . ok ) {
155148 const data = await res . json ( ) ;
156149 updateStatus ( true , `Connected to Local Bridge v${ data . version || '2.1.0' } (Port ${ PORT } )` ) ;
157- // Track successful connection
158- sendTelemetry ( "bridge_connected" , { port : PORT , version : data . version } ) ;
159150 } else {
160151 updateStatus ( false , 'Local bridge not running | Run: 8pkg web start' ) ;
161- sendTelemetry ( "bridge_failed" , { port : PORT , status : res . status } ) ;
162152 }
163153 } catch ( e ) {
164154 debug ( 'Health check failed:' , e ) ;
165155 updateStatus ( false , 'Local bridge not running | Run: 8pkg web start' ) ;
166- sendTelemetry ( "bridge_offline" , { port : PORT , error : e . message } ) ;
167156 }
168157}
169158
170-
171159function updateStatus ( connected , message ) {
172160 isConnected = connected ;
173161 const dot = document . getElementById ( 'status-dot' ) ;
@@ -283,11 +271,9 @@ function createStaticButton() {
283271// ==========================================
284272// Execute Command
285273// ==========================================
286-
287274async function runCommand ( cmd , btnElement ) {
288275 if ( ! isConnected ) {
289276 alert ( 'Local bridge not running. Start with: 8pkg web start' ) ;
290- sendTelemetry ( "command_blocked" , { reason : "bridge_offline" } ) ;
291277 return ;
292278 }
293279
@@ -313,16 +299,14 @@ async function runCommand(cmd, btnElement) {
313299 // Send telemetry (fire and forget)
314300 sendTelemetry ( "command_exec" , { command : cmd . split ( ' ' ) [ 0 ] } ) ;
315301
316- const startTime = Date . now ( ) ;
317-
318302 try {
319303 // Open modal immediately to show streaming output
320304 const modal = createStreamingModal ( cmd ) ;
321305 const outputPre = modal . querySelector ( '.omni-output' ) ;
322306 let fullOutput = '' ;
323307
324- // 🔥 CONNECTION with streaming
325- const res = await fetch ( `${ BRIDGE_URL } /run` , {
308+ // 🔥 DIRECT CONNECTION with streaming
309+ const res = await fetch ( `http://127.0.0.1: ${ PORT } /run` , {
326310 method : 'POST' ,
327311 headers : {
328312 'Content-Type' : 'application/json'
@@ -358,14 +342,6 @@ async function runCommand(cmd, btnElement) {
358342 }
359343 }
360344
361- // Track successful completion
362- const duration = Date . now ( ) - startTime ;
363- sendTelemetry ( "command_complete" , {
364- command : cmd . split ( ' ' ) [ 0 ] ,
365- duration_ms : duration ,
366- success : true
367- } ) ;
368-
369345 // Success state
370346 btnElement . innerHTML = '' ;
371347 const checkIcon = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) ;
@@ -389,15 +365,6 @@ async function runCommand(cmd, btnElement) {
389365 } , 2000 ) ;
390366 } catch ( e ) {
391367 debug ( 'Command error:' , e ) ;
392-
393- // Track error
394- const duration = Date . now ( ) - startTime ;
395- sendTelemetry ( "command_error" , {
396- command : cmd . split ( ' ' ) [ 0 ] ,
397- error : e . message ,
398- duration_ms : duration
399- } ) ;
400-
401368 showOutput ( cmd , `Error: ${ e . message } ` ) ;
402369
403370 btnElement . innerHTML = '' ;
0 commit comments