Commit Graph

70 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
Brent Simmons
0402bd607f Continue adopting async/await. 2023-07-10 21:19:28 -07:00
Brent Simmons
771badecc6 Rename webFeed to feed. 2023-07-05 20:46:25 -07:00
Henrik Hørlück Berg
78c9d182c4 Disable audio autoplay on macOS
- To be in-line with how this is threated on iOS
2023-05-03 19:47:28 +02:00
Brent Simmons
8bbf4d8c60 Continue adopting @MainActor. 2023-04-05 18:35:34 -07:00
Daniel Jalkut
99797586b1 Add support for in-article find when the detail view is showing a regular article or extracted article content. 2022-07-18 13:04:10 -04:00
Stuart Breckenridge
b08d9dfe73 if #available mac
Removes if #available for anything less than macOS 11
2022-01-22 20:55:09 +08:00
Stuart Breckenridge
d680fe0988 WKWebpagePreferences added to macOS 2022-01-22 08:39:57 +08:00
Maurice Parker
c26f09ad1c Fix bug that prevented us from returning to the original text size 2021-11-01 21:24:56 -05:00
Maurice Parker
b43d8b6b28 Change reload so that the text size style can be used in more places. 2021-09-17 15:59:43 -05:00
Maurice Parker
de956f9473 Change to use JavaScript to detect scroll events as it will also capture scrollbar events 2021-09-13 21:03:27 -05:00
Maurice Parker
2c801a388c Restore the article scroll position when restarting NetNewsWire 2021-09-13 20:42:58 -05:00
Maurice Parker
abd66ea1bb Maintain scroll position when changing themes 2021-09-11 20:53:57 -05:00
Maurice Parker
596202fc33 Reload the article if the theme changes 2021-09-08 15:55:42 -05:00
Maurice Parker
512e83d786 Refactor Styles to now be Themes 2021-09-07 16:58:06 -05:00
Daniel Jalkut
2e652351ec Implement the WKUIDelegate method that is reached when JavaScript in a web view invokes window.open(). This ensures that attempts to open links from code, such as from the YouTube embedded video player, work as expected. Fixes #3088. 2021-07-27 17:34:48 -04:00
Maurice Parker
ab5421f533 Merge branch 'mac-release' into main 2021-03-27 17:21:49 -05:00
Maurice Parker
42e6e1397d Signal that the mouse exited the link when an article gets reloaded. Fixes #2877 2021-03-15 20:14:30 -05:00
Maurice Parker
78b9444274 Remove extra unused parameter in delegate signature 2021-03-15 20:10:42 -05:00
Stuart Breckenridge
a59df3e6fc Moves frame tweaking to end of liveResize 2021-03-08 10:28:51 +08:00
Stuart Breckenridge
27b9326d07 fixes #2823 2021-03-08 10:06:30 +08:00
Stuart Breckenridge
2e12f5a078 removes code comment 2021-03-07 21:34:52 +08:00
Stuart Breckenridge
86981a0c5b #2597
Fixes #2597: Toggles a small window height change to get webview to behave on macOS 11.
2021-03-07 16:47:39 +08:00
Stuart Breckenridge
7a653db1dd typo 2021-03-07 15:51:43 +08:00
Stuart Breckenridge
8dc6e4e332 Contraint Changes
Fixes #2850
• #2634: resizing vertically downards (expanding) is smooth
2021-03-07 14:21:30 +08:00
Maurice Parker
2ca06eeae7 Remove containing box for web view. Fixes #2848 2021-03-05 12:45:15 -06:00
Collin Donnell
035759947a Fix #2833: Titlebar is overlapped by toolbar in fullscreen
Fix issue where detail web view would be overlapped by the toolbar in full screen by setting web view constraints to use the `safeAreaLayoutGuide` in macOS 11+.
2021-02-27 19:02:13 -06:00
Collin Donnell
593569175c Fix #2833: Titlebar is overlapped by toolbar in fullscreen
Fix issue where detail web view would be overlapped by the toolbar in full screen by setting web view constraints to use the `safeAreaLayoutGuide` in macOS 11+.
2021-02-27 16:32:57 -08:00
Stuart Breckenridge
1e578828e9 : class chnaged to : AnyObject for protocols 2021-02-06 07:06:45 +08:00
Maurice Parker
6ef29e3927 Update the text size using JavaScript so that the web page doesn't reload. Fixes #2641 2020-12-08 19:00:56 -06:00
Maurice Parker
948998382d Make article view text adjustable via the app preferences. Fixes #42 2020-11-03 17:08:56 -06:00
Maurice Parker
0338a3bda4 Remove deprecation warning 2020-11-02 19:43:29 -06:00
Maurice Parker
3aad0b5075 Remove no longer needed system events. Fixes #2537 2020-10-30 09:44:24 -05:00
Maurice Parker
95a8f6d72d Merge branch 'swiftui' 2020-07-10 15:28:14 -05:00
Nate Weaver
5acce87995 Mac: Make shift-space scroll up even when the detail view doesn't have focus
Issue #969.
2020-07-10 13:57:34 -05:00
Stuart Breckenridge
a57f98e4e7 NetNewsWire-Mac AppDefaults is now a singleton 2020-07-02 11:17:38 +08:00
Nate Weaver
5cd8dc9d5d Also let the Command key invert the background pref in web views 2020-05-20 20:08:13 -05:00
Nate Weaver
1e1fc06e7b Clean up shift-key checking and add it to more places 2020-05-20 19:59:21 -05:00
Maurice Parker
6a384d99e6 Darken and lighten the accent color for the article view. 2020-03-20 08:13:39 -05:00
Maurice Parker
770206df60 Merge branch 'ios-release' 2020-03-17 17:19:31 -05:00
Maurice Parker
36841602a5 Change article rendering to use loadHTMLString instead of JavaScript. Issue #1923 2020-03-17 17:18:24 -05:00
Maurice Parker
94c6ca428f Merge branch 'mac-release' 2020-03-01 16:32:31 -08:00
Maurice Parker
85bd20ca80 Stop media playback when the main window is closed. Issue #1646 2020-02-27 12:15:41 -08:00
Maurice Parker
2ae021960b Move account files to the documents directory and out of the shared container. Issue #1784 2020-02-12 16:21:48 -08: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
Maurice Parker
dd5633b5ae Change to use the correct URL when reloading an image. 2020-01-27 16:27:13 -07:00
Maurice Parker
3a99e6430f Make the article icon code specify the desired article so that it can't pull the wrong one by mistake. Issue #1707 2020-01-27 12:58:32 -07:00
Maurice Parker
81e71051ef Change to reload the page.html file instead of using its string value. 2020-01-26 20:45:49 -07:00
Maurice Parker
58b24f3349 Rename callback: to completion: 2019-12-14 18:01:34 -07:00
Maurice Parker
56d43f8f2d Do a full reload of the article when rearranging the UI to accommodate for split screen color changes. 2019-11-20 18:16:54 -06:00