fix: validate config.activeTarget; warn-once on hand-edit typos#3
Merged
Conversation
…t typos Before: if a user hand-edits ~/.config/sshshot/config.json and sets activeTarget to a typo'd or removed remote (e.g. 'cidatel' instead of 'citadel'), the daemon happily polled that value forever. Every screenshot upload silently failed at the SSH layer; the only signal was lines in the log file. Now: the daemon validates activeTarget against config.remotes (plus 'local' and the original start-time target) on each poll cycle. If the value isn't in the valid set: - Log a one-shot warning naming the bad value, the known-good targets, and the fallback that will be used - Stick with the last known-good target (or the start-time target on first poll) - Re-warn only if the bad value changes (so a typo sitting there doesn't spam logs at 5 Hz) When a subsequent valid value lands, the warning state resets so the *next* invalid value (if any) re-warns once.
|
🎉 This PR is included in version 0.4.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
flamerged
added a commit
that referenced
this pull request
May 1, 2026
Phase 5 'big' item #3 of 3. ## What - Auto-detect Wayland vs X11 via `XDG_SESSION_TYPE` / `WAYLAND_DISPLAY` - Wayland path: `wl-paste --type image/png` (read) + `wl-copy` (write) - X11 path: existing `xclip` code path, unchanged - Startup warning is session-aware (wl-clipboard hint for Wayland, xclip hint for X11) - Banner / log shows 'Linux (Wayland)' or 'Linux (X11)' so users see which path is active ## Why Modern Ubuntu/Fedora/etc. default to Wayland; xclip silently fails there. ~50% of Linux users were getting silent clipboard no-ops before this change.
flamerged
added a commit
that referenced
this pull request
May 1, 2026
…, clipboard reads (#14) Four items from the latest project review (P3/P4 cleanup): | # | Item | |---|------| | #2 | `getPidFile` deduped into config.ts (single source of truth) | | #3 | `taskkill` via spawnSync with array args | | #5 | `startBackground` Linux/macOS path: nohup execSync → spawn detached (closes the `\${remote}` shell-injection surface; the original 'native clipboard library crashes with detached' rationale is obsolete since @crosscopy/clipboard was removed) | | #6 | xclip / wl-paste / pngpaste / defaults clipboard reads via spawnSync | Net: zero remaining execSync calls with user-controlled string interpolation. All tests still pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes review item #15:
activeTargetwas not validated when the config was hand-edited externally — daemon silently kept polling a dead remote with no surface signal except log file errors.Behavior change
activeTargetagainstconfig.remotes ∪ {'local', initialRemote}on every poll cycle.Smoke test
~/.config/sshshot/config.jsontoactiveTarget: 'typo-host'sshshot target local; daemon picks it up cleanly