Add Startpage as a browser search engine option (#1368)
Add Startpage (startpage.com) to the BrowserSearchEngine enum alongside Google, DuckDuckGo, Bing, and Kagi. Startpage provides an OpenSearch- compatible suggestions endpoint at /osuggestions, so autosuggestions work out of the box using the existing OSJSON parser. Co-authored-by: Zlatko Cajic <git@zlat.co> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5776cd5d81
commit
23bfc11b19
1 changed files with 11 additions and 1 deletions
|
|
@ -56,6 +56,7 @@ enum BrowserSearchEngine: String, CaseIterable, Identifiable {
|
|||
case duckduckgo
|
||||
case bing
|
||||
case kagi
|
||||
case startpage
|
||||
|
||||
var id: String { rawValue }
|
||||
|
||||
|
|
@ -65,6 +66,7 @@ enum BrowserSearchEngine: String, CaseIterable, Identifiable {
|
|||
case .duckduckgo: return "DuckDuckGo"
|
||||
case .bing: return "Bing"
|
||||
case .kagi: return "Kagi"
|
||||
case .startpage: return "Startpage"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -82,6 +84,8 @@ enum BrowserSearchEngine: String, CaseIterable, Identifiable {
|
|||
components = URLComponents(string: "https://www.bing.com/search")
|
||||
case .kagi:
|
||||
components = URLComponents(string: "https://kagi.com/search")
|
||||
case .startpage:
|
||||
components = URLComponents(string: "https://www.startpage.com/do/dsearch")
|
||||
}
|
||||
|
||||
components?.queryItems = [
|
||||
|
|
@ -1158,6 +1162,12 @@ actor BrowserSearchSuggestionService {
|
|||
URLQueryItem(name: "q", value: query),
|
||||
]
|
||||
url = c?.url
|
||||
case .startpage:
|
||||
var c = URLComponents(string: "https://www.startpage.com/osuggestions")
|
||||
c?.queryItems = [
|
||||
URLQueryItem(name: "q", value: query),
|
||||
]
|
||||
url = c?.url
|
||||
}
|
||||
|
||||
guard let url else { return [] }
|
||||
|
|
@ -1182,7 +1192,7 @@ actor BrowserSearchSuggestionService {
|
|||
}
|
||||
|
||||
switch engine {
|
||||
case .google, .bing, .kagi:
|
||||
case .google, .bing, .kagi, .startpage:
|
||||
return parseOSJSON(data: data)
|
||||
case .duckduckgo:
|
||||
return parseDuckDuckGo(data: data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue