3 struct AdvancedSettings: View {
5 @AppStorage("backendUrl") var backendUrl: String = ""
6 @AppStorage("backendFormat") var outputFormats: OutputFormatSetting = .gifOnly
7 @AppStorage("keepFiles") var keepFiles = true
8 @AppStorage("allowURLAutomation") var allowURLAutomation = false
9 @State var showConfirmation = false
11 var parsedBackendUrl: URL? {
12 URL(string: backendUrl)
17 VStack (alignment: .center) {
19 VStack (alignment: .center) {
20 LabeledContent("Backend URL") {
21 TextField("", text: $backendUrl).font(.body)
23 .help("The Backend URL to use. If this is empty, no backend will be used and the options below won't have an effect.")
24 Picker(selection: $outputFormats, label: Text("Backend Format").font(.headline)) {
26 .tag(OutputFormatSetting.gifOnly)
27 .padding(.horizontal, 4.0)
28 .padding(.vertical, 2.0)
30 .tag(OutputFormatSetting.mp4Only)
31 .padding(.horizontal, 4.0)
32 .padding(.vertical, 2.0)
34 .pickerStyle(.radioGroup)
35 .disabled(parsedBackendUrl == nil)
36 .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.")
37 Toggle("Keep Local Files", isOn: $keepFiles)
39 .disabled(parsedBackendUrl == nil)
40 .padding(.vertical, 8.0)
41 .help("If this is off, locally generated recordings will be deleted immediately after a successful upload.")
43 Text("These settings can break things! Please make sure you understand how to use them before enabling.")
45 Link(destination: URL(string: "https://captura.tranquil.systems")!) {
46 Image(systemName: "info.circle")
47 }.buttonStyle(.borderless)
51 Divider().padding(.vertical, 8.0)
53 Toggle("Allow URL Based Automation", isOn: $allowURLAutomation)
55 .padding(.vertical, 8.0)
56 .help("If this is on, the app can be controlled remotely using the captura: URL scheme.")
57 .confirmationDialog("This may be dangerous and can allow websites to remotely record your computer.", isPresented: $showConfirmation, actions: {
58 Button("I Understand The Risk", role: .destructive) {
59 showConfirmation = false
61 Button("Cancel", role: .cancel) {
62 showConfirmation = false
63 allowURLAutomation = false
66 .onChange(of: allowURLAutomation, perform: { newValue in
68 showConfirmation = true