92 lines
4.8 KiB
Markdown
92 lines
4.8 KiB
Markdown
# REPORT — felhom-controller v0.165.1 — Native "Megosztás…" button in the share modal (Web Share API)
|
|
|
|
## Baseline
|
|
|
|
| Repo | main @ start | version start → target |
|
|
|------|--------------|------------------------|
|
|
| felhom-controller | `570fb30` | v0.165.0 → **v0.165.1** |
|
|
|
|
Clean tree, `HEAD == origin/main`, verified before build.
|
|
|
|
## What shipped
|
|
|
|
The v0.165.0 "Indítópult megosztása" modal gains a feature-detected **"Megosztás…"** button that
|
|
opens the OS share sheet via `navigator.share`, sending the share **title + text + URL only**. Template
|
|
JS + tests only — no backend, no routes, no settings, no dependency changes.
|
|
|
|
## Files modified
|
|
|
|
- `controller/internal/web/templates/launcher.html` — the `#share-native-btn` button in the
|
|
share-link-row (`display:none` in markup); `nativeShare()` in the modal script; a `navigator.share`
|
|
feature-detect reveal in the existing IIFE.
|
|
- `controller/internal/web/launcher_share_modal_test.go` — **new**: Group A + Group B render tests.
|
|
- Docs: `CHANGELOG.md`, `controller/README.md`, `CONTEXT.md`.
|
|
|
|
## Behavior
|
|
|
|
- **Supported browser:** `#share-native-btn` is revealed (`navigator.share` truthy) and calls
|
|
`navigator.share({title:'Indítópult — <domain>', text:'Az otthoni alkalmazások egy helyen.',
|
|
url:<ShareURL>})` — **no `files:` key**. User cancel (`AbortError`) → silent; the modal stays open.
|
|
- **Unsupported browser** (Firefox desktop, Chrome/Linux): the button stays `display:none` (JS only
|
|
ever reveals it); "Link másolása" works exactly as in v0.165.0.
|
|
- **Non-cancel rejection:** falls back to `copyShareLink()` so the user still keeps the link on the
|
|
clipboard (with the existing "Másolva" feedback).
|
|
|
|
## Design ruling (CONTEXT)
|
|
|
|
The **QR is NOT attached** to the share payload (no Web Share Level-2 `files:`). File-share support is
|
|
narrow and several targets drop the URL when handed file+URL, leaving an unscannable QR picture in a
|
|
chat. The QR's job — physical cross-device scanning — is already served by the modal image (mobile
|
|
long-press covers "send the picture" with zero code).
|
|
|
|
## Tests + red-proofs
|
|
|
|
`go build ./... && go vet ./... && go test ./...` — all green. Gates: template_id, emoji,
|
|
native_confirm — OK.
|
|
|
|
New tests (`launcher_share_modal_test.go`), both PASS:
|
|
|
|
| Group | Scenario | Test |
|
|
|---|---|---|
|
|
| A | button hidden-by-default + feature-detect reveal + title/text/url-only payload (no `files:`) + copy retained | `TestShareModal_NativeShareButton` |
|
|
| B | AbortError-silent branch + non-abort fallback to `copyShareLink()` | `TestShareModal_NativeShareFallback` |
|
|
|
|
Companion **red-proofs** (mutate → FAIL → restore → green), both verified:
|
|
1. **Group A:** removed `style="display:none"` from the button (revealed it in markup) →
|
|
`TestShareModal_NativeShareButton` FAILS the hidden-by-default assertion. Restored → green.
|
|
2. **Group B:** swapped the `.catch` to swallow all errors (dropped the `copyShareLink()` fallback) →
|
|
`TestShareModal_NativeShareFallback` FAILS the fallback-presence assertion. Restored → green.
|
|
|
|
## Deployed version + validation (§13)
|
|
|
|
Built `0.165.1` on DooPlex, pushed, deployed to guest 9201. `docker ps`:
|
|
`gitea.dooplex.hu/admin/felhom-controller:0.165.1 Up (healthy)`.
|
|
|
|
**Rendered-page assertion** (authed `GET /launcher`, sharing enabled, via
|
|
`docker exec … curl http://localhost:8080` — the endpoint-level method; the OS sheet itself is not
|
|
endpoint-testable):
|
|
|
|
- `id="share-native-btn" class="btn btn-outline" style="display:none"` present (hidden-by-default): **1**
|
|
- feature-detect `if(navigator.share)` present: **1**
|
|
- payload `title:'Indítópult …`: **1** · `url:inp.value`: **1** · text "Az otthoni alkalmazások egy helyen": **1**
|
|
- `files:` in the page: **0** (QR deliberately not attached)
|
|
- "Link másolása" (universal fallback) present: **1**
|
|
|
|
Cleanup: `POST /launcher/share/disable` → `launcher_share_token` count in `settings.json` = **0**
|
|
(box left in the shipped default). Post-run `docker ps`: `Up (healthy)`.
|
|
|
|
## Pending human check (stated, not claimed)
|
|
|
|
The **OS share sheet interaction is an OS-level dialog** that endpoint checks and browser automation
|
|
cannot exercise. CC validates markup + JS presence at the rendered `/launcher` (authed curl, Group-A
|
|
strings). The single pending manual check is the operator's: desktop Chrome/Edge or a phone → the
|
|
"Megosztás…" button is visible → the sheet opens → a WhatsApp/email target receives the title + a
|
|
tappable link; on Firefox desktop the button is absent and "Link másolása" still works.
|
|
|
|
## Observations
|
|
|
|
- No Web Share Level-2 `files:` — ruled out above (narrow support; URL-drop when given file+URL).
|
|
- "Link másolása" is unchanged and remains the universal path; feature detection only, no UA sniffing.
|
|
- The share `text` is deliberately conjugation-free ("Az otthoni alkalmazások egy helyen.") — a
|
|
user-to-user message, not magázó UI copy.
|