csaxs_bec.bec_ipython_client.plugins.flomni.flomni_webpage_generator.HttpUploader#
- class HttpUploader(url: str, timeout: float = 20.0)[source]#
Bases:
objectUploads files from a local directory to a remote server via HTTP POST.
Uploads run in a daemon thread so they never block the generator cycle. If an upload is already in progress when the next cycle fires, the new upload request is dropped (logged at DEBUG level) rather than queuing up.
- File tracking:
Tracks mtime of each file; only re-uploads files that have changed.
upload_dir() – uploads ALL eligible files (called once at start).
upload_changed() – uploads only files whose mtime has changed.
- Scan change cleanup:
cleanup_ptycho_images() – sends action=cleanup POST to the server, asking it to delete all S*_*.png and S*_*.jpg files. Called automatically by the generator when the ptycho scan ID changes.
- The server-side upload.php must:
Accept POST with multipart file upload (field name ‘file’).
Accept POST with action=cleanup to delete ptycho image files.
Enforce IP-based access control (129.129.122.x).
Validate filename with regex to block path traversal.
Methods
Ask the server to delete all S*_*.png / S*_*.jpg files (background).
Upload only changed files in directory, in a background thread.
Upload ALL eligible files in directory, in a background thread.
Upload a single specific file, bypassing suffix whitelist and mtime check.
- cleanup_ptycho_images_async() None[source]#
Ask the server to delete all S*_*.png / S*_*.jpg files (background).
- upload_changed_async(directory: Path) None[source]#
Upload only changed files in directory, in a background thread.