@@ -403,31 +403,32 @@ function App() {
403403 }
404404
405405 function runSpeedTest ( ) {
406- const testUrl = 'https://speed.hetzner.de/10MB.bin' ;
406+ const testUrl = 'https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png' ;
407+ const fileSize = 13 * 1024 ; // Approximate size in bytes
407408 const started = performance . now ( ) ;
408- setSpeedState ( { running : true , dl : null , ul : null , ping : null , message : 'Downloading a test payload…' } ) ;
409+ setSpeedState ( { running : true , dl : null , ul : null , ping : null , message : 'Testing download speed…' } ) ;
410+
409411 fetch ( testUrl , { cache : 'no-store' } )
410412 . then ( async ( res ) => {
411413 if ( ! res . ok ) throw new Error ( `HTTP ${ res . status } ` ) ;
412414 const reader = res . body ?. getReader ( ) ;
413415 if ( ! reader ) throw new Error ( 'Streaming not available in this browser' ) ;
414416 let loaded = 0 ;
415- const total = Number ( res . headers . get ( 'content-length' ) ) || 10 * 1024 * 1024 ;
416417 while ( true ) {
417418 const { done, value } = await reader . read ( ) ;
418419 if ( done ) break ;
419420 loaded += value . byteLength ;
420421 }
421422 const seconds = ( performance . now ( ) - started ) / 1000 ;
422423 const mbps = ( loaded * 8 ) / seconds / 1_000_000 ;
423- setSpeedState ( { running : false , dl : mbps . toFixed ( 2 ) , ul : '—' , ping : '—' , message : `${ Math . round ( ( loaded / total ) * 100 ) } % ` } ) ;
424+ setSpeedState ( { running : false , dl : mbps . toFixed ( 2 ) , ul : '—' , ping : '—' , message : `Test complete ` } ) ;
424425 const record = {
425426 id : `${ Date . now ( ) } -${ Math . random ( ) . toString ( 16 ) . slice ( 2 ) } ` ,
426427 input : 'speed test' ,
427428 normalized : 'speed test' ,
428429 type : 'speed' ,
429430 label : 'Speed test' ,
430- output : { downloadMbps : mbps . toFixed ( 2 ) , note : 'Download estimate from a single download payload .' } ,
431+ output : { downloadMbps : mbps . toFixed ( 2 ) , note : 'Download estimate from a single test file .' } ,
431432 actions : [ 'copy' , 'pin' ] ,
432433 createdAt : new Date ( ) . toISOString ( ) ,
433434 } ;
@@ -529,7 +530,7 @@ function App() {
529530 }
530531 } }
531532 placeholder = "Search or run a command… 100 usd to myr, password 20, qr https://..., 16*24+10"
532- className = "w-full rounded-2xl border border-slate-700 bg-black/70 px-5 py-5 pr-28 text-lg outline-none ring-0 transition placeholder:text-slate-500 focus:border-slate-400 focus:bg-black "
533+ className = "w-full rounded-2xl border border-slate-700 bg-black/70 px-5 py-5 pr-28 text-lg outline-none ring-0 transition placeholder:text-slate-500 focus:border-slate-400 focus:bg-slate-900 "
533534 />
534535 < div className = "pointer-events-none absolute inset-y-0 right-3 flex items-center gap-2 text-xs text-slate-400" >
535536 < span > ⌘↵</ span >
@@ -550,7 +551,7 @@ function App() {
550551 < div className = "flex flex-col" >
551552 < span className = "font-mono text-sm" > { s } </ span >
552553 < span className = "mt-1 text-xs text-slate-500" >
553- { s . includes ( 'to' ) ? 'Conversion command' : s . includes ( 'password' ) ? 'Password generation' : s . includes ( 'qr' ) ? 'QR generation' : s . includes ( 'speed' ) ? 'Network test' : 'Calculator ' }
554+ { s . includes ( 'to' ) ? 'Conversion command' : s . includes ( 'password' ) ? 'Password generation' : s . includes ( 'qr' ) ? 'QR generation' : s . includes ( 'speed' ) ? 'Network test' : 'Command ' }
554555 </ span >
555556 </ div >
556557
@@ -666,7 +667,7 @@ function App() {
666667 < div className = "rounded-2xl border border-slate-800 bg-slate-900 px-4 py-4" >
667668 < div className = "text-sm text-slate-400" > Speed test status</ div >
668669 < div className = "mt-1 text-lg text-slate-100" > { speedState ?. message || result . output . title } </ div >
669- < div className = "mt-2 text-sm text-slate-400" > This prototype can run a basic download-based estimate, but a robust speed test should use your own test endpoint.</ div >
670+ < div className = "mt-2 text-sm text-slate-400" > This prototype runs a basic download-based estimate. For production use, configure your own test endpoint.</ div >
670671 </ div >
671672 < div className = "grid gap-3 md:grid-cols-3" >
672673 < div className = "rounded-2xl border border-slate-800 bg-slate-900 px-4 py-4" >
@@ -838,7 +839,7 @@ function App() {
838839 < ul className = "mt-4 space-y-3 text-sm text-slate-400" >
839840 < li > QR generation uses a public image endpoint for this prototype. Swap it for a local library before deploying.</ li >
840841 < li > Currency conversion is manual/static here. Replace it with a real rate source if you need live FX.</ li >
841- < li > Speed test is scaffolded; the browser download test works only if the test URL is reachable and not blocked by CORS .</ li >
842+ < li > Speed test now uses Google's public logo image for testing. For production, configure your own test file or backend endpoint .</ li >
842843 </ ul >
843844 </ div >
844845 </ aside >
0 commit comments