From e003f6cf03aff4f142f6d97fbf1912a941cb719e Mon Sep 17 00:00:00 2001 From: x12sa Date: Sat, 28 Mar 2026 10:50:36 +0100 Subject: [PATCH] change url and fix in https certificate ignore --- .../plugins/flomni/flomni.py | 3 +- .../flomni/flomni_webpage_generator.py | 127 +++++++++--------- 2 files changed, 65 insertions(+), 65 deletions(-) diff --git a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py index 0f58094..70f58e6 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py @@ -1317,7 +1317,8 @@ class Flomni( self._webpage_gen = FlomniWebpageGenerator( bec_client=client, output_dir="~/data/raw/webpage/", - upload_url="http://s1090968537.online.de/upload.php", # optional + #upload_url="http://s1090968537.online.de/upload.php", # optional + upload_url="https://v1p0zyg2w9n2k9c1.myfritz.net/upload.php", ) self._webpage_gen.start() diff --git a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni_webpage_generator.py b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni_webpage_generator.py index b5e789d..4a0abda 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni_webpage_generator.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni_webpage_generator.py @@ -314,6 +314,7 @@ class HttpUploader: self._url, files={"file": (path.name, f)}, timeout=self._timeout, + verify=False, # accept self-signed / untrusted certs ) if r.status_code == 200: self._uploaded[str(path)] = mtime @@ -335,10 +336,10 @@ class HttpUploader: return try: r = _requests.post( - self._url, - data={"action": "cleanup"}, - timeout=self._timeout, - verify=False, + self._url, + data={"action": "cleanup"}, + timeout=self._timeout, + verify=False, # accept self-signed / untrusted certs ) logger.info(f"HttpUploader cleanup: {r.text[:120]}") # Forget mtime records for ptycho files so they get re-uploaded @@ -1672,84 +1673,80 @@ function initDrag() {{ }} initDrag(); - // ── Audio ───────────────────────────────────────────────────────────────── -// iOS (all browsers on iPhone use WebKit) requires: -// 1. AudioContext created inside a user gesture. -// 2. A real (even silent) BufferSource started synchronously in the gesture. -// 3. ctx.resume() awaited before scheduling audible nodes. -// We combine all three: silent unlock buffer + resume promise + .then(beeps). +// iOS (all browsers on iPhone use WebKit) strict rules: +// 1. AudioContext must be created inside a user gesture handler. +// 2. A real BufferSource must be started SYNCHRONOUSLY in the gesture — +// .then() / microtasks run outside the gesture and are rejected. +// 3. ctx.resume() is called fire-and-forget; beeps are delayed 80ms by +// setTimeout so the engine has time to start before nodes are scheduled. +// +// unlockAudio() handles all of this and must be called at the TOP of any +// onclick handler that wants audio — before any other logic. -let audioCtx = null, audioEnabled = false; -let audioArmed = false, warningActive = false, warningTimer = null, lastStatus = null; -let staleActive = false, staleTimer = null, staleConfirmed = false; +let audioCtx=null, audioEnabled=false; +let audioArmed=false, warningActive=false, warningTimer=null, lastStatus=null; +let staleActive=false, staleTimer=null, staleConfirmed=false; -function getCtx() {{ - if (!audioCtx) audioCtx = new (window.AudioContext || window.webkitAudioContext)(); +function getCtx(){{ + if(!audioCtx) audioCtx=new(window.AudioContext||window.webkitAudioContext)(); return audioCtx; }} -function unlockAudio() {{ - const ctx = getCtx(); - // Silent 1-sample buffer — synchronous iOS unlock - const buf = ctx.createBuffer(1, 1, ctx.sampleRate); - const src = ctx.createBufferSource(); - src.buffer = buf; - src.connect(ctx.destination); - src.start(0); - if (ctx.state === 'suspended') ctx.resume(); // fire-and-forget, no .then() +function unlockAudio(){{ + // Synchronous silent 1-sample buffer — the only reliable iOS unlock. + // Must be called synchronously at the start of a user gesture handler. + const ctx=getCtx(); + const buf=ctx.createBuffer(1,1,ctx.sampleRate); + const src=ctx.createBufferSource(); + src.buffer=buf; src.connect(ctx.destination); src.start(0); + if(ctx.state==='suspended') ctx.resume(); // fire-and-forget }} -function beep(freq, dur, vol) {{ - try {{ - const ctx = getCtx(); - const o = ctx.createOscillator(); - const g = ctx.createGain(); +function beep(freq,dur,vol){{ + try{{ + const ctx=getCtx(),o=ctx.createOscillator(),g=ctx.createGain(); o.connect(g); g.connect(ctx.destination); - o.type = 'sine'; - o.frequency.setValueAtTime(freq, ctx.currentTime); - g.gain.setValueAtTime(vol, ctx.currentTime); - g.gain.exponentialRampToValueAtTime(0.001, ctx.currentTime + dur); - o.start(); o.stop(ctx.currentTime + dur); - }} catch(e) {{ console.warn('Audio beep:', e); }} + o.type='sine'; o.frequency.setValueAtTime(freq,ctx.currentTime); + g.gain.setValueAtTime(vol,ctx.currentTime); + g.gain.exponentialRampToValueAtTime(0.001,ctx.currentTime+dur); + o.start(); o.stop(ctx.currentTime+dur); + }}catch(e){{console.warn('Audio:',e);}} }} -function warningChime() {{ - beep(660, 0.3, 0.4); - setTimeout(() => beep(440, 0.5, 0.4), 350); +function warningChime(){{ + beep(660,0.3,0.4); setTimeout(()=>beep(440,0.5,0.4),350); +}} +function staleChime(){{ + beep(1200,0.12,0.35); + setTimeout(()=>beep(1200,0.12,0.35),180); + setTimeout(()=>beep(1200,0.25,0.35),360); }} -function staleChime() {{ - beep(1200, 0.12, 0.35); - setTimeout(() => beep(1200, 0.12, 0.35), 180); - setTimeout(() => beep(1200, 0.25, 0.35), 360); -}} - -function testSound() {{ - // Everything synchronous inside the gesture — no .then() +function testSound(){{ + // Gesture handler — unlock first, then delay beeps 80ms for resume(). unlockAudio(); - // Small offset gives resume() time to complete before beeps fire - setTimeout(() => beep(880, 0.15, 0.4), 80); - setTimeout(() => beep(1100, 0.15, 0.4), 260); - setTimeout(() => beep(880, 0.3, 0.4), 440); + setTimeout(()=>beep(880, 0.15,0.4), 80); + setTimeout(()=>beep(1100,0.15,0.4),260); + setTimeout(()=>beep(880, 0.3, 0.4),440); }} -function toggleAudio() {{ - unlockAudio(); // synchronous, inside gesture - audioEnabled = !audioEnabled; - localStorage.setItem('audioEnabled', audioEnabled); - if (!audioEnabled) {{ - stopWarning(); audioArmed = false; warningActive = false; - document.getElementById('btn-confirm').style.display = 'none'; - stopStaleWarning(); staleActive = false; staleConfirmed = false; - document.getElementById('btn-confirm-stale').style.display = 'none'; +function toggleAudio(){{ + // Gesture handler — unlock first (synchronous), then do logic. + unlockAudio(); + audioEnabled=!audioEnabled; + localStorage.setItem('audioEnabled',audioEnabled); + if(!audioEnabled){{ + stopWarning(); audioArmed=false; warningActive=false; + document.getElementById('btn-confirm').style.display='none'; + stopStaleWarning(); staleActive=false; staleConfirmed=false; + document.getElementById('btn-confirm-stale').style.display='none'; }} else {{ - if (lastStatus === 'scanning' && !audioArmed) audioArmed = true; + if(lastStatus==='scanning' && !audioArmed) audioArmed=true; }} updateAudioUI(); }} - function confirmWarning(){{ stopWarning(); warningActive=false; @@ -1758,9 +1755,10 @@ function confirmWarning(){{ }} function startWarning(){{ + // Not a gesture handler — context already unlocked by Enable button click. if(warningActive) return; warningActive=true; - if(audioEnabled) warningChime(); // returns promise; chime plays after unlock + if(audioEnabled) warningChime(); warningTimer=setInterval(()=>{{ if(audioEnabled) warningChime(); }},30000); document.getElementById('btn-confirm').style.display='inline-block'; updateAudioUI(); @@ -1779,9 +1777,10 @@ function confirmStale(){{ }} function startStaleWarning(){{ + // Not a gesture handler — context already unlocked by Enable button click. if(staleActive || staleConfirmed) return; staleActive=true; - if(audioEnabled) staleChime(); // returns promise; chime plays after unlock + if(audioEnabled) staleChime(); staleTimer=setInterval(()=>{{ if(audioEnabled) staleChime(); }},30000); document.getElementById('btn-confirm-stale').style.display='inline-block'; updateAudioUI(); @@ -2010,4 +2009,4 @@ poll(); -""" +""" \ No newline at end of file