Jul 14 - Using CDN - update
This commit is contained in:
@@ -47,6 +47,16 @@ nonisolated enum ServerConfig {
|
||||
let raw = UserDefaults.standard.string(forKey: defaultsKey) ?? ""
|
||||
return ServerOption(rawValue: raw) ?? .primary
|
||||
}
|
||||
|
||||
/// Resolve a photo URL, preferring an absolute server-provided URL
|
||||
/// (presigned R2 on the s3 backend, absolute-static on local) and falling
|
||||
/// back to building one from the relative 'uploads/...' key for older
|
||||
/// servers that don't send the *_url fields.
|
||||
nonisolated static func mediaURL(absolute: String?, path: String) -> URL? {
|
||||
if let a = absolute, !a.isEmpty { return URL(string: a) }
|
||||
guard !path.isEmpty else { return nil }
|
||||
return URL(string: current + "/static/" + path)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - App-wide constants
|
||||
|
||||
Reference in New Issue
Block a user