Replace client-side Amazon affiliate resolution with server-side
redirects via voltplan.app/{componentId} and voltplan.app/search?q=.
Remove AmazonAffiliate, affiliate link fetching, and per-model
affiliate fields in favor of a single componentID.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
22 lines
691 B
Swift
22 lines
691 B
Swift
import Foundation
|
|
|
|
enum VoltPlanRedirect {
|
|
private static let baseURL = "https://voltplan.app"
|
|
|
|
static func componentURL(id: String) -> URL? {
|
|
var components = URLComponents(string: "\(baseURL)/\(id)")
|
|
components?.queryItems = [URLQueryItem(name: "src", value: "cable")]
|
|
return components?.url
|
|
}
|
|
|
|
static func searchURL(query: String) -> URL? {
|
|
guard !query.isEmpty else { return nil }
|
|
var components = URLComponents(string: "\(baseURL)/search")
|
|
components?.queryItems = [
|
|
URLQueryItem(name: "q", value: query),
|
|
URLQueryItem(name: "src", value: "cable"),
|
|
]
|
|
return components?.url
|
|
}
|
|
}
|