Add iPad support, auto-pinning, and comprehensive logging
- Adaptive iPhone/iPad layout with NavigationSplitView sidebar - Auto-detect SSL-pinned domains, fall back to passthrough - Certificate install via local HTTP server (Safari profile flow) - App Group-backed CA, per-domain leaf cert LRU cache - DB-backed config repository, Darwin notification throttling - Rules engine, breakpoint rules, pinned domain tracking - os.Logger instrumentation across tunnel/proxy/mitm/capture/cert/rules/db/ipc/ui - Fix dyld framework embed, race conditions, thread safety
This commit is contained in:
68
UI/Compose/HeaderEditorSheet.swift
Normal file
68
UI/Compose/HeaderEditorSheet.swift
Normal file
@@ -0,0 +1,68 @@
|
||||
import SwiftUI
|
||||
import ProxyCore
|
||||
|
||||
struct HeaderEditorSheet: View {
|
||||
@State var headers: [(key: String, value: String)]
|
||||
let onSave: ([(key: String, value: String)]) -> Void
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
List {
|
||||
ForEach(headers.indices, id: \.self) { index in
|
||||
HStack(spacing: 8) {
|
||||
TextField("Header", text: Binding(
|
||||
get: { headers[index].key },
|
||||
set: { headers[index].key = $0 }
|
||||
))
|
||||
.textInputAutocapitalization(.never)
|
||||
.autocorrectionDisabled()
|
||||
.font(.subheadline)
|
||||
|
||||
TextField("Value", text: Binding(
|
||||
get: { headers[index].value },
|
||||
set: { headers[index].value = $0 }
|
||||
))
|
||||
.textInputAutocapitalization(.never)
|
||||
.autocorrectionDisabled()
|
||||
.font(.subheadline)
|
||||
}
|
||||
}
|
||||
.onDelete { indexSet in
|
||||
headers.remove(atOffsets: indexSet)
|
||||
}
|
||||
|
||||
Menu {
|
||||
ForEach(ProxyConstants.commonHeaders, id: \.self) { header in
|
||||
Button(header) {
|
||||
headers.append((key: header, value: ""))
|
||||
}
|
||||
}
|
||||
Divider()
|
||||
Button("Custom Header") {
|
||||
headers.append((key: "", value: ""))
|
||||
}
|
||||
} label: {
|
||||
Label("Add Header", systemImage: "plus.circle.fill")
|
||||
}
|
||||
}
|
||||
.navigationTitle("Edit Headers")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .topBarLeading) {
|
||||
Button("Cancel") {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
ToolbarItem(placement: .topBarTrailing) {
|
||||
Button("Done") {
|
||||
let filtered = headers.filter { !$0.key.isEmpty }
|
||||
onSave(filtered)
|
||||
dismiss()
|
||||
}
|
||||
.fontWeight(.semibold)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user