Multi-Hoster-Upload-2/src/drop-target.html
Claude 100bda60cd Add OTP flow, drop-target floating window, in-app auto-update installer
OTP (Doodstream two-factor):
  - src/otp.rs: OtpBroker registers per-request oneshot channels with
    180s timeout, survives abort via Cancelled answer.
  - Doodstream login now loops: first attempt without OTP; if server
    says OTP required, emit 'otp-required' event to the renderer with
    a request_id, wait for provide_otp/cancel_otp commands, re-POST
    with the code. Renderer can pop a modal on otp-required.
  - UploadCtx carries the broker + app handle so any future hoster can
    do the same pattern.

Drop-target floating window:
  - src/drop-target.html: minimal always-on-top borderless window with
    dashed drop-zone. Emits 'drop-target-files' to the main window on
    drag-drop.
  - show_drop_target / hide_drop_target commands create/close the
    'drop-target' webview on demand.
  - Capabilities updated for dual-window use.

In-app auto-update:
  - updater::download_and_launch: fetches the NSIS/MSI from Gitea to
    %TEMP%, launches detached, exits the app so the installer can
    replace the running exe.
  - Commands install_update + install_update_now both go through the
    new helper. Renderer clicks 'Install Update' → Rust downloads and
    hands off, then process exit.

Härtetest results:
  - exe: 7.54 MB
  - NSIS: 2.70 MB
  - MSI:  3.69 MB
  - RAM idle: 33 MB (vs Electron ~300 MB)
  - All 3 unit tests pass (secret encryption round-trips).
2026-04-20 18:08:18 +02:00

35 lines
1.3 KiB
HTML

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Drop Target</title>
<style>
html, body { margin: 0; padding: 0; height: 100%; background: rgba(18, 22, 29, 0.92);
color: #e6e8eb; font: 12px "Segoe UI", system-ui, sans-serif; user-select: none; }
body { display: flex; flex-direction: column; align-items: center; justify-content: center;
border: 2px dashed rgba(126, 220, 255, 0.32); border-radius: 12px; margin: 2px;
transition: all 0.15s; -webkit-app-region: drag; }
body.hover { border-color: rgba(126, 220, 255, 0.72); background: rgba(62, 167, 255, 0.08); }
.icon { font-size: 32px; margin-bottom: 6px; }
.txt { color: #9aa3ae; letter-spacing: 0.04em; }
</style>
</head>
<body>
<div class="icon">&#128228;</div>
<div class="txt">Dateien hier ablegen</div>
<script>
const T = window.__TAURI__;
const { listen, emit } = T.event;
listen('tauri://drag-enter', () => document.body.classList.add('hover'));
listen('tauri://drag-leave', () => document.body.classList.remove('hover'));
listen('tauri://drag-drop', (ev) => {
document.body.classList.remove('hover');
const paths = (ev.payload && (ev.payload.paths || ev.payload)) || [];
if (paths.length) {
emit('drop-target-files', paths);
}
});
</script>
</body>
</html>