Setting the real base URL (rather than using a file URL pointing to the app's Resources folder) allows relative URLs to work correctly within the article, such as for images, and is compatible with Cross-Site-Origin policies that restrict use of resources outside of the origin domain.
It also implicitly eliminates access to the local file system from within the webview, as the use of a non-file base URL makes WebKit treats the webview's content as being from a remote server, and its default security policy is to then disallow local file access (except with explicit user action, such as drag-and-drop or via an `input` form element).
Note: the base URL is currently typically taken from the feed itself (specifically the "link" feed (channel) metadata). That is controlled by the feed author (or a man-in-the-middle attacker). It should perhaps be validated to ensure it's actually an HTTP/HTTPS URL, to prevent security problems.
The app-specific JavaScripts - used for fixing styling issues and the like - are now formally loaded as extensions to the web page, "user scripts" in WebKit parlance. They're isolated to their own JavaScript world - meaning they can't be seen or manipulated by JavaScript from the feed article itself, and are more secure as a result.
Fixes#4156.
Co-Authored-By: Brent Simmons <1297121+brentsimmons@users.noreply.github.com>
This commit focuses on the `ArticleViewController`:
- Adds an "Aa" menu to the article view that allows for theme changes and full screen article toggling on iPhone, and theme changes on iPad.
- Removes separate Settings option for full screen availability on iPhone.
- Removes tap target in nav bar to enable full screen mode.
The viewWillTransition(to:with:) method in WebViewController was introduced to
fix#3041, so I added an alternative solution using a resize handler in JS.
Adds app defaults option for controlling link opening preferences.
Adds browser logic and images.
Browser Manager Updates
- Handles deletion of current browser
- Fixes detection of installed browsers by moving URL Types to LSApplicationQuery
- Updates icons to glyphs
- Context menus update
tidy up
- removes browser specific options and offers in-app or default browser options (can be enabled via a bool)
- adds 1Password as an option
- removes custom wording on context menus
Fixes
- makes sure browser options are available on iPad
- uses VibrantCell
- Changes Settings title to "Open Links In"