Files
Cable/Cable/AmazonAffiliate.swift
Stefan Lange-Hegermann 8b30fabaa2 Route all affiliate links through voltplan.app
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>
2026-05-22 10:39:46 +02:00

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
}
}