Debrid services can change their APIs at any time which negatively impacts user experiences on Ferrite. Add the following: - Ability for a user to add a manually generated API key only showing the last 4 characters for security purposes. - Make ephemeral auth sessions toggle-able. ASWebAuthenticationView does not automatically clear on toggle change. - Add the savedLinks endpoint for AllDebrid so users can access their downloads and magnets. - Add a links section to AD's cloud view. Signed-off-by: kingbri <bdashore3@proton.me>
35 lines
974 B
Swift
35 lines
974 B
Swift
//
|
|
// WebView.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 7/17/22.
|
|
//
|
|
|
|
import SwiftUI
|
|
import WebKit
|
|
|
|
struct WebView: UIViewRepresentable {
|
|
@AppStorage("Behavior.UseEphemeralAuth") var useEphemeralAuth: Bool = true
|
|
var url: URL
|
|
|
|
func makeUIView(context: Context) -> WKWebView {
|
|
// Make the WebView ephemeral depending on the ephemeral auth setting
|
|
let config = WKWebViewConfiguration()
|
|
|
|
config.websiteDataStore = useEphemeralAuth ? .nonPersistent() : .default()
|
|
|
|
let webView = WKWebView(frame: .zero, configuration: config)
|
|
let _ = webView.load(URLRequest(url: url))
|
|
return webView
|
|
}
|
|
|
|
func updateUIView(_ webView: WKWebView, context: Context) {
|
|
webView.configuration.websiteDataStore = useEphemeralAuth ? .nonPersistent() : .default()
|
|
}
|
|
}
|
|
|
|
struct WebView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
WebView(url: URL(string: "https://google.com")!)
|
|
}
|
|
}
|