Commit Graph

101 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
771badecc6 Rename webFeed to feed. 2023-07-05 20:46:25 -07:00
Brent Simmons
75f1eee00c Rename Article.webFeed to Article.feed. 2023-07-02 16:22:14 -07:00
Stuart Breckenridge
ed6ff090be Merge branch 'ios-ui-settings-localised' into localize_strings
# Conflicts:
#	Mac/AppDelegate.swift
#	Mac/Base.lproj/Preferences.storyboard
#	NetNewsWire.xcodeproj/project.pbxproj
#	Shared/Localizations/LocalizedNetNewsWireError.swift
#	iOS/MasterFeed/MasterFeedViewController.swift
#	iOS/Settings/Appearance/ArticleThemeManagerView.swift
#	iOS/Settings/Appearance/DisplayAndBehaviorsView.swift
#	iOS/Settings/General/SettingsView.swift
2023-05-27 17:00:42 +08:00
Maurice Parker
152700089b Fix merge conflict 2023-04-16 14:17:34 -05:00
Maurice Parker
2ada885656 Replace old iOS WKWebView flash prevention code with new technique 2023-04-16 14:08:48 -05:00
Stuart Breckenridge
2bca08195e Localization work 2022-12-30 21:53:07 +08:00
Maurice Parker
ce6d1144bf Change to not encode the email address. Fixes #3719 2022-10-28 20:17:24 -05:00
Stuart Breckenridge
08618f5f15 Articles
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.
2022-02-10 12:13:06 +08:00
Stuart Breckenridge
7249451c99 Fixes Article nav/tool bar behaviour
Now consistent with Feed and Timeline
2022-01-29 13:52:57 +08:00
Dimitris Apostolou
94ae4d348c Fix typos 2022-01-05 00:25:20 +02:00
Brian Sanders
a731397486 Fixes #2369: Video playback is reset on rotation
The viewWillTransition(to:with:) method in WebViewController was introduced to
fix #3041, so I added an alternative solution using a resize handler in JS.
2021-12-04 18:43:53 -05:00
Maurice Parker
5001d82355 Restore article scroll position on iOS 2021-09-13 01:11:23 -05:00
Maurice Parker
7646029f2e Reload the web view when the Theme changes 2021-09-12 15:44:24 -05:00
Maurice Parker
512e83d786 Refactor Styles to now be Themes 2021-09-07 16:58:06 -05:00
Maurice Parker
56bbfe713b Fix regression that prevented universal links from working 2021-09-01 14:13:04 -05:00
Stuart Breckenridge
178e737040 Converts to a browser preference to a Bool. 2021-08-26 10:27:23 +08:00
Stuart Breckenridge
3bc18e2891 Reduces Browsers to in-app and system default 2021-08-25 15:05:18 +08:00
Stuart Breckenridge
08a1120e00 Adds app default option
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"
2021-08-23 23:01:48 +08:00
Maurice Parker
b3773ad01b 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-29 16:48:42 -05:00
Maurice Parker
f9af3c786b Merge branch 'ios-candidate' 2021-05-25 20:12:50 -05:00
Maurice Parker
7e820c58e5 Reload the webview when rotating the device on an iPhone. Fixes #3041 2021-05-04 21:44:55 -05:00
Duncan Babbage
9092d075a0 Handle links with unencoded spaces. Fixes #3069 2021-04-28 22:49:32 +12:00
Maurice Parker
cc6449ed2a Merge branch 'ios-candidate' into main 2021-04-03 11:10:04 -05:00
Maurice Parker
0d5de9c325 Renamed Open in Safari activity to Open in Browser 2021-04-03 09:06:51 -05:00
Stuart Breckenridge
1e578828e9 : class chnaged to : AnyObject for protocols 2021-02-06 07:06:45 +08:00
Stuart Breckenridge
f85c1234a5 Adds to the URL-Extensions file 2021-01-09 06:09:50 +08:00
Stuart Breckenridge
ea77504f3a percent encodes email addresses 2021-01-09 05:56:13 +08:00
Stuart Breckenridge
c59e3e4ddf Emails
Acquiesce to the user’s request for a different default mail app.
2021-01-08 12:15:16 +08:00
Maurice Parker
def0bfea27 Add menu separators to article view context menu. 2020-11-13 10:18:48 -06:00
Maurice Parker
cf8dbb26f7 Resolve issue where we could have a web view deallocated before getting displayed. 2020-09-01 18:54:46 -05:00
Maurice Parker
a500166af0 Merge branch 'ios-release' into main 2020-08-15 11:03:29 -05:00
Stuart Breckenridge
7183b853bd #2256
Fixes #2256
2020-07-13 14:24:57 +08:00
Maurice Parker
95a8f6d72d Merge branch 'swiftui' 2020-07-10 15:28:14 -05:00
Nate Weaver
82f7f99827 iOS: Make shift-space scroll up even when the detail view doesn't have focus 2020-07-10 13:57:35 -05:00
Stuart Breckenridge
f92b219cdc NetNewsWire-iOS AppDefaults is now a singleton 2020-07-02 10:47:45 +08:00
Maurice Parker
36e39705e7 Merge branch 'ios-release' 2020-06-16 08:10:31 -05:00
Maurice Parker
4075da2ee8 Fix removal of tap zones when removing old web views 2020-06-16 08:07:54 -05:00
Maurice Parker
95f6f80583 Merge branch 'ios-release' 2020-06-15 17:40:06 -05:00
Brian Sanders
6aa7b009f8 Tweaks the scroll behavior when space bar is pressed
The overlap is 2 lines of text at the standard system font size.
2020-06-13 19:17:17 -04:00
Maurice Parker
7d8e49a2ee Merge branch 'ios-release' 2020-05-18 03:05:59 -05:00
Brian Sanders
46ce824b98 Adds guard against empty search strings to Find in Article 2020-05-15 21:41:14 -04:00
Brian Sanders
98e0434077 Alters Find in Article to escape regex characters by default 2020-05-15 21:40:22 -04:00
Maurice Parker
4e22489d97 Merge branch 'ios-release' of https://github.com/Ranchero-Software/NetNewsWire into ios-release 2020-05-15 10:45:22 -05:00
Maurice Parker
8ff2776d88 Make sure we have only one web view in the view hierarchy after navigation. Issue #2075 2020-05-15 10:45:05 -05:00
Maurice Parker
225c98a70e Merge pull request #2073 from rizwankce/open-in-safari-shortcut
Keyboard shortcuts for "Open in App Browser"
2020-05-15 04:38:26 -05:00
Rizwan Mohamed Ibrahim
c9ebb6bd75 adds "Open In App Browser" shortcut 2020-05-15 12:39:33 +05:30
Maurice Parker
8500324eb2 Merge pull request #2041 from stuartbreckenridge/mail-fix-ios
mailto links now open on iOS
2020-05-14 07:26:26 -05:00
Brian Sanders
737f4bfdf5 Adds "Find in Article" activity to the share sheet
addresses #1750
2020-05-11 17:08:44 -04:00
Maurice Parker
2d8cbb8017 Merge branch 'ios-release' 2020-05-06 18:39:55 -05:00