Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: make helper launchdaemon approval mandatory#205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ethanndickson merged 4 commits intomainfromethan/mandatory-helper
Aug 6, 2025
Merged
Show file tree
Hide file tree
Changes fromall 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
3 changes: 0 additions & 3 deletionsCoder-Desktop/Coder-Desktop/Coder_DesktopApp.swift
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,6 @@ struct DesktopApp: App {
SettingsView<CoderVPNService>()
.environmentObject(appDelegate.vpn)
.environmentObject(appDelegate.state)
.environmentObject(appDelegate.helper)
.environmentObject(appDelegate.autoUpdater)
}
.windowResizability(.contentSize)
Expand All@@ -48,13 +47,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
let fileSyncDaemon: MutagenDaemon
let urlHandler: URLHandler
let notifDelegate: NotifDelegate
let helper: HelperService
let autoUpdater: UpdaterService

override init() {
notifDelegate = NotifDelegate()
vpn = CoderVPNService()
helper = HelperService()
autoUpdater = UpdaterService()
let state = AppState(onChange: vpn.configureTunnelProviderProtocol)
vpn.onStart = {
Expand Down
117 changes: 0 additions & 117 deletionsCoder-Desktop/Coder-Desktop/HelperService.swift
View file
Open in desktop

This file was deleted.

View file
Open in desktop

This file was deleted.

View file
Open in desktop

This file was deleted.

6 changes: 0 additions & 6 deletionsCoder-Desktop/Coder-Desktop/Views/Settings/Settings.swift
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,11 +13,6 @@ struct SettingsView<VPN: VPNService>: View {
.tabItem {
Label("Network", systemImage: "dot.radiowaves.left.and.right")
}.tag(SettingsTab.network)
ExperimentalTab()
.tabItem {
Label("Experimental", systemImage: "gearshape.2")
}.tag(SettingsTab.experimental)

}.frame(width: 600)
.frame(maxHeight: 500)
.scrollContentBackground(.hidden)
Expand All@@ -28,5 +23,4 @@ struct SettingsView<VPN: VPNService>: View {
enum SettingsTab: Int {
case general
case network
case experimental
}
65 changes: 41 additions & 24 deletionsCoder-Desktop/Coder-Desktop/Views/VPN/VPNState.swift
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,20 +10,10 @@ struct VPNState<VPN: VPNService>: View {
Group {
switch (vpn.state, state.hasSession) {
case (.failed(.systemExtensionError(.needsUserApproval)), _):
VStack {
Text("Awaiting System Extension approval")
.foregroundColor(.secondary)
.multilineTextAlignment(.center)
.fixedSize(horizontal: false, vertical: true)
.padding(.horizontal, Theme.Size.trayInset)
.padding(.vertical, Theme.Size.trayPadding)
.frame(maxWidth: .infinity)
Button {
openSystemExtensionSettings()
} label: {
Text("Approve in System Settings")
}
}
ApprovalRequiredView(
message: "Awaiting System Extension approval",
action: openSystemExtensionSettings
)
case (_, false):
Text("Sign in to use Coder Desktop")
.font(.body)
Expand All@@ -32,11 +22,7 @@ struct VPNState<VPN: VPNService>: View {
VStack {
Text("The system VPN requires reconfiguration")
.foregroundColor(.secondary)
.multilineTextAlignment(.center)
.fixedSize(horizontal: false, vertical: true)
.padding(.horizontal, Theme.Size.trayInset)
.padding(.vertical, Theme.Size.trayPadding)
.frame(maxWidth: .infinity)
.vpnStateMessage()
Button {
state.reconfigure()
} label: {
Expand All@@ -61,15 +47,46 @@ struct VPNState<VPN: VPNService>: View {
Text("\(vpnErr.description)")
.font(.headline)
.foregroundColor(.red)
.multilineTextAlignment(.center)
.fixedSize(horizontal: false, vertical: true)
.padding(.horizontal, Theme.Size.trayInset)
.padding(.vertical, Theme.Size.trayPadding)
.frame(maxWidth: .infinity)
.vpnStateMessage()
case (.connected, true):
EmptyView()
}
}
.onReceive(inspection.notice) { inspection.visit(self, $0) } // viewInspector
}
}

struct ApprovalRequiredView: View {
let message: String
let action: () -> Void

var body: some View {
VStack {
Text(message)
.foregroundColor(.secondary)
.vpnStateMessage()
Button {
action()
} label: {
Text("Approve in System Settings")
}
}
}
}

struct VPNStateMessageTextModifier: ViewModifier {
func body(content: Content) -> some View {
content
.multilineTextAlignment(.center)
.fixedSize(horizontal: false, vertical: true)
.padding(.horizontal, Theme.Size.trayInset)
.padding(.vertical, Theme.Size.trayPadding)
.frame(maxWidth: .infinity)
}
}

extension View {
func vpnStateMessage() -> some View {
modifier(VPNStateMessageTextModifier())
}
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,8 +4,8 @@
<dict>
<key>Label</key>
<string>com.coder.Coder-Desktop.Helper</string>
<key>BundleProgram</key>
<string>Contents/MacOS/com.coder.Coder-Desktop.Helper</string>
<key>Program</key>
<string>/Applications/Coder Desktop.app/Contents/MacOS/com.coder.Coder-Desktop.Helper</string>
<key>MachServices</key>
<dict>
<!-- $(TeamIdentifierPrefix) isn't populated here, so this value is hardcoded -->
Expand Down
25 changes: 24 additions & 1 deletionCoder-Desktop/project.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -216,6 +216,29 @@ targets:
buildToolPlugins:
- plugin: SwiftLintBuildToolPlugin
package: SwiftLintPlugins
postBuildScripts:
# This is a dependency of the app, not the helper, as it copies the
# helper plist from the app bundle to the system store.
- name: "Upsert Helper for Local Development"
# Only run this script (and prompt for admin) when the helper or any of
# it's frameworks have changed.
inputFiles:
- "$(BUILT_PRODUCTS_DIR)/com.coder.Coder-Desktop.Helper"
- "$(BUILT_PRODUCTS_DIR)/CoderSDK.framework/Versions/A/CoderSDK"
- "$(BUILT_PRODUCTS_DIR)/VPNLib.framework/Versions/A/VPNLib"
outputFiles:
- "$(DERIVED_FILE_DIR)/upsert-helper.stamp"
script: |
if [ -n "${CI}" ]; then
# Skip in CI
exit 0
fi
/usr/bin/osascript <<'APPLESCRIPT'
do shell script "/bin/bash -c " & quoted form of ((system attribute "SRCROOT") & "/../scripts/upsert-dev-helper.sh") with administrator privileges
APPLESCRIPT
/usr/bin/touch "${DERIVED_FILE_DIR}/upsert-helper.stamp"
basedOnDependencyAnalysis: true
runOnlyWhenInstalling: false

Coder-DesktopTests:
type: bundle.unit-test
Expand DownExpand Up@@ -376,4 +399,4 @@ targets:
PRODUCT_BUNDLE_IDENTIFIER: "com.coder.Coder-Desktop.Helper"
PRODUCT_MODULE_NAME: "$(PRODUCT_NAME:c99extidentifier)"
PRODUCT_NAME: "$(PRODUCT_BUNDLE_IDENTIFIER)"
SKIP_INSTALL: YES
SKIP_INSTALL: YES
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp