4 struct AdvancedSettings: View {
6 @CloudStorage("backendUrl") var backendUrl: String = ""
7 @CloudStorage("backendFormat") var backendFormat: OutputFormatSetting = .gifOnly
8 @CloudStorage("keepFiles") var keepFiles = true
9 @CloudStorage("allowURLAutomation") var allowURLAutomation = false
10 @State var showConfirmation = false
12 private var anyState: String { "\(backendUrl), \(backendFormat), \(keepFiles), \(allowURLAutomation)" }
14 var parsedBackendUrl: URL? {
15 URL(string: backendUrl)
20 VStack (alignment: .center) {
22 VStack (alignment: .center) {
23 LabeledContent("Backend URL") {
24 TextField("", text: $backendUrl).font(.body)
26 .help("The Backend URL to use. If this is empty, no backend will be used and the options below won't have an effect.")
27 Picker(selection: $backendFormat, label: Text("Backend Format").font(.headline)) {
29 .tag(OutputFormatSetting.gifOnly)
30 .padding(.horizontal, 4.0)
31 .padding(.vertical, 2.0)
33 .tag(OutputFormatSetting.mp4Only)
34 .padding(.horizontal, 4.0)
35 .padding(.vertical, 2.0)
37 .pickerStyle(.radioGroup)
38 .disabled(parsedBackendUrl == nil)
39 .help("The format picked here will be generated regardless of what option you pick in the output settings. It doesn't prevent files from being rendered.")
40 Toggle("Keep Local Files", isOn: $keepFiles)
42 .disabled(parsedBackendUrl == nil)
43 .padding(.vertical, 8.0)
44 .help("If this is off, locally generated recordings will be deleted immediately after a successful upload.")
46 Text("These settings can break things! Please make sure you understand how to use them before enabling.")
48 Link(destination: URL(string: "https://captura.tranquil.systems")!) {
49 Image(systemName: "info.circle")
50 }.buttonStyle(.borderless)
54 Divider().padding(.vertical, 8.0)
56 Toggle("Allow URL Based Automation", isOn: $allowURLAutomation)
58 .padding(.vertical, 8.0)
59 .help("If this is on, the app can be controlled remotely using the captura: URL scheme.")
60 .confirmationDialog("This may be dangerous and can allow websites to remotely record your computer.", isPresented: $showConfirmation, actions: {
61 Button("I Understand The Risk", role: .destructive) {
62 showConfirmation = false
64 Button("Cancel", role: .cancel) {
65 showConfirmation = false
66 allowURLAutomation = false
69 .onChange(of: allowURLAutomation, perform: { newValue in
71 showConfirmation = true
78 .onChange(of: anyState) { _ in
79 NotificationCenter.default.post(name: .reloadConfiguration, object: nil, userInfo: nil)