mirror of
https://github.com/SideStore/SideStore.git
synced 2026-03-27 21:05:39 +01:00
IfaceScanner: used the user specified IP to directly test if device is available there instead of assuming it to be under the subnet of tunnel coz it is fake endpoint interceptable by the tunnel's included routes
This commit is contained in:
@@ -15,8 +15,6 @@ struct VPNConfigurationView: View {
|
|||||||
@Environment(\.presentationMode) var presentationMode
|
@Environment(\.presentationMode) var presentationMode
|
||||||
@StateObject private var config = TunnelConfig.shared
|
@StateObject private var config = TunnelConfig.shared
|
||||||
|
|
||||||
@State private var showNetworkWarning = false
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
List {
|
List {
|
||||||
Section(header: Text("Discovered from network")) {
|
Section(header: Text("Discovered from network")) {
|
||||||
@@ -42,19 +40,10 @@ struct VPNConfigurationView: View {
|
|||||||
} footer: {
|
} footer: {
|
||||||
HStack(alignment: .top, spacing: 0) {
|
HStack(alignment: .top, spacing: 0) {
|
||||||
Text("Note: ")
|
Text("Note: ")
|
||||||
Text("if the override configuration is invalid or unusable SideStore may use auto-discovered configuration as fallback")
|
Text("if override configuration is invalid or unusable SideStore may use auto-discovered configuration as fallback")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.alert(isPresented: $showNetworkWarning) {
|
|
||||||
Alert(
|
|
||||||
title: Text("Warning"),
|
|
||||||
message: Text("Changing tunnel IP settings can disrupt your network connection. Proceed only if you are sure of what you are doing."),
|
|
||||||
dismissButton: .cancel(Text("I Understand")) {
|
|
||||||
config.shownTunnelAlert = true
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.navigationTitle("VPN Configuration")
|
.navigationTitle("VPN Configuration")
|
||||||
.toolbar {
|
.toolbar {
|
||||||
ToolbarItem(placement: .topBarTrailing) {
|
ToolbarItem(placement: .topBarTrailing) {
|
||||||
@@ -96,11 +85,6 @@ struct VPNConfigurationView: View {
|
|||||||
.keyboardType(.numbersAndPunctuation)
|
.keyboardType(.numbersAndPunctuation)
|
||||||
.onChange(of: proxy.wrappedValue) { newValue in
|
.onChange(of: proxy.wrappedValue) { newValue in
|
||||||
guard editable else { return }
|
guard editable else { return }
|
||||||
|
|
||||||
if !config.shownTunnelAlert {
|
|
||||||
showNetworkWarning = true
|
|
||||||
}
|
|
||||||
|
|
||||||
proxy.wrappedValue =
|
proxy.wrappedValue =
|
||||||
newValue.filter { "0123456789.".contains($0) }
|
newValue.filter { "0123456789.".contains($0) }
|
||||||
}
|
}
|
||||||
@@ -113,21 +97,25 @@ final class TunnelConfig: ObservableObject {
|
|||||||
|
|
||||||
static let shared = TunnelConfig()
|
static let shared = TunnelConfig()
|
||||||
|
|
||||||
|
private static let defaultOverrideIP: String = {
|
||||||
|
if #available(iOS 26.4, *) { return "192.168.1.50" }
|
||||||
|
return "10.7.0.1"
|
||||||
|
}()
|
||||||
|
|
||||||
@Published var deviceIP: String?
|
@Published var deviceIP: String?
|
||||||
@Published var subnetMask: String?
|
@Published var subnetMask: String?
|
||||||
@Published var fakeIP: String?
|
@Published var fakeIP: String?
|
||||||
@Published var overrideFakeIP: String = UserDefaults.standard.string(forKey: "TunnelOverrideFakeIP") ?? "10.7.0.1" {
|
@Published var overrideFakeIP: String = overrideIPStorage {
|
||||||
didSet { UserDefaults.standard.set(overrideFakeIP, forKey: "TunnelOverrideFakeIP") }
|
didSet { Self.overrideIPStorage = overrideFakeIP }
|
||||||
}
|
}
|
||||||
@Published var overrideEffective: Bool = false
|
@Published var overrideEffective: Bool = false
|
||||||
|
|
||||||
var overrideActive: String {
|
private static var overrideIPStorage: String {
|
||||||
((fakeIP?.isEmpty == false) && !overrideFakeIP.isEmpty && fakeIP == overrideFakeIP) ? "Yes" : "No"
|
get { UserDefaults.standard.string(forKey: "TunnelOverrideFakeIP") ?? defaultOverrideIP }
|
||||||
|
set { UserDefaults.standard.set(newValue, forKey: "TunnelOverrideFakeIP") }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Published var shownTunnelAlert: Bool = UserDefaults.standard.bool(forKey: "shownTunnelAlert") {
|
var overrideActive: String { overrideEffective ? "Yes" : "No" }
|
||||||
didSet { UserDefaults.standard.set(shownTunnelAlert, forKey: "shownTunnelAlert") }
|
|
||||||
}
|
|
||||||
|
|
||||||
func commitFakeIP() {
|
func commitFakeIP() {
|
||||||
fakeIP = overrideFakeIP
|
fakeIP = overrideFakeIP
|
||||||
|
|||||||
2
Dependencies/minimuxer
vendored
2
Dependencies/minimuxer
vendored
Submodule Dependencies/minimuxer updated: 2e6fc79f29...c9da68c3ff
Reference in New Issue
Block a user