Commit Graph

10 Commits

Author SHA1 Message Date
Wade Tregaskis
bc15440ded Now set the correct base URL for each article's webview, and now load app JavaScripts as WebKit "user" scripts.
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>
2023-11-22 13:47:54 -08:00
Jed Fox
6666ce7e83 Add dir=auto to iOS and Multiplatform 2021-03-29 17:20:09 -04:00
Maurice Parker
36841602a5 Change article rendering to use loadHTMLString instead of JavaScript. Issue #1923 2020-03-17 17:18:24 -05:00
Nate Weaver
e6c2c32456 Standardize on tabs 2020-01-30 06:19:54 -06:00
Nate Weaver
447cc44b8e Put <title> and <base> in the <head> instead of <body>
This also means renderHTML() is no longer needed.
2020-01-30 06:15:14 -06:00
Nate Weaver
758fb1a1c0 Make initial scale 100% and don't let WebKit increase text size
Issue #1459.
2019-12-24 20:15:53 -06:00
Maurice Parker
a1f26898c8 Split Mac and iOS specific javascript into individual files. 2019-10-13 15:47:11 -05:00
Andrew Brehaut
8882d219a6 544 footnote support working on iOS
This commit includes the newsfoot.js script in the iOS page.html file
and copies css from the Mac styleSheet.css into the iOS styleSheet.css.

The is only one difference in the styles between the two: iOS defines left and
right to be in terms of the viewport width rather than a fixed size. This ensures that the popover is always within the visible area.
2019-09-25 12:31:07 +12:00
Maurice Parker
0c00150849 Externalize javascript code into separate main.js file 2019-09-21 04:34:11 -05:00
Maurice Parker
3decd23c45 Convert iOS to use Javascript rendering 2019-09-20 20:33:28 -05:00