Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions NodePass.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
CB1E98012E226C1E00A175FD /* DirectForwardDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB1E98002E226C0F00A175FD /* DirectForwardDetailView.swift */; };
CB1E98032E226C2D00A175FD /* TunnelForwardDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB1E98022E226C2300A175FD /* TunnelForwardDetailView.swift */; };
CB1E98052E2273E500A175FD /* CopiableModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB1E98042E2273DE00A175FD /* CopiableModifier.swift */; };
CB1F97C42F1F3DB30003E714 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = CB1F97C32F1F3DB30003E714 /* Localizable.xcstrings */; };
CB1F97C52F1F3DB30003E714 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = CB1F97C32F1F3DB30003E714 /* Localizable.xcstrings */; };
CB5E133F2E7BF81300870962 /* SingleMatrixGaugeStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB5E133E2E7BF80C00870962 /* SingleMatrixGaugeStyle.swift */; };
CB5E13412E7C007100870962 /* DoubleMatrixGaugeStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB5E13402E7C006D00870962 /* DoubleMatrixGaugeStyle.swift */; };
CB5E13492E7D42DB00870962 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB5E13482E7D42DB00870962 /* WidgetKit.framework */; };
Expand Down Expand Up @@ -174,7 +172,6 @@
CB1E98002E226C0F00A175FD /* DirectForwardDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DirectForwardDetailView.swift; sourceTree = "<group>"; };
CB1E98022E226C2300A175FD /* TunnelForwardDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TunnelForwardDetailView.swift; sourceTree = "<group>"; };
CB1E98042E2273DE00A175FD /* CopiableModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CopiableModifier.swift; sourceTree = "<group>"; };
CB1F97C32F1F3DB30003E714 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
CB5E133E2E7BF80C00870962 /* SingleMatrixGaugeStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SingleMatrixGaugeStyle.swift; sourceTree = "<group>"; };
CB5E13402E7C006D00870962 /* DoubleMatrixGaugeStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DoubleMatrixGaugeStyle.swift; sourceTree = "<group>"; };
CB5E13462E7D42DB00870962 /* Widget.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Widget.appex; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -523,7 +520,6 @@
CBD4336B2E111155002B153F /* Shared */ = {
isa = PBXGroup;
children = (
CB1F97C32F1F3DB30003E714 /* Localizable.xcstrings */,
CBD433712E111527002B153F /* NPCore.swift */,
CBD433722E11157B002B153F /* NPState.swift */,
CB62C0802E2B90B800919507 /* NPUI.swift */,
Expand Down Expand Up @@ -653,7 +649,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
CB1F97C42F1F3DB30003E714 /* Localizable.xcstrings in Resources */,
CB5E13542E7D42DC00870962 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -664,7 +659,6 @@
files = (
CB6682CA2E1899A100A27696 /* AppIcon.icon in Resources */,
CBD433632E10FA4D002B153F /* Assets.xcassets in Resources */,
CB1F97C52F1F3DB30003E714 /* Localizable.xcstrings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
6 changes: 3 additions & 3 deletions NodePass/Components/LabeledTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
import SwiftUI

struct LabeledTextField: View {
let title: LocalizedStringKey
let title: String
let prompt: String
var text: Binding<String>
let isNumberOnly: Bool

init(_ title: LocalizedStringKey, prompt: String, text: Binding<String>) {
init(_ title: String, prompt: String, text: Binding<String>) {
self.title = title
self.prompt = prompt
self.text = text
self.isNumberOnly = false
}

init(_ title: LocalizedStringKey, prompt: String, text: Binding<String>, isNumberOnly: Bool) {
init(_ title: String, prompt: String, text: Binding<String>, isNumberOnly: Bool) {
self.title = title
self.prompt = prompt
self.text = text
Expand Down
6 changes: 3 additions & 3 deletions NodePass/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ enum MainTab: String, CaseIterable {

var title: String {
switch self {
case .services: String(localized: "Services")
case .servers: String(localized: "Servers")
case .settings: String(localized: "Settings")
case .services: "Services"
case .servers: "Servers"
case .settings: "Settings"
}
}
}
Expand Down
47 changes: 24 additions & 23 deletions NodePass/Server/Instance/InstanceFormView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct InstanceFormView: View {
@State private var crtPath: String = ""
@State private var keyPath: String = ""
@State private var sni: String = ""
@State private var password: String = ""
@State private var connectionMode: ConnectionMode = .auto
@State private var connectionType: Instance.Transport = .tcp
@State private var minConnections: String = ""
Expand Down Expand Up @@ -86,8 +87,8 @@ struct InstanceFormView: View {
}

enum InputMode: String, CaseIterable {
case form = "Form"
case url = "URL"
case form = "Details"
case url = "Command"
}

enum InstanceType: String, CaseIterable {
Expand Down Expand Up @@ -117,25 +118,6 @@ struct InstanceFormView: View {
.foregroundStyle(.secondary)
}

Section {
Picker("Input Mode", selection: $inputMode) {
ForEach(InputMode.allCases, id: \.self) { mode in
Text(mode.rawValue).tag(mode)
}
}
.pickerStyle(.segmented)
} header: {
Text("Input Method")
} footer: {
if inputMode == .form {
Text("Configure instance using form fields.")
.foregroundStyle(.secondary)
} else {
Text("Enter instance URL directly.")
.foregroundStyle(.secondary)
}
}

if inputMode == .form {
formModeContent
} else {
Expand All @@ -158,6 +140,16 @@ struct InstanceFormView: View {
#endif
.navigationTitle(title)
.toolbar {
ToolbarItem(placement: .principal) {
Picker("Input Mode", selection: $inputMode) {
ForEach(InputMode.allCases, id: \.self) { mode in
Text(mode.rawValue).tag(mode)
}
}
.pickerStyle(.segmented)
.labelsHidden()
}

ToolbarItem(placement: .cancellationAction) {
if #available(iOS 26.0, macOS 26.0, *) {
Button(role: .cancel) {
Expand Down Expand Up @@ -354,6 +346,12 @@ struct InstanceFormView: View {
}

Section {
LabeledTextField("Password", prompt: "Optional", text: $password)
.autocorrectionDisabled()
#if os(iOS)
.textInputAutocapitalization(.never)
#endif

if instanceType == .server {
Picker("TLS Mode", selection: $tlsMode) {
ForEach(TLSMode.allCases, id: \.self) { mode in
Expand Down Expand Up @@ -577,6 +575,7 @@ struct InstanceFormView: View {

instanceType = url.hasPrefix("server://") ? .server : .client

password = urlComponents.user ?? ""
tunnelAddress = urlComponents.host ?? ""
tunnelPort = urlComponents.port.map { String($0) } ?? ""

Expand Down Expand Up @@ -727,10 +726,12 @@ struct InstanceFormView: View {
}

var url: String
let passwordPrefix = password.isEmpty ? "" : "\(password)@"

if instanceType == .server {
url = "server://\(tunnelAddr):\(tunnelPt)/\(targetPath)"
url = "server://\(passwordPrefix)\(tunnelAddr):\(tunnelPt)/\(targetPath)"
} else {
url = "client://\(tunnelAddr):\(tunnelPt)/\(targetPath)"
url = "client://\(passwordPrefix)\(tunnelAddr):\(tunnelPt)/\(targetPath)"
}

var queryParams: [String] = []
Expand Down
16 changes: 8 additions & 8 deletions NodePass/Server/ServerListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ fileprivate enum SortIndicator: String, CaseIterable {
var title: String {
switch(self) {
case .name:
return String(localized: "Name")
return "Name"
case .date:
return String(localized: "Date")
return "Date"
}
}
}
Expand All @@ -30,9 +30,9 @@ fileprivate enum SortOrder: String, CaseIterable {
var title: String {
switch(self) {
case .ascending:
return String(localized: "Ascending")
return "Ascending"
case .descending:
return String(localized: "Descending")
return "Descending"
}
}

Expand All @@ -41,16 +41,16 @@ fileprivate enum SortOrder: String, CaseIterable {
case .name:
switch(self) {
case .ascending:
return String(localized: "Ascending")
return "Ascending"
case .descending:
return String(localized: "Descending")
return "Descending"
}
case .date:
switch(self) {
case .ascending:
return String(localized: "Oldest to Newest")
return "Oldest to Newest"
case .descending:
return String(localized: "Newest to Oldest")
return "Newest to Oldest"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ struct AddDirectForwardServiceView: View {
type: .directForward,
implementations: [
Implementation(
name: String(localized: "\(name) Relay"),
name: "\(name) Relay",
type: .directForwardClient,
position: 0,
serverID: client?.id ?? "",
Expand Down Expand Up @@ -282,7 +282,7 @@ struct AddDirectForwardServiceView: View {
type: .directForward,
implementations: [
Implementation(
name: String(localized: "\(name) Relay"),
name: "\(name) Relay",
type: .directForwardClient,
position: 0,
serverID: client.id,
Expand All @@ -300,7 +300,7 @@ struct AddDirectForwardServiceView: View {
baseURLString: client.url,
apiKey: client.key,
id: clientInstance.id,
serviceAlias: String(localized: "\(name)"),
serviceAlias: "\(name)",
serviceId: serviceId.uuidString,
serviceType: "0"
)
Expand Down
12 changes: 6 additions & 6 deletions NodePass/Service/Add Service/AddNATPassthroughServiceView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ struct AddNATPassthroughServiceView: View {
type: .natPassthrough,
implementations: [
Implementation(
name: String(localized: "\(name) Remote"),
name: "\(name) Remote",
type: .natPassthroughServer,
position: 0,
serverID: remoteServer?.id ?? "",
Expand All @@ -261,7 +261,7 @@ struct AddNATPassthroughServiceView: View {
fullCommand: serverCommand
),
Implementation(
name: String(localized: "\(name) Local"),
name: "\(name) Local",
type: .natPassthroughClient,
position: 1,
serverID: localServer?.id ?? "",
Expand Down Expand Up @@ -416,7 +416,7 @@ struct AddNATPassthroughServiceView: View {
type: .natPassthrough,
implementations: [
Implementation(
name: String(localized: "\(name) Remote"),
name: "\(name) Remote",
type: .natPassthroughServer,
position: 0,
serverID: remoteServer.id,
Expand All @@ -425,7 +425,7 @@ struct AddNATPassthroughServiceView: View {
fullCommand: serverFullCommand
),
Implementation(
name: String(localized: "\(name) Local"),
name: "\(name) Local",
type: .natPassthroughClient,
position: 1,
serverID: localServer.id,
Expand All @@ -444,15 +444,15 @@ struct AddNATPassthroughServiceView: View {
baseURLString: remoteServer.url,
apiKey: remoteServer.key,
id: serverInstance.id,
serviceAlias: String(localized: "\(name)"),
serviceAlias: "\(name)",
serviceId: serviceId.uuidString,
serviceType: isExternalTarget ? "3" : "1"
)
async let updateClientInstancePeer: () = instanceService.updateInstancePeer(
baseURLString: localServer.url,
apiKey: localServer.key,
id: clientInstance.id,
serviceAlias: String(localized: "\(name)"),
serviceAlias: "\(name)",
serviceId: serviceId.uuidString,
serviceType: isExternalTarget ? "3" : "1"
)
Expand Down
12 changes: 6 additions & 6 deletions NodePass/Service/Add Service/AddTunnelForwardServiceView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ struct AddTunnelForwardServiceView: View {
type: .tunnelForward,
implementations: [
Implementation(
name: String(localized: "\(name) Relay"),
name: "\(name) Relay",
type: .tunnelForwardRelay,
position: 0,
serverID: relayServer?.id ?? "",
Expand All @@ -291,7 +291,7 @@ struct AddTunnelForwardServiceView: View {
fullCommand: relayServerCommand
),
Implementation(
name: String(localized: "\(name) Destination"),
name: "\(name) Destination",
type: .tunnelForwardDestination,
position: 1,
serverID: destinationServer?.id ?? "",
Expand Down Expand Up @@ -447,7 +447,7 @@ struct AddTunnelForwardServiceView: View {
type: .tunnelForward,
implementations: [
Implementation(
name: String(localized: "\(name) Relay"),
name: "\(name) Relay",
type: .tunnelForwardRelay,
position: 0,
serverID: relayServer.id,
Expand All @@ -456,7 +456,7 @@ struct AddTunnelForwardServiceView: View {
fullCommand: relayServerFullCommand
),
Implementation(
name: String(localized: "\(name) Destination"),
name: "\(name) Destination",
type: .tunnelForwardDestination,
position: 1,
serverID: destinationServer.id,
Expand All @@ -475,15 +475,15 @@ struct AddTunnelForwardServiceView: View {
baseURLString: relayServer.url,
apiKey: relayServer.key,
id: relayServerInstance.id,
serviceAlias: String(localized: "\(name)"),
serviceAlias: "\(name)",
serviceId: serviceId.uuidString,
serviceType: isExternalTarget ? "4" : "2"
)
async let updateDestinationServerInstancePeer: () = instanceService.updateInstancePeer(
baseURLString: destinationServer.url,
apiKey: destinationServer.key,
id: destinationServerInstance.id,
serviceAlias: String(localized: "\(name)"),
serviceAlias: "\(name)",
serviceId: serviceId.uuidString,
serviceType: isExternalTarget ? "4" : "2"
)
Expand Down
2 changes: 1 addition & 1 deletion NodePass/Service/Card/DirectForwardCardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct DirectForwardCardView: View {

HStack(alignment: .imageAlignment) {
let implementation = service.implementations!.first(where: { $0.position == 0 })!
let serverName = servers.first(where: { $0.id == implementation.serverID })?.name ?? String(localized: isPreview ? "Select" : "Unknown")
let serverName = servers.first(where: { $0.id == implementation.serverID })?.name ?? (isPreview ? "Select" : "Unknown")
let addressesAndPorts = NPCore.parseAddressesAndPorts(urlString: implementation.command)
Image(systemName: "laptopcomputer.and.iphone")
.font(.title)
Expand Down
6 changes: 3 additions & 3 deletions NodePass/Service/Card/NATPassthroughCardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct NATPassthroughCardView: View {
.alignmentGuide(.imageAlignment) { d in d[VerticalAlignment.center] }
Spacer()
VStack(spacing: 3) {
let serverName = servers.first(where: { $0.id == implementation0.serverID })?.name ?? String(localized: isPreview ? "Select" : "Unknown")
let serverName = servers.first(where: { $0.id == implementation0.serverID })?.name ?? (isPreview ? "Select" : "Unknown")
let addressesAndPorts = NPCore.parseAddressesAndPorts(urlString: implementation0.command)
Text(serverName)
.lineLimit(1)
Expand Down Expand Up @@ -95,7 +95,7 @@ struct NATPassthroughCardView: View {
let addressesAndPorts = NPCore.parseAddressesAndPorts(urlString: implementation1.command)
if addressesAndPorts.destination.address == "127.0.0.1" {
VStack(spacing: 3) {
let serverName = servers.first(where: { $0.id == implementation1.serverID })?.name ?? String(localized: isPreview ? "Select" : "Unknown")
let serverName = servers.first(where: { $0.id == implementation1.serverID })?.name ?? (isPreview ? "Select" : "Unknown")
let addressesAndPorts = NPCore.parseAddressesAndPorts(urlString: implementation1.command)
Text(serverName)
.lineLimit(1)
Expand All @@ -113,7 +113,7 @@ struct NATPassthroughCardView: View {
}
else {
VStack(spacing: 3) {
let serverName = servers.first(where: { $0.id == implementation1.serverID })?.name ?? String(localized: isPreview ? "Select" : "Unknown")
let serverName = servers.first(where: { $0.id == implementation1.serverID })?.name ?? (isPreview ? "Select" : "Unknown")
Text(serverName)
.lineLimit(1)
.minimumScaleFactor(0.5)
Expand Down
Loading