Compare commits
125 changed files with 391 additions and 5233 deletions
|
|
@ -69,7 +69,6 @@ Never modify: everything outside this folder. `~/Projects/*` is read-only refere
|
|||
| `python3 tools/gen_assets.py icons` | adds icons: put the name in `tools/icons.txt` first | S003 |
|
||||
| `nice cargo build --release -j 2` | release build (never at the same time as the tests) | 01 Foundation |
|
||||
| `nice cargo test -j 2 -p medlar-testserver` / `cargo run -p medlar-testserver -- [--port N] [--tls] [--media] [--proxies]` | local server with faults and proxy stubs; API in the `crates/testserver/src/lib.rs` header | S002 |
|
||||
| `PORT=… TS=… tools/tray-check/run.sh <name> <driver> [tray] [second]` | close to tray in a hidden niri with a fake tray host (drivers `tray.sh`, `notray.sh`, `min.sh`); testserver on `$TS` | S047 |
|
||||
| `ssh [email protected] hub-release` | release notes on Astar Hub (release only, after the user's yes) | now |
|
||||
|
||||
Don't assume a tool exists: check first. When your plan creates a tool, add its row here.
|
||||
|
|
|
|||
108
Cargo.lock
generated
108
Cargo.lock
generated
|
|
@ -714,42 +714,18 @@ dependencies = [
|
|||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "calloop"
|
||||
version = "0.14.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"polling",
|
||||
"rustix 1.1.6",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "calloop-wayland-source"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20"
|
||||
dependencies = [
|
||||
"calloop 0.13.0",
|
||||
"calloop",
|
||||
"rustix 0.38.44",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "calloop-wayland-source"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa"
|
||||
dependencies = [
|
||||
"calloop 0.14.5",
|
||||
"rustix 1.1.6",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cbc"
|
||||
version = "0.2.1"
|
||||
|
|
@ -1403,7 +1379,6 @@ dependencies = [
|
|||
"profiling",
|
||||
"raw-window-handle",
|
||||
"serde",
|
||||
"smithay-clipboard",
|
||||
"web-time",
|
||||
"windows-sys 0.61.2",
|
||||
"winit",
|
||||
|
|
@ -2812,7 +2787,7 @@ checksum = "7ebb8d8732c6a6df3d8f032a82911cfc747e00efb95cc46e8d0acd5b5b88570c"
|
|||
|
||||
[[package]]
|
||||
name = "medlar"
|
||||
version = "0.1.1"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"chrono",
|
||||
|
|
@ -2837,14 +2812,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "medlar-cli"
|
||||
version = "0.1.1"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"medlar-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "medlar-core"
|
||||
version = "0.1.1"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"arc-swap",
|
||||
|
|
@ -2888,7 +2863,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "medlar-testserver"
|
||||
version = "0.1.1"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"md-5",
|
||||
"rcgen",
|
||||
|
|
@ -4963,8 +4938,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"calloop 0.13.0",
|
||||
"calloop-wayland-source 0.3.0",
|
||||
"calloop",
|
||||
"calloop-wayland-source",
|
||||
"cursor-icon",
|
||||
"libc",
|
||||
"log",
|
||||
|
|
@ -4981,44 +4956,6 @@ dependencies = [
|
|||
"xkeysym",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smithay-client-toolkit"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"calloop 0.14.5",
|
||||
"calloop-wayland-source 0.4.1",
|
||||
"cursor-icon",
|
||||
"libc",
|
||||
"log",
|
||||
"memmap2",
|
||||
"rustix 1.1.6",
|
||||
"thiserror 2.0.21",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-csd-frame",
|
||||
"wayland-cursor",
|
||||
"wayland-protocols",
|
||||
"wayland-protocols-experimental",
|
||||
"wayland-protocols-misc",
|
||||
"wayland-protocols-wlr",
|
||||
"wayland-scanner",
|
||||
"xkeysym",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smithay-clipboard"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"smithay-client-toolkit 0.20.0",
|
||||
"wayland-backend",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smol_str"
|
||||
version = "0.2.2"
|
||||
|
|
@ -5527,7 +5464,6 @@ version = "0.1.44"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
|
||||
dependencies = [
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
"tracing-core",
|
||||
|
|
@ -5895,32 +5831,6 @@ dependencies = [
|
|||
"wayland-scanner",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols-experimental"
|
||||
version = "20250721.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
"wayland-scanner",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols-misc"
|
||||
version = "0.3.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
"wayland-scanner",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols-plasma"
|
||||
version = "0.3.12"
|
||||
|
|
@ -6401,7 +6311,7 @@ dependencies = [
|
|||
"bitflags 2.13.2",
|
||||
"block2 0.5.1",
|
||||
"bytemuck",
|
||||
"calloop 0.13.0",
|
||||
"calloop",
|
||||
"cfg_aliases",
|
||||
"concurrent-queue",
|
||||
"core-foundation 0.9.4",
|
||||
|
|
@ -6422,7 +6332,7 @@ dependencies = [
|
|||
"raw-window-handle",
|
||||
"redox_syscall 0.4.1",
|
||||
"rustix 0.38.44",
|
||||
"smithay-client-toolkit 0.19.2",
|
||||
"smithay-client-toolkit",
|
||||
"smol_str",
|
||||
"tracing",
|
||||
"unicode-segmentation",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ members = ["crates/*"]
|
|||
resolver = "3"
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.1"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
license = "MIT"
|
||||
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ Version 1 is solid, light and complete. Was S037 and S038.
|
|||
- CLAUDE.md §4, docs/CONNECTOR.md, docs/TEST-REPORT.md
|
||||
|
||||
## Steps
|
||||
- [x] Security review of connector, names, child processes, Metalink and stream parsers, secrets on disk and in logs; fix with one regression test each
|
||||
- [x] Short fuzz tests of the parsers: headers, Content-Disposition, HLS, DASH, Metalink, listing, patterns
|
||||
- [x] Start time, idle CPU, memory with 10,000 tasks, frame cost with 50 active, loopback speed against curl; fix what stands out, record before and after
|
||||
- [x] Soak script with random faults, pauses, kills and limit changes: 20 minutes, once; every file checked
|
||||
- [x] Journeys in one hidden run: first start to finished download; pause, restart, continue; expired link continued; queue with schedule; store of an early commit still opens (engine level and S044 port tests; hidden UI journey not repeated)
|
||||
- [x] docs/FEATURES-CHECK.md: one row per version 1 id with proof and result; Results in `docs/tests` count as proof; small gaps fixed here
|
||||
- [x] `docs/TEST-REPORT.md` line, `docs/PROGRESS.md` entry, tick `Plans/INDEX.md`, commit `S037: …`, push
|
||||
- [ ] Security review of connector, names, child processes, Metalink and stream parsers, secrets on disk and in logs; fix with one regression test each
|
||||
- [ ] Short fuzz tests of the parsers: headers, Content-Disposition, HLS, DASH, Metalink, listing, patterns
|
||||
- [ ] Start time, idle CPU, memory with 10,000 tasks, frame cost with 50 active, loopback speed against curl; fix what stands out, record before and after
|
||||
- [ ] Soak script with random faults, pauses, kills and limit changes: 20 minutes, once; every file checked
|
||||
- [ ] Journeys in one hidden run: first start to finished download; pause, restart, continue; expired link continued; queue with schedule; store of an early commit still opens
|
||||
- [ ] docs/FEATURES-CHECK.md: one row per version 1 id with proof and result; Results in `docs/tests` count as proof; small gaps fixed here
|
||||
- [ ] `docs/TEST-REPORT.md` line, `docs/PROGRESS.md` entry, tick `Plans/INDEX.md`, commit `S037: …`, push
|
||||
|
||||
## End criteria
|
||||
- `nice cargo test -j 2` green, except listed known bugs
|
||||
|
|
|
|||
|
|
@ -12,14 +12,14 @@ Builds that run on older distros without downloads (D-011), a clear repo page an
|
|||
- docs/FEATURES-CHECK.md, docs/CONNECTOR.md
|
||||
|
||||
## Steps
|
||||
- [x] tar.gz with install and uninstall scripts for the user's home, desktop file, icons; AppImage with the appimagetool in ~/Projects/Mulberry/dist (copied to a temp folder), portable-mode support
|
||||
- [x] glibc and library needs listed, lowest supported glibc stated; system libraries not bundled
|
||||
- [x] Smoke test of both builds: launch hidden, download from the test server, status file and shots, looked at; yt-dlp and ffmpeg missing on PATH
|
||||
- [x] README with shots from real runs, install, connector steps, limits and known bugs; no hype
|
||||
- [x] Release notes in docs/releases/0.1.0.md; version set everywhere; checksums made, nothing in releases/ yet
|
||||
- [x] 🧑 Version, contents, known bugs and the size of bundling yt-dlp and ffmpeg told to the user; wait for the yes
|
||||
- [x] After the yes: files to releases/v0.1.0/, notes with hub-release, page checked
|
||||
- [x] docs/STATUS.md, `docs/PROGRESS.md` entry, tick `Plans/INDEX.md`, commit `S039: …`, push
|
||||
- [ ] tar.gz with install and uninstall scripts for the user's home, desktop file, icons; AppImage with the appimagetool in ~/Projects/Mulberry/dist (copied to a temp folder), portable-mode support
|
||||
- [ ] glibc and library needs listed, lowest supported glibc stated; system libraries not bundled
|
||||
- [ ] Smoke test of both builds: launch hidden, download from the test server, status file and shots, looked at; yt-dlp and ffmpeg missing on PATH
|
||||
- [ ] README with shots from real runs, install, connector steps, limits and known bugs; no hype
|
||||
- [ ] Release notes in docs/releases/0.1.0.md; version set everywhere; checksums made, nothing in releases/ yet
|
||||
- [ ] 🧑 Version, contents, known bugs and the size of bundling yt-dlp and ffmpeg told to the user; wait for the yes
|
||||
- [ ] After the yes: files to releases/v0.1.0/, notes with hub-release, page checked
|
||||
- [ ] docs/STATUS.md, `docs/PROGRESS.md` entry, tick `Plans/INDEX.md`, commit `S039: …`, push
|
||||
|
||||
## End criteria
|
||||
- both builds pass the smoke test
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ Run the checks of the test files of S017, S021, S022, S023, S024, fix what fails
|
|||
- CLAUDE.md §4 and §5
|
||||
|
||||
## Steps
|
||||
- [x] Build everything, run the existing suite once with a log file, start the app hidden; fix what is broken before anything else
|
||||
- [x] Doubts first: read the code behind each, add a check or write why it is fine
|
||||
- [x] Write the tests for all HIGH and MED checks in one go, sharing fixtures and the testserver
|
||||
- [x] Run them once, all together, log to a file; read only the failures
|
||||
- [x] Fix all causes in one go; rerun only what failed; three rounds at most, then `KNOWN BUG` with the cause
|
||||
- [x] Screen checks: one contact sheet, faults fixed in one go, one more sheet (partly: no scenes exist for details, queues, week, countdown or handoff; only set-browser and add-continue sheets were seen)
|
||||
- [x] Results filled in, `docs/TEST-REPORT.md` line, `docs/PROGRESS.md` entry, tick `Plans/INDEX.md`, commit `S041: …`, push
|
||||
- [ ] Build everything, run the existing suite once with a log file, start the app hidden; fix what is broken before anything else
|
||||
- [ ] Doubts first: read the code behind each, add a check or write why it is fine
|
||||
- [ ] Write the tests for all HIGH and MED checks in one go, sharing fixtures and the testserver
|
||||
- [ ] Run them once, all together, log to a file; read only the failures
|
||||
- [ ] Fix all causes in one go; rerun only what failed; three rounds at most, then `KNOWN BUG` with the cause
|
||||
- [ ] Screen checks: one contact sheet, faults fixed in one go, one more sheet
|
||||
- [ ] Results filled in, `docs/TEST-REPORT.md` line, `docs/PROGRESS.md` entry, tick `Plans/INDEX.md`, commit `S041: …`, push
|
||||
|
||||
## End criteria
|
||||
- the tests written here pass, except listed known bugs
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@ Run the checks of the test files of S025, S027, S033, S034, fix what fails, fill
|
|||
- CLAUDE.md §4 and §5
|
||||
|
||||
## Steps
|
||||
- [x] Doubts first: read the code behind each, add a check or write why it is fine
|
||||
- [x] Write the tests for all HIGH and MED checks in one go, sharing fixtures and the testserver
|
||||
- [x] Run them once, all together, log to a file; read only the failures
|
||||
- [x] Fix all causes in one go; rerun only what failed; three rounds at most, then `KNOWN BUG` with the cause
|
||||
- [x] Screen checks: one contact sheet, faults fixed in one go, one more sheet
|
||||
- [x] Results filled in, `docs/TEST-REPORT.md` line, `docs/PROGRESS.md` entry, tick `Plans/INDEX.md`, commit `S043: …`, push
|
||||
- [ ] Doubts first: read the code behind each, add a check or write why it is fine
|
||||
- [ ] Write the tests for all HIGH and MED checks in one go, sharing fixtures and the testserver
|
||||
- [ ] Run them once, all together, log to a file; read only the failures
|
||||
- [ ] Fix all causes in one go; rerun only what failed; three rounds at most, then `KNOWN BUG` with the cause
|
||||
- [ ] Screen checks: one contact sheet, faults fixed in one go, one more sheet
|
||||
- [ ] Results filled in, `docs/TEST-REPORT.md` line, `docs/PROGRESS.md` entry, tick `Plans/INDEX.md`, commit `S043: …`, push
|
||||
|
||||
## End criteria
|
||||
- the tests written here pass, except listed known bugs
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
# S044 — Close the open HIGH checks and wire the video page
|
||||
|
||||
> Category 09 Test and release · Model: Opus (gate fix: open HIGH checks) · Effort: medium · Depends on: S037 · Phase: test · Human: no
|
||||
> Files touched: crates/**, docs/tests/**, docs/TEST-REPORT.md, docs/FEATURES-CHECK.md
|
||||
|
||||
## Goal
|
||||
The package gate (S039) needs no open HIGH check. After S037 these HIGH checks are still not run or failing; give each a harness (unit, integration or kittest, hidden run only where nothing else works), run it, fix what fails. Also make the video feature (FEATURES 6.1) usable from the app.
|
||||
|
||||
## Read
|
||||
- docs/TEST-REPORT.md (S037 line), docs/tests/S037-whole-app.md
|
||||
- the rows below in their test files; code only where a check needs it
|
||||
- CLAUDE.md §4 and §5
|
||||
|
||||
## Steps
|
||||
- [x] S017 5, 6, 7, 8, 15, 16 (details panel: removed task, error box, checksum, file gone, hidden headers, checksum field): kittest or integration
|
||||
- [x] S021 19 (fake `Power` records the Fire(Shutdown) call; Logind never used)
|
||||
- [x] S024 3, 8, 9, 10, 15 (handoff: medlar: link shows dialog, Continue offered, expired link continued or refused, hash identical) against testserver; S024 14 with Nacre's body replayed by curl if running Nacre hidden fails
|
||||
- [x] S027 8 and 9 / S037 16 (clipboard Ask): find the cause of no Add window; fix, or prove it is the nested session's clipboard with a test of the watcher logic and mark it KNOWN BUG LOW with the proof
|
||||
- [x] Video: show `video::Page` in the Add dialog for video links and run yt-dlp tasks through the manager (pause, resume, error kinds); stub yt-dlp tests; S025 16
|
||||
- [x] S037 open boxes: frame cost with 50 active, journeys pause/restart/continue, expired link, queue with schedule, old store; record results
|
||||
- [x] Full workspace suite once at the end (absolute TMPDIR); fix failures
|
||||
- [x] Results filled in, `docs/TEST-REPORT.md` line, `docs/PROGRESS.md` entry, tick S037 boxes now done and its INDEX line, tick this plan's INDEX line, commit `S044: …`, push
|
||||
|
||||
## End criteria
|
||||
- no HIGH row in docs/tests left as "not run" or failing, except a KNOWN BUG with proof that it is outside the app
|
||||
- workspace suite green
|
||||
|
||||
## Pitfalls
|
||||
Never weaken a test to pass. Fake D-Bus and logind only, testserver on loopback only, throwaway homes only, never download real video. Absolute `TMPDIR`. Release build and tests never at once.
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
# S045 — installer.sh and Arch package
|
||||
|
||||
> Category 10 Distribution · Model: Sonnet · Effort: medium · Depends on: S039 · Phase: test · Human: no
|
||||
> Files touched: installer.sh, packaging/arch/**, tools/package.sh, README.md, docs/tests/S045-installer-arch.md
|
||||
|
||||
## Goal
|
||||
The user asked for an installer script and an Arch package for 0.1.0. Debian and Fedora packages wait for a build on an older host (the binary needs glibc 2.44); not in this plan.
|
||||
|
||||
## Read
|
||||
- tools/package.sh, the tar.gz's install.sh and uninstall.sh, assets/medlar.desktop, assets/medlar.metainfo.xml, README install section
|
||||
- the user's global release rules (CLAUDE.md is loaded): file names `<App>-<version>-<platform>.<ext>`, no scripts or .md in releases/
|
||||
|
||||
## Steps
|
||||
- [x] `installer.sh` at the repo root (POSIX sh, shellcheck-clean if shellcheck is present): installs from a given tar.gz or AppImage, or from one found next to it; `--user` (default, ~/.local) or `--system` (/usr/local, sudo only for the copy); desktop file, icons, metainfo, `medlar:` scheme handler; `--uninstall` (and `--purge` for data); refuses when glibc is older than 2.44 with a plain message; verifies SHA256SUMS when present. Optional `--url` download is allowed but the repo is private, so the default path is a local file
|
||||
- [x] `packaging/arch/PKGBUILD` (+ `.SRCINFO`): `medlar-bin` from the release tar.gz with sha256sums, depends listed from the binary's needs (glibc, libxkbcommon, wayland, etc.), optdepends yt-dlp and ffmpeg, desktop file, icons, metainfo, license
|
||||
- [x] Build the package with `makepkg` from the local tar.gz (no network: point `source` at the file in dist/ for the build); `namcap` if present; inspect contents with `bsdtar -tf`
|
||||
- [x] Test, with throwaway roots only: installer.sh `--user` into a temp HOME, `--system` with `DESTDIR`/prefix into a temp dir, uninstall leaves nothing; package contents and file list checked; do NOT `pacman -U` on the real system
|
||||
- [x] `tools/package.sh` also makes the Arch package as `dist/Medlar-0.1.0-arch-x86_64.pkg.tar.zst` and adds it to `dist/SHA256SUMS-0.1.0`; nothing into releases/ (the orchestrator adds it)
|
||||
- [x] README: install sections for installer.sh and Arch; test file `docs/tests/S045-installer-arch.md` with Results; PROGRESS entry, tick INDEX, commit `S045: …`, `git push origin HEAD`
|
||||
|
||||
## End criteria
|
||||
- installer installs and uninstalls cleanly in a throwaway home and prefix
|
||||
- the Arch package builds offline and lists the right files
|
||||
|
||||
## Pitfalls
|
||||
Never touch the real ~/.local, /usr or pacman database. No downloads (D-011). Never put scripts in releases/.
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
# S046 — 0.1.1: names from the server, raise on arrival, copy in fields
|
||||
|
||||
> Category 10 Distribution · Model: Sonnet · Effort: medium · Depends on: S045 · Phase: test · Human: 🧑 yes before release
|
||||
> Files touched: crates/core/src/http/name.rs and its callers, crates/core/src/connector/**, crates/app/src/views/{incoming,add}/**, crates/app/src/keys.rs, crates/app/src/app.rs, version files, docs/releases/0.1.1.md, docs/tests/S046-fixes-0.1.1.md
|
||||
|
||||
## Goal
|
||||
Three bugs the user found with 0.1.0 (Nacre on a real site):
|
||||
1. **Name**: the browser hands over a provisional name (`output.bin`) at click time; the real name (archive) only comes with the server's reply (Content-Disposition, or the final link after redirects). Medlar keeps the sender's name, so the file stays `output.bin`.
|
||||
2. **No raise**: a pushed download does not bring Medlar forward. `incoming.rs` sends `ViewportCommand::Focus` only, which Wayland (niri) ignores without an activation token, and does nothing when the window is hidden to the tray.
|
||||
3. **Copy in fields**: in Settings (and every text field) Ctrl+C does not copy: `keys::pressed` lets the list's Copy shortcut (Ctrl+C) and Select all (Ctrl+A) eat the events while a text field has focus (`taken()` covers V, X, Z only).
|
||||
|
||||
## Read
|
||||
- crates/core/src/http/name.rs (`pick`), where a task's name is set from a sender or the Add dialog and where the first reply is handled (rg `pick(`)
|
||||
- crates/app/src/views/incoming.rs (`tick`, `ask`), app.rs lines ~255-330 (show/hide), crates/app/src/keys.rs (`pressed`, `taken`, `fits`)
|
||||
- docs/CONNECTOR.md (`filename` field)
|
||||
|
||||
## Steps
|
||||
- [x] Name: a name from a sender (connector `filename`, or the Add dialog when the user did not type it) is a hint. On the first reply, when the hint is generic (no extension, or an extension like bin, php, asp, aspx, cgi, html, htm, download, or a known placeholder such as `output.bin`, `download`, `file`) and the reply gives a name (Content-Disposition, else the final link with a file extension), use the reply's name, made safe as today, before any file is created; a name the user typed always wins; collisions handled as today (never overwrite). The Add dialog's probe updates the shown name the same way while the user has not edited it. Unit tests in name.rs and an engine test against testserver (provisional name + Content-Disposition, and a redirect to a named link)
|
||||
- [x] Raise: on an arrival that shows the Add window or adds a download, if the main window is hidden show it (`Visible(true)`, `Minimized(false)`), then `Focus` and `RequestUserAttention(Critical)` (urgency where focus is refused); same for second-instance hand-over; clear the attention when the window gets focus. A kittest that records the viewport commands
|
||||
- [x] Copy: while a text field has focus, Ctrl+C, Ctrl+A (and Ctrl+X, Ctrl+V, Ctrl+Z as now) go to the field, not to list shortcuts; settings values that are read-only text (paths, versions, the port, the token) are selectable or have a copy button where egui allows. Unit test for `pressed` with a focused field
|
||||
- [x] Full workspace suite once (absolute TMPDIR), then release build; hidden smoke test: POST a link with `filename: output.bin` to a testserver URL that answers with Content-Disposition `game.zip`: Add window shows and the file is `game.zip`; window raised in the grab
|
||||
- [x] Version 0.1.1 everywhere (Cargo, metainfo, PKGBUILD, .SRCINFO); `tools/package.sh` builds tar.gz, AppImage, Arch package and `SHA256SUMS-0.1.1` in dist/; `docs/releases/0.1.1.md`; nothing into releases/
|
||||
- [x] Test file `docs/tests/S046-fixes-0.1.1.md` with Results, PROGRESS entry, tick INDEX, commit `S046: …`, `git push origin HEAD`
|
||||
|
||||
## End criteria
|
||||
- the three bugs have passing regression tests; suite green; builds smoke-tested
|
||||
|
||||
## Pitfalls
|
||||
File names from servers are hostile: same `safe` rules as today. Never rename over an existing file. Never contact the real site; testserver on loopback only. Release only after the user's yes.
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
# S047 — Close to tray that works on Wayland
|
||||
|
||||
> Category 10 Distribution · Model: Opus (ownership refactor of the app's lifetime) · Effort: medium · Depends on: S046 · Phase: test · Human: 🧑 yes before release
|
||||
> Files touched: crates/app/src/{main,lib,app,shell,tray,instance}.rs, crates/app/src/views/incoming.rs, docs/tests/S047-close-to-tray.md, docs/releases/0.1.1.md
|
||||
|
||||
## Goal
|
||||
The user closes the window with niri's close (Win+Q) and nothing happens. Cause (`app.rs` `shell()`): on close Medlar sends `CancelClose` then `Visible(false)`, but winit cannot hide a window on Wayland, so the window just stays. Without a tray host the close works; with one it is swallowed.
|
||||
|
||||
Wanted: closing hides Medlar to the tray (downloads, port, tray keep going) when the tray is on and a host exists; otherwise it quits cleanly. Show from the tray, a second start, or a browser hand-off brings a window back.
|
||||
|
||||
## Approach (check against eframe 0.37 docs before coding)
|
||||
eframe with `NativeOptions::run_and_return = true` returns from `run_native` when the window closes and reuses its thread-local event loop on the next `run_native` call (winit `run_app_on_demand`). So:
|
||||
- Move what must outlive a window out of `App` into a `Core`/`Session` owned by `main`: engine/manager bridge, connector `Inbox` source, tray/shell, notifications, launcher, instance socket, settings store. The `App` borrows or holds an `Arc` to it.
|
||||
- On close with tray: let the close happen (no `CancelClose`); `run_native` returns; `main` waits on the tray/instance/connector for "show" (or "quit"), then calls `run_native` again with the same session. Window size and position come back from `window.ron`.
|
||||
- Without a tray host, or tray off: close quits as today (pause and save, then exit).
|
||||
- X11: same path (no special `Visible(false)` case left), so one behaviour everywhere.
|
||||
- `--minimised` at start: start without a window when a tray host exists (wait for "show"), else open normally.
|
||||
- Arrivals while hidden (S046 raise): reopen the window, then the Add dialog.
|
||||
If `run_and_return` cannot reopen on this eframe/winit, stop and report with the error; do not build a second process design without asking.
|
||||
|
||||
## Steps
|
||||
- [x] Read eframe 0.37 `run_and_return` / `run_native` docs and source in ~/.cargo/registry; confirm reopen works with a 20-line spike in a test or example
|
||||
- [x] Session refactor: long-lived parts out of `App`; nothing else changes behaviour
|
||||
- [x] Close/show/quit loop in `main` as above; tray Show and Quit, second instance, connector arrival, `--minimised`
|
||||
- [x] Tests: unit for the decide-on-close logic (tray on/off, host yes/no); hidden nested niri run with a fake StatusNotifierWatcher (bus.rs from S043) on a spare port and throwaway home: send close (niri msg action close-window), process stays, downloads keep going (testserver, throttled), port answers; tray Show reopens; POST to the port reopens with the Add window; Quit ends with tasks saved; without the fake tray, close quits
|
||||
- [x] Full workspace suite once, release build, smoke as S046; add to docs/releases/0.1.1.md; rebuild packages via tools/package.sh (0.1.1), nothing into releases/
|
||||
- [x] Test file with Results, PROGRESS, tick INDEX, commit `S047: …`, push
|
||||
|
||||
## Pitfalls
|
||||
The user's Medlar 0.1.0 is running on 17616: never stop it; spare port, throwaway home. Never weaken a test. Idle (hidden) draws no frames and uses ~0 CPU.
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
# S048 — Servers behind a load balancer with different validators
|
||||
|
||||
> Category 10 Distribution · Model: Opus (engine correctness, never mix two files) · Effort: medium · Depends on: S046 · Phase: test · Human: 🧑 yes before release
|
||||
> Files touched: crates/core/src/http/{mod,fetch,download,parts}.rs, crates/testserver/**, crates/core/tests/**, docs/tests/S048-server-farms.md, docs/releases/0.1.1.md
|
||||
|
||||
## Goal
|
||||
Downloads from romsgames.net (and any site with a server farm) fail at once with "File changed on the server". Seen on 2026-11-26 with four 1-byte range requests to the same link (`static.romsgames.net/.../output.bin?token`):
|
||||
|
||||
| range | Server | Last-Modified | ETag | Content-Range total |
|
||||
|---|---|---|---|---|
|
||||
| 0-0 | nginx/1.22.0 | Mon, 21 Jul 2025 20:20:29 | W/"bd6dcd82-1982ea51dc7" | 3178089858 |
|
||||
| 1000000-1000000 | nginx/1.24.0 (Ubuntu) | Sun, 05 Jan 2020 05:35:27 | W/"bd6dcd82-16f743377f5" | 3178089858 |
|
||||
| 0-0 | nginx/1.24.0 (Ubuntu) | Mon, 21 Jul 2025 20:20:29 | W/"bd6dcd82-1982ea51dc7" | 3178089858 |
|
||||
| 2000000000-… | nginx/1.24.0 (Ubuntu) | Mon, 21 Jul 2025 20:20:29 | W/"bd6dcd82-1982ea51dc7" | 3178089858 |
|
||||
|
||||
All 206, same size, same type; nodes differ only in mtime (nginx ETag = `"<size hex>-<mtime hex>"`). `Validators::same_file` (http/mod.rs) and `send_range` (fetch.rs ~159) call that `Changed`. The user's task 8 failed after 32 KB.
|
||||
|
||||
## Rule (never mix two files)
|
||||
When a reply's validators differ from the known ones but the total size is equal: do not fail. Check bytes instead: compare a sample of bytes already on disk with the same range from this reply (the existing `same_bytes` path in fetch.rs ~205; make the sample big enough, e.g. 64 KiB or what is there) before writing. Bytes equal → mark the task's link as a *farm* (validators unreliable): from then on compare size + byte samples only, send no `If-Range` (a Last-Modified `If-Range` makes other nodes answer 200 full), keep the first validators for display. Bytes differ, or size differs → `Changed` as today. A 200 to a range on a farm is `RangeIgnored`, not `Changed`. Also nginx-style ETags that differ only after the size part count as "maybe the same file" (still checked by bytes).
|
||||
|
||||
## Steps
|
||||
- [x] testserver: a farm mode (several "nodes" with the same bytes but different Last-Modified/ETag picked per request, nginx-style weak ETags), and a liar mode (same size, different bytes) — docs in the lib.rs header
|
||||
- [x] Engine: the rule above, in probe, parts and resume; the farm flag stored with the task (store migration) so a restart keeps it; parts on a farm still run in parallel
|
||||
- [x] Tests: farm download with 4 parts completes with the right hash; pause/restart/resume on a farm; liar same-size-different-bytes still fails with Changed and keeps what is there; If-Range not sent on a farm; unit tests for the ETag comparison
|
||||
- [x] Full workspace suite once (absolute TMPDIR), release build, hidden smoke against testserver farm on a spare port (the user's Medlar 0.1.1 runs on 17616: never stop it)
|
||||
- [x] `tools/package.sh` (0.1.1, rebuilds dist/), copy the four files to `~/Projects/Medlar/dist/` as well; notes in docs/releases/0.1.1.md
|
||||
- [x] Test file with Results, PROGRESS, tick INDEX, commit `S048: …`, `git push origin HEAD`
|
||||
|
||||
## Pitfalls
|
||||
Never contact romsgames.net or any real site in tests; testserver only. Never weaken the "two files are never mixed" guarantee.
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
# S049 — Take focus on niri when a download arrives
|
||||
|
||||
> Category 10 Distribution · Model: Sonnet · Effort: medium · Depends on: S046, S047 · Phase: test · Human: no
|
||||
> Files touched: crates/app/src/views/incoming.rs, crates/app/src/{desktop,shell}.rs or a new `niri.rs`, docs/tests/S049-niri-focus.md
|
||||
|
||||
## Goal
|
||||
On niri, `Focus` and `RequestUserAttention` from an app only mark the window urgent (no activation token from a user input), so a download pushed from the browser does not bring Medlar forward. niri has no per-app "allow activation" window rule (the user's `~/.config/niri/caelestia-windowrules.kdl` now has a Medlar rule with `open-focused true`, which only helps for new windows). The global `debug { honor-xdg-activation-with-invalid-serial }` would let every app steal focus: not wanted.
|
||||
|
||||
## Steps
|
||||
- [x] When `NIRI_SOCKET` is set and an arrival raises the window (S046 path), ask niri over its IPC socket (JSON, `{"Action":{"FocusWindow":{"id":N}}}`; window id from `"Windows"` matched by our PID and app id `medlar`) to focus our window; no shell, no `niri` binary needed; on any error fall back to today's urgency. A setting "Bring Medlar forward when a download arrives" (default on) in Behaviour
|
||||
- [x] Unit test with a fake socket that records the request; hidden nested niri run: POST a link, focused window id equals Medlar's (spare port, throwaway home)
|
||||
- [x] Results, PROGRESS, INDEX, commit `S049: …`, push
|
||||
|
||||
## Pitfalls
|
||||
Read the IPC format of niri 26.04 from its docs or `niri msg --json` output before coding. Never touch the user's niri config.
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
# S050 — Bug hunt, known items first
|
||||
|
||||
> Category 10 Distribution · Model: Sonnet · Effort: medium · Depends on: S049 · Phase: test · Human: no
|
||||
> Files touched: crates/**, docs/tests/S050-bug-hunt.md
|
||||
|
||||
## Goal
|
||||
Fix the bugs already found, smallest and most visible first; commit after each so a cut-off loses nothing. Weekly usage is nearly gone: stop cleanly when told.
|
||||
|
||||
## Steps
|
||||
- [ ] Snail button covers the last row's pause icon at 480x360: the list needs bottom padding equal to the button plus its margin (shots scene at 480x360 to check)
|
||||
- [ ] Idle CPU 11 % with the Add dialog open, and 160 % right after a download ends: find what keeps repainting (motion running without change, a spinner, a timer) and stop it; idle must draw no frames
|
||||
- [ ] Tray tooltip speed uses the same smoothed, held value as the big number
|
||||
- [ ] `control::connector_flood_15` fails (40 ok, 0 busy): read the busy limit in the connector, fix the cause or the test if the test is wrong (never weaken a real guard)
|
||||
- [ ] Each fix gets a test where feasible; one full suite run at the end; Results in `docs/tests/S050-bug-hunt.md`, PROGRESS, INDEX, commit `S050: …`, push
|
||||
|
||||
## Pitfalls
|
||||
Spare port and throwaway home; absolute TMPDIR under target/tmp. No packages, no releases.
|
||||
|
|
@ -57,20 +57,10 @@ Tracker: https://claude.ai/artifact/XouimfVJS6FYVKskGJ8s7H
|
|||
|
||||
## 09 Test and release
|
||||
|
||||
- [x] [S041](09%20Test%20and%20release/S041-test-control-connector.md) It runs; tests of details, control and connector
|
||||
- [x] [S043](09%20Test%20and%20release/S043-test-video-screens.md) Tests of video, rules, tray and every screen
|
||||
- [x] [S037](09%20Test%20and%20release/S037-whole-app.md) Whole app: use, security, speed, every feature
|
||||
- [x] [S044](09%20Test%20and%20release/S044-fix-open-high.md) Close the open HIGH checks and wire the video page
|
||||
- [x] [S039](09%20Test%20and%20release/S039-package-release.md) Package, docs and release 🧑
|
||||
|
||||
## 10 Distribution
|
||||
|
||||
- [x] [S045](10%20Distribution/S045-installer-arch.md) installer.sh and Arch package
|
||||
- [x] [S046](10%20Distribution/S046-fixes-0.1.1.md) 0.1.1: names from the server, raise on arrival, copy in fields
|
||||
- [x] [S047](10%20Distribution/S047-close-to-tray-wayland.md) Close to tray that works on Wayland
|
||||
- [x] [S048](10%20Distribution/S048-server-farms.md) Servers behind a load balancer with different validators
|
||||
- [x] [S049](10%20Distribution/S049-niri-focus.md) Take focus on niri when a download arrives
|
||||
- [ ] [S050](10%20Distribution/S050-bug-hunt.md) Bug hunt, known items first
|
||||
- [ ] [S041](09%20Test%20and%20release/S041-test-control-connector.md) It runs; tests of details, control and connector
|
||||
- [ ] [S043](09%20Test%20and%20release/S043-test-video-screens.md) Tests of video, rules, tray and every screen
|
||||
- [ ] [S037](09%20Test%20and%20release/S037-whole-app.md) Whole app: use, security, speed, every feature
|
||||
- [ ] [S039](09%20Test%20and%20release/S039-package-release.md) Package, docs and release 🧑
|
||||
|
||||
## Later (after version 1; not run by /orchestrate)
|
||||
|
||||
|
|
|
|||
81
README.md
81
README.md
|
|
@ -1,81 +0,0 @@
|
|||
# Medlar
|
||||
|
||||
A download manager for Linux, written in Rust with egui. Downloads are split into dynamic parts and can be paused, resumed
|
||||
and continued from a new link. The interface follows Material You (M3 Expressive). Version 0.1.1 fixes names, copy and speed, and adds a snail button.
|
||||
|
||||

|
||||

|
||||
|
||||
Both pictures come from a real run of the release build in a hidden session (software rendering).
|
||||
|
||||
## What it does
|
||||
|
||||
- HTTP and HTTPS in up to 16 dynamic parts, resume after a crash or restart, error recovery, mirrors, checksums.
|
||||
- FTP, FTPS and SFTP; HLS and DASH streams; Metalink.
|
||||
- Speed limits (global and per download), priorities, queues, a schedule and "when done" actions.
|
||||
- A local port, `127.0.0.1:17616`, that takes links from browsers (Nacre's JSON). See [docs/CONNECTOR.md](docs/CONNECTOR.md).
|
||||
- Video sites through `yt-dlp` (with `ffmpeg`), if both are installed.
|
||||
- Clipboard watcher, rules, tags and notes, tray icon, one running copy only.
|
||||
|
||||
The full list and its state: [docs/FEATURES.md](docs/FEATURES.md) and [docs/FEATURES-CHECK.md](docs/FEATURES-CHECK.md).
|
||||
|
||||
## Install
|
||||
|
||||
Needs a Linux x86_64 desktop with Wayland or X11, and glibc 2.44 or newer (see "Requirements").
|
||||
|
||||
**AppImage:** `chmod +x Medlar-0.1.1-x86_64.AppImage && ./Medlar-0.1.1-x86_64.AppImage`
|
||||
|
||||
**tar.gz:** `tar xzf Medlar-0.1.1-Linux-x86_64.tar.gz && cd medlar-0.1.1 && ./install.sh`
|
||||
installs into `~/.local` (binary, desktop file, icon; no root). `./uninstall.sh` removes it; `./uninstall.sh --purge` also
|
||||
removes settings and the download list (downloaded files stay).
|
||||
|
||||
**installer.sh:** `./installer.sh Medlar-0.1.1-Linux-x86_64.tar.gz` (or with no file: it uses a tar.gz or AppImage beside it).
|
||||
`--user` (default, `~/.local`) or `--system` (`/usr/local`, sudo only for the copy); `--prefix DIR` picks another folder.
|
||||
Checks `SHA256SUMS-*` beside the file and refuses glibc older than 2.44. Sets the `medlar:` link handler (user install).
|
||||
`./installer.sh --uninstall [--purge]` removes it again (`--system` for a system install).
|
||||
|
||||
**Arch Linux:** `sudo pacman -U Medlar-0.1.1-arch-x86_64.pkg.tar.zst` (package `medlar-bin`). To build it yourself:
|
||||
`cd packaging/arch && makepkg -si` (downloads the tar.gz) or `MEDLAR_TARBALL=file:///path/to/Medlar-0.1.1-Linux-x86_64.tar.gz makepkg -si`.
|
||||
|
||||
Check the download against `SHA256SUMS-0.1.1`: `sha256sum -c SHA256SUMS-0.1.1`.
|
||||
|
||||
**Portable mode:** put a file called `portable` beside `bin/medlar` (tar.gz) or beside the `.AppImage`. Everything is then
|
||||
kept in a `medlar-data/` folder next to it. `MEDLAR_HOME=<dir>` sets the folder directly and wins over both.
|
||||
|
||||
## Requirements
|
||||
|
||||
- The binary links only `libc`, `libm` and `libgcc_s` (glibc). Nothing from the system is bundled.
|
||||
- It was built on Arch Linux with glibc 2.44, and it uses math functions that glibc added in 2.43 and 2.44. **Lowest
|
||||
supported glibc: 2.44.** It will not start on older distributions. A build for older systems needs an older build host.
|
||||
It was not tested on any other system.
|
||||
- Wayland or X11 and a GPU driver (OpenGL) or software rendering.
|
||||
- Optional: `yt-dlp` and `ffmpeg` on `PATH` for video sites. Medlar does not bundle them (that would add tens of MB and
|
||||
they go out of date quickly). Without them, everything else works and video links give a plain message.
|
||||
|
||||
## Browser steps
|
||||
|
||||
1. Start Medlar once and finish or skip the first-run pages. The port is `127.0.0.1:17616` (Settings, Browser).
|
||||
2. In Nacre (or any program that can POST JSON), set the download-manager address to `http://127.0.0.1:17616/`.
|
||||
3. Send a link. Medlar shows the Add dialog unless you turned that off.
|
||||
4. Test by hand: `curl -s -H 'Content-Type: application/json' -d '{"url":"https://example.com/a.zip"}' http://127.0.0.1:17616/`
|
||||
|
||||
Requests with a web `Origin` or a foreign `Host` are refused, and no CORS headers are sent.
|
||||
|
||||
## Limits and known gaps
|
||||
|
||||
Honest state of 0.1.1. The engine is tested hard (unit, integration, fuzz, a 20-minute fault soak with 606 files and no
|
||||
corrupt one). The interface is tested less.
|
||||
|
||||
- The hidden-window user journeys (pause, restart, expired link, schedule) were tested at engine level only, not by
|
||||
clicking through the window.
|
||||
- Many screen and motion checks were not run (the details panel, motion audit, drag and drop in the window).
|
||||
- Video: `yt-dlp` was tested against a stub, not against a real site. Browser cookies and the global speed limit are
|
||||
not passed to `yt-dlp`.
|
||||
- The Control sheet is clipped at 480x360 (no scroll).
|
||||
- The "when done" power call was not run against a fake logind.
|
||||
- Not built or tested for other CPUs or other libc. No Windows or macOS version.
|
||||
|
||||
## Build from source
|
||||
|
||||
`cargo build --release -p medlar` (Rust 1.99, edition 2024). `tools/package.sh` makes the tar.gz, the AppImage and the
|
||||
checksums in `dist/`. Tests: `cargo test --workspace -j 2`. Licence: MIT. Font: Rubik (OFL, `assets/Rubik-OFL.txt`).
|
||||
|
|
@ -21,7 +21,7 @@ serde.workspace = true
|
|||
serde_json.workspace = true
|
||||
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
|
||||
dirs = "6"
|
||||
eframe = { version = "0.37", default-features = false, features = ["clipboard", "glow", "wayland", "x11", "default_fonts", "system_fonts", "persistence"] }
|
||||
eframe = { version = "0.37", default-features = false, features = ["glow", "wayland", "x11", "default_fonts", "system_fonts", "persistence"] }
|
||||
tokio = { version = "1", features = ["macros", "rt", "sync"] }
|
||||
percent-encoding = "2.3.2"
|
||||
url = "2"
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ use medlar_core::{logging, tr};
|
|||
use std::io;
|
||||
use std::process::ExitCode;
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::{Receiver, RecvTimeoutError, sync_channel};
|
||||
use crate::shell::Do;
|
||||
use std::thread::JoinHandle;
|
||||
|
||||
/// Also the name of the desktop file, and what Wayland compositors match rules against.
|
||||
|
|
@ -71,7 +69,6 @@ impl App {
|
|||
let theme = Theme::build(&settings, desktop);
|
||||
theme.apply(ctx, settings.motion);
|
||||
keys::set(&settings);
|
||||
crate::ui::wave::set_one_bar(settings.bar == medlar_core::settings::BarStyle::One);
|
||||
let watch = Watch::start(sources.clone(), ctx);
|
||||
App {
|
||||
themed: settings.clone(),
|
||||
|
|
@ -113,7 +110,6 @@ impl App {
|
|||
let now = ctx.input(|i| i.time);
|
||||
if self.applied != self.settings {
|
||||
keys::set(&self.settings);
|
||||
crate::ui::wave::set_one_bar(self.settings.bar == medlar_core::settings::BarStyle::One);
|
||||
self.main.bridge.apply(&self.settings);
|
||||
if let Some(paths) = self.paths.as_ref().filter(|_| self.applied.language != self.settings.language) {
|
||||
strings::set(Catalogue::load(&paths.languages(), &self.settings.language).0);
|
||||
|
|
@ -207,12 +203,6 @@ impl App {
|
|||
}
|
||||
None => {
|
||||
self.main.show(ui, &t, &self.settings);
|
||||
let window = ui.ctx().content_rect();
|
||||
let at = egui::pos2(window.right() - crate::tokens::space::L, window.bottom() - self.main.floor() - crate::tokens::space::L);
|
||||
let on = self.settings.mode == medlar_core::settings::Mode::Snail;
|
||||
if crate::ui::snail::button(ui.ctx(), &t, at, on, &keys::label(Action::Snail)) {
|
||||
self.run(ui, Action::Snail);
|
||||
}
|
||||
if let Some(change) = self.main.change.take() {
|
||||
change.apply(&mut self.settings);
|
||||
}
|
||||
|
|
@ -262,99 +252,50 @@ impl App {
|
|||
|
||||
/// What the tray and the notifications ask for, and what they are told.
|
||||
fn shell(&mut self, ui: &Ui) {
|
||||
let Some(shell) = &mut self.shell else { return };
|
||||
let ctx = ui.ctx();
|
||||
for what in self.shell_tick() {
|
||||
match self.act(what) {
|
||||
Some(Do::Show) => {
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Visible(true));
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Minimized(false));
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Focus);
|
||||
}
|
||||
Some(Do::Quit) => self.quit(ctx),
|
||||
_ => {}
|
||||
}
|
||||
motion::keep_alive();
|
||||
if ctx.input(|i| i.viewport().close_requested()) && shell.hides_on_close(&self.settings) {
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::CancelClose);
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Visible(false));
|
||||
}
|
||||
}
|
||||
|
||||
/// Tells the tray, the notifications and the launcher what changed; what they asked for comes back.
|
||||
fn shell_tick(&mut self) -> Vec<Do> {
|
||||
let Some(shell) = &mut self.shell else { return vec![] };
|
||||
let shot = match self.main.bridge.data() {
|
||||
Data::Ready(shot, _) => Some(shot),
|
||||
_ => None,
|
||||
};
|
||||
shell.tick(&self.settings, shot.as_deref())
|
||||
}
|
||||
|
||||
/// Does what needs no window. What needs one comes back as `Show`, and `Quit` comes back as it is.
|
||||
fn act(&mut self, what: Do) -> Option<Do> {
|
||||
match what {
|
||||
Do::Show | Do::Quit => return Some(what),
|
||||
Do::Add => {
|
||||
self.main.adding.ask(crate::views::add::Request::default());
|
||||
return Some(Do::Show);
|
||||
}
|
||||
Do::SignIn(url, id) => {
|
||||
self.main.wish = Some(Wish::SignIn(url, vec![id]));
|
||||
return Some(Do::Show);
|
||||
}
|
||||
Do::PauseAll => self.main.all(false),
|
||||
Do::ResumeAll => self.main.all(true),
|
||||
Do::Mode(m) => crate::views::modes::Change::Mode(m).apply(&mut self.settings),
|
||||
Do::Open(file) => {
|
||||
open_outside(&file.to_string_lossy());
|
||||
}
|
||||
Do::Folder(file) => {
|
||||
crate::views::main::reveal_outside(&file);
|
||||
}
|
||||
Do::Retry(id) => self.main.bridge.send(medlar_core::manager::Command::Resume(id)),
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Closes for real, even with close to tray on.
|
||||
fn quit(&mut self, ctx: &Context) {
|
||||
if let Some(shell) = &mut self.shell {
|
||||
shell.quitting = true;
|
||||
}
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Close);
|
||||
}
|
||||
|
||||
/// Whether the window that just closed leaves Medlar in the tray.
|
||||
fn hides(&self) -> bool {
|
||||
self.first.is_none() && self.shell.as_ref().is_some_and(|s| s.hides_on_close(&self.settings))
|
||||
}
|
||||
|
||||
/// Runs without a window until one is wanted (true) or Quit is chosen (false). The engine, the port, the tray and
|
||||
/// the notifications keep going; `wake` hears every repaint request, so nothing is polled while nothing happens.
|
||||
fn hidden(&mut self, ctx: &Context, wake: &Receiver<()>) -> bool {
|
||||
crate::views::incoming::take_raised();
|
||||
loop {
|
||||
for what in self.shell_tick() {
|
||||
match self.act(what) {
|
||||
Some(Do::Show) => return true,
|
||||
Some(Do::Quit) => return false,
|
||||
_ => {}
|
||||
use crate::shell::Do;
|
||||
for what in shell.tick(&self.settings, shot.as_deref()) {
|
||||
let show = |ctx: &Context| {
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Visible(true));
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Minimized(false));
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Focus);
|
||||
};
|
||||
match what {
|
||||
Do::Show => show(ctx),
|
||||
Do::Add => {
|
||||
show(ctx);
|
||||
self.main.adding.ask(crate::views::add::Request::default());
|
||||
}
|
||||
Do::PauseAll => self.run(ui, Action::PauseAll),
|
||||
Do::ResumeAll => self.run(ui, Action::ResumeAll),
|
||||
Do::Mode(m) => crate::views::modes::Change::Mode(m).apply(&mut self.settings),
|
||||
Do::Quit => {
|
||||
if let Some(shell) = &mut self.shell {
|
||||
shell.quitting = true;
|
||||
}
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Close);
|
||||
}
|
||||
Do::Open(file) => {
|
||||
crate::views::main::open_outside(&file.to_string_lossy());
|
||||
}
|
||||
Do::Folder(file) => {
|
||||
crate::views::main::reveal_outside(&file);
|
||||
}
|
||||
Do::SignIn(url, id) => {
|
||||
show(ctx);
|
||||
self.main.wish = Some(Wish::SignIn(url, vec![id]));
|
||||
}
|
||||
Do::Retry(id) => self.main.bridge.send(medlar_core::manager::Command::Resume(id)),
|
||||
}
|
||||
self.inbox.tick(ctx, &self.settings, &mut self.main);
|
||||
if crate::views::incoming::take_raised() || self.main.wish.is_some() {
|
||||
return true;
|
||||
}
|
||||
if self.applied != self.settings {
|
||||
self.main.bridge.apply(&self.settings);
|
||||
self.applied = self.settings.clone();
|
||||
self.save(None);
|
||||
}
|
||||
if self.saving.as_ref().is_some_and(|s| s.is_finished()) {
|
||||
self.saved();
|
||||
}
|
||||
// Requests for later repaints are not heard: a slow look round covers them.
|
||||
if wake.recv_timeout(std::time::Duration::from_secs(2)).is_err_and(|e| e == RecvTimeoutError::Disconnected) {
|
||||
return false;
|
||||
}
|
||||
while wake.try_recv().is_ok() {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -382,7 +323,7 @@ impl App {
|
|||
self.main.toasts.info("content_paste", tr!("clip.added", n = tasks.len()));
|
||||
self.main.bridge.add(tasks, secrets);
|
||||
} else if !links.is_empty() {
|
||||
crate::views::incoming::raise(ctx);
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Focus);
|
||||
self.main.adding.ask(Request { text: links.join("\n"), literal: true, ..Request::default() });
|
||||
}
|
||||
}
|
||||
|
|
@ -448,7 +389,7 @@ impl App {
|
|||
let on = self.settings.mode == medlar_core::settings::Mode::Snail;
|
||||
self.main.toasts.info("slow_motion_video", if on { tr!("snail.on") } else { tr!("snail.off") });
|
||||
}
|
||||
Action::Quit => self.quit(ui.ctx()),
|
||||
Action::Quit => ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close),
|
||||
other => {
|
||||
let anywhere = matches!(other, Action::ResumeAll | Action::PauseAll);
|
||||
if self.screen.is_some() && !anywhere {
|
||||
|
|
@ -461,14 +402,13 @@ impl App {
|
|||
}
|
||||
}
|
||||
|
||||
/// The app and which of its screens the window shows. The app outlives the window: closing to the tray ends the
|
||||
/// window, not the app.
|
||||
struct Window<'a> {
|
||||
app: &'a mut App,
|
||||
/// The app and which of its screens the window shows.
|
||||
struct Window {
|
||||
app: App,
|
||||
show: fn(&mut App, &mut Ui),
|
||||
}
|
||||
|
||||
impl eframe::App for Window<'_> {
|
||||
impl eframe::App for Window {
|
||||
fn ui(&mut self, ui: &mut Ui, _: &mut eframe::Frame) {
|
||||
(self.show)(&mut self.app, ui);
|
||||
}
|
||||
|
|
@ -477,9 +417,10 @@ impl eframe::App for Window<'_> {
|
|||
self.app.theme.surface.to_normalized_gamma_f32()
|
||||
}
|
||||
|
||||
/// Writes the settings; the downloads are saved when the app quits.
|
||||
/// Saves where the downloads are.
|
||||
fn on_exit(&mut self, _: Option<&eframe::glow::Context>) {
|
||||
self.app.finish();
|
||||
self.app.main.bridge.close();
|
||||
}
|
||||
|
||||
/// Only the window's place and size are remembered.
|
||||
|
|
@ -539,62 +480,6 @@ fn open(engine: bool, show: fn(&mut App, &mut Ui), mut args: Vec<String>) -> Exi
|
|||
log::warn!("language: {problem}");
|
||||
}
|
||||
strings::set(catalogue);
|
||||
// One context for every window, so that what holds it (engine, tray, port, second starts) wakes the next one too.
|
||||
let ctx = Context::default();
|
||||
ctx.set_embed_viewports(false);
|
||||
ctx.options_mut(|o| o.max_passes = std::num::NonZeroUsize::new(2).unwrap_or(std::num::NonZeroUsize::MIN));
|
||||
let (tx, wake) = sync_channel(1);
|
||||
ctx.set_repaint_observer(move |_| {
|
||||
let _ = tx.try_send(());
|
||||
});
|
||||
let mut app = App::new(&ctx, settings, Sources::detect());
|
||||
let mut window = true;
|
||||
if engine {
|
||||
if app.settings.desktop_colors.is_none() {
|
||||
app.first = Some(FirstRun::default());
|
||||
}
|
||||
app.paths = Some(paths.clone());
|
||||
crate::instance::wake_with(&ctx);
|
||||
app.inbox = Inbox::new(later.take(), args);
|
||||
app.main.outside = open_outside;
|
||||
app.main.reveal = crate::views::main::reveal_outside;
|
||||
app.main.remember(paths.data.join("view.json"));
|
||||
if let Some(damage) = damage {
|
||||
app.main.toasts.error(damage_words(&damage), None);
|
||||
}
|
||||
let opening = Opening { paths: paths.clone(), settings: app.settings.clone(), bus: Bus::System };
|
||||
app.main.bridge = Bridge::open(opening, &ctx);
|
||||
let shell = crate::shell::Shell::start(&ctx, &app.settings);
|
||||
window = !(minimised && shell.tray.is_some() && app.first.is_none());
|
||||
app.shell = Some(shell);
|
||||
}
|
||||
let mut code = ExitCode::SUCCESS;
|
||||
loop {
|
||||
if window {
|
||||
let this = &mut app;
|
||||
let make: eframe::AppCreator<'_> = Box::new(move |_| Ok(Box::new(Window { app: this, show })));
|
||||
if let Err(e) = eframe::run_native_ext(APP_ID, options(&paths), Some(ctx.clone()), make) {
|
||||
eprintln!("{}", tr!("app.no_window", why = e));
|
||||
code = ExitCode::FAILURE;
|
||||
break;
|
||||
}
|
||||
if !app.hides() {
|
||||
break;
|
||||
}
|
||||
log::info!("window closed; running in the tray");
|
||||
}
|
||||
window = app.hidden(&ctx, &wake);
|
||||
if !window {
|
||||
break;
|
||||
}
|
||||
}
|
||||
app.finish();
|
||||
app.main.bridge.close();
|
||||
code
|
||||
}
|
||||
|
||||
/// A new window, where the last one was.
|
||||
fn options(paths: &Paths) -> eframe::NativeOptions {
|
||||
let mut viewport = ViewportBuilder::default()
|
||||
.with_title("Medlar")
|
||||
.with_app_id(APP_ID)
|
||||
|
|
@ -603,13 +488,43 @@ fn options(paths: &Paths) -> eframe::NativeOptions {
|
|||
if let Some(rgba) = icons::app_rgba(128) {
|
||||
viewport = viewport.with_icon(Arc::new(egui::IconData { rgba, width: 128, height: 128 }));
|
||||
}
|
||||
eframe::NativeOptions {
|
||||
let options = eframe::NativeOptions {
|
||||
viewport,
|
||||
persist_window: true,
|
||||
persistence_path: Some(paths.data.join("window.ron")),
|
||||
run_and_return: true,
|
||||
..Default::default()
|
||||
};
|
||||
let make = move |cc: &eframe::CreationContext| {
|
||||
let mut app = App::new(&cc.egui_ctx, settings, Sources::detect());
|
||||
if engine {
|
||||
if app.settings.desktop_colors.is_none() {
|
||||
app.first = Some(FirstRun::default());
|
||||
}
|
||||
app.paths = Some(paths.clone());
|
||||
crate::instance::wake_with(&cc.egui_ctx);
|
||||
app.inbox = Inbox::new(later.take(), args.clone());
|
||||
app.main.outside = open_outside;
|
||||
app.main.reveal = crate::views::main::reveal_outside;
|
||||
app.main.remember(paths.data.join("view.json"));
|
||||
if let Some(damage) = damage {
|
||||
app.main.toasts.error(damage_words(&damage), None);
|
||||
}
|
||||
let opening = Opening { paths, settings: app.settings.clone(), bus: Bus::System };
|
||||
app.main.bridge = Bridge::open(opening, &cc.egui_ctx);
|
||||
let shell = crate::shell::Shell::start(&cc.egui_ctx, &app.settings);
|
||||
if minimised && shell.tray.is_some() {
|
||||
cc.egui_ctx.send_viewport_cmd(egui::ViewportCommand::Visible(false));
|
||||
}
|
||||
app.shell = Some(shell);
|
||||
}
|
||||
Ok(Box::new(Window { app, show }) as Box<dyn eframe::App>)
|
||||
};
|
||||
let made = eframe::run_native(APP_ID, options, Box::new(make));
|
||||
if let Err(e) = made {
|
||||
eprintln!("{}", tr!("app.no_window", why = e));
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
|
||||
fn damage_words(damage: &Damage) -> String {
|
||||
|
|
|
|||
|
|
@ -249,11 +249,6 @@ impl Bridge {
|
|||
Some(self.manager()?.probe(task, secret))
|
||||
}
|
||||
|
||||
/// What a video site offers at the link. None without an engine. Ask for the answer with `poll`.
|
||||
pub fn probe_video(&self, url: String) -> Option<Reply<Arc<medlar_core::ytdlp::Probe>>> {
|
||||
Some(self.manager()?.probe_video(url, None))
|
||||
}
|
||||
|
||||
/// Adds downloads. Their secrets are put in the keyring first, under the names the tasks have.
|
||||
pub fn add(&self, tasks: Vec<Task>, secrets: Vec<(String, Secret)>) {
|
||||
let (sites, manager) = match &mut *lock(&self.inner.engine) {
|
||||
|
|
|
|||
|
|
@ -13,18 +13,6 @@ use std::sync::{Arc, Mutex};
|
|||
use std::time::Duration;
|
||||
use url::Url;
|
||||
|
||||
/// What the clipboard holds now, if it is new: not what was there at the start, not the same text again.
|
||||
fn news(last: &mut Option<String>, text: String) -> Option<String> {
|
||||
let new = last.as_ref().is_some_and(|l| *l != text);
|
||||
*last = Some(text.clone());
|
||||
new.then_some(text)
|
||||
}
|
||||
|
||||
/// News that Medlar did not copy itself.
|
||||
fn foreign(last: &mut Option<String>, text: String, own: &str) -> Option<String> {
|
||||
news(last, text).filter(|t| t != own)
|
||||
}
|
||||
|
||||
/// False once the clipboard could not be opened.
|
||||
static WORKS: AtomicBool = AtomicBool::new(true);
|
||||
|
||||
|
|
@ -85,13 +73,14 @@ impl Watch {
|
|||
continue;
|
||||
};
|
||||
WORKS.store(true, Ordering::Relaxed);
|
||||
// An empty clipboard has no text: that counts as "" so the first link copied is news.
|
||||
let text = b.get_text().unwrap_or_default();
|
||||
let own = OWN.lock().unwrap().clone();
|
||||
if let Some(text) = foreign(&mut last, text, &own)
|
||||
&& tx.send(text).is_ok()
|
||||
{
|
||||
ctx.request_repaint();
|
||||
let Ok(text) = b.get_text() else { continue };
|
||||
if last.is_none() {
|
||||
last = Some(text);
|
||||
} else if last.as_deref() != Some(&text) {
|
||||
last = Some(text.clone());
|
||||
if *OWN.lock().unwrap() != text && tx.send(text).is_ok() {
|
||||
ctx.request_repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -117,40 +106,6 @@ impl Watch {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{foreign, news};
|
||||
|
||||
/// S044: what the clipboard of the session in the environment holds, read the way the watcher reads it.
|
||||
/// Run by hand inside a session: `MEDLAR_CLIP_EXPECT=<text> cargo test -p medlar --lib live_clipboard -- --ignored`.
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn live_clipboard() {
|
||||
let want = std::env::var("MEDLAR_CLIP_EXPECT").unwrap();
|
||||
let mut board = arboard::Clipboard::new().expect("the clipboard opens");
|
||||
let got = board.get_text();
|
||||
eprintln!("WAYLAND_DISPLAY={:?} DISPLAY={:?} got={got:?}", std::env::var("WAYLAND_DISPLAY"), std::env::var("DISPLAY"));
|
||||
assert_eq!(got.unwrap_or_default(), want);
|
||||
}
|
||||
|
||||
/// S037: an empty clipboard at the start (no text) must not swallow the first link copied.
|
||||
#[test]
|
||||
fn first_copy_after_empty_start_is_news() {
|
||||
let mut last = None;
|
||||
assert_eq!(news(&mut last, String::new()), None);
|
||||
assert_eq!(news(&mut last, "https://a/x.zip".into()).as_deref(), Some("https://a/x.zip"));
|
||||
assert_eq!(news(&mut last, "https://a/x.zip".into()), None);
|
||||
let mut last = None;
|
||||
assert_eq!(news(&mut last, "there at start".into()), None);
|
||||
assert_eq!(news(&mut last, "https://b".into()).as_deref(), Some("https://b"));
|
||||
}
|
||||
|
||||
/// S027 9: a link copied from inside Medlar is not offered back.
|
||||
#[test]
|
||||
fn own_copy_is_not_news() {
|
||||
let mut last = Some(String::new());
|
||||
assert_eq!(foreign(&mut last, "https://a/own.zip".into(), "https://a/own.zip"), None);
|
||||
assert_eq!(foreign(&mut last, "https://a/x.zip".into(), "https://a/own.zip").as_deref(), Some("https://a/x.zip"));
|
||||
}
|
||||
|
||||
use super::links;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue