Skip to content

Commit

Permalink
Use system-provided userAgent by default, fixes #84
Browse files Browse the repository at this point in the history
  • Loading branch information
kofigumbs committed Jul 15, 2022
1 parent 7f78924 commit 4046c57
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ The `tabs` field is an array of objects with the following fields:
| `customCss` | Array of Strings (Optional) | Custom CSS URLs (see [Custom JS/CSS](#custom-jscss)) |
| `basicAuthUser` | String (Optional) | User name credential for requests that use basic access authentication |
| `basicAuthPassword` | String (Optional) | Password credential for requests that use basic access authentication |
| `userAgent` | String (Optional) | Override the user agent header (Defaults to a recent Safari value) |
| `userAgent` | String (Optional) | Override the default WebKit user agent header |

Here's the bare minimum example used in the Slack demo video above:

Expand Down
2 changes: 1 addition & 1 deletion Sources/Runtime/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct Config {
customJs: tab.customJs ?? [],
basicAuthUser: tab.basicAuthUser ?? "",
basicAuthPassword: tab.basicAuthPassword ?? "",
userAgent: tab.userAgent ?? "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15"
userAgent: tab.userAgent
)}
}()

Expand Down
2 changes: 1 addition & 1 deletion Sources/Runtime/Tab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Tab: NSObject {
// Also: https://stackoverflow.com/a/64012633
var badgeCount: Int = 0

init(title: String, url: URL, customCss: [URL], customJs: [URL], basicAuthUser: String, basicAuthPassword: String, userAgent: String) {
init(title: String, url: URL, customCss: [URL], customJs: [URL], basicAuthUser: String, basicAuthPassword: String, userAgent: String?) {
let configuration = WKWebViewConfiguration()
Browser.global.customCss(configuration, urls: customCss)
Browser.global.customJs(configuration, urls: customJs)
Expand Down

0 comments on commit 4046c57

Please sign in to comment.