Skip to content

Add support for loading http(s) URLs#1

Merged
just-be-dev merged 4 commits into
mainfrom
feat/url-input
Jun 5, 2026
Merged

Add support for loading http(s) URLs#1
just-be-dev merged 4 commits into
mainfrom
feat/url-input

Conversation

@just-be-dev

@just-be-dev just-be-dev commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Just wanted to add URL support.

AI Summary

Adds the ability to render a remote page by passing an http:// or https:// URL as the positional argument, alongside the existing file-path and piped-stdin inputs.

Changes

  • src/input.rs — New Load::Url(String) variant and a case-insensitive looks_like_url() helper. A positional arg matching an http(s) scheme resolves to Load::Url; anything else stays Load::File. Piped stdin still wins over both. Added unit tests for http/https, case-insensitivity, non-URL-stays-file, and stdin precedence.
  • src/run.rs — New match arm Load::Url(url) => builder.with_url(url), loading the page directly (no custom protocol needed).
  • src/cli.rs — Positional value_name is now FILE|URL; updated doc comment, long help, and added a webview https://example.com example.
  • src/main.rs — Updated the no-input usage message.
  • README.md — Documented URL input and updated the precedence note.

Notes

Unlike file pages (served over the custom wv:// origin), a URL loads on its real remote origin. The window.webview bridge is still injected so resolve/reject work the same.

Testing

  • cargo test — 26 tests pass
  • cargo clippy --all-targets -- -D warnings — clean
  • cargo fmt --check — clean

The positional argument now accepts an http:// or https:// URL in
addition to a file path. URLs are detected case-insensitively and
loaded directly via the webview; anything else is still treated as a
file. Piped stdin continues to take precedence over both.

Updates help text, usage message, and README accordingly.
Prepares for release of the http(s) URL input feature.
Expose window.webview.version to the page and set a webview-cli/<version>
User-Agent so remote pages can detect they're rendered inside webview
(in JS, or server-side before any JS runs). wry replaces the UA
wholesale, so this token becomes the full User-Agent.
@just-be-dev just-be-dev merged commit d624640 into main Jun 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant