wip
This commit is contained in:
parent
cb1bc1c8aa
commit
86594fb663
10 changed files with 507 additions and 81 deletions
|
|
@ -1,9 +1,29 @@
|
|||
import AuthenticationServices
|
||||
import SwiftUI
|
||||
|
||||
#if !os(macOS)
|
||||
struct BurrowView: View {
|
||||
@Environment(\.webAuthenticationSession)
|
||||
private var webAuthenticationSession
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
VStack {
|
||||
HStack {
|
||||
Text("Networks")
|
||||
.font(.largeTitle)
|
||||
.fontWeight(.bold)
|
||||
Spacer()
|
||||
Menu {
|
||||
Button("Hack Club", action: addHackClubNetwork)
|
||||
Button("WireGuard", action: addWireGuardNetwork)
|
||||
} label: {
|
||||
Image(systemName: "plus.circle.fill")
|
||||
.font(.title)
|
||||
.accessibilityLabel("Add")
|
||||
}
|
||||
}
|
||||
.padding(.top)
|
||||
NetworkCarouselView()
|
||||
Spacer()
|
||||
TunnelStatusView()
|
||||
|
|
@ -11,9 +31,31 @@ struct BurrowView: View {
|
|||
.padding(.bottom)
|
||||
}
|
||||
.padding()
|
||||
.navigationTitle("Networks")
|
||||
}
|
||||
}
|
||||
|
||||
private func addHackClubNetwork() {
|
||||
guard
|
||||
let issuerURL = URL(string: "https://slack.com"),
|
||||
let redirectURI = URL(string: "https://burrow.rs/callback/oauth2") else { return }
|
||||
Task {
|
||||
do {
|
||||
let session = try await OpenID.Session(
|
||||
issuerURL: issuerURL,
|
||||
redirectURI: redirectURI,
|
||||
scopes: ["openid", "profile"],
|
||||
clientID: "2210535565.6884042183125"
|
||||
)
|
||||
let response = try await session.authorize(webAuthenticationSession)
|
||||
} catch {
|
||||
print(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func addWireGuardNetwork() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
|
@ -24,3 +66,4 @@ struct NetworkView_Previews: PreviewProvider {
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue