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

Commitdf5447f

Browse files
committed
feat: add start vpn on launch setting
1 parent2094e9f commitdf5447f

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

‎Coder Desktop/Coder Desktop/Coder_DesktopApp.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
5555
ifawait !vpn.loadNetworkExtensionConfig(){
5656
state.reconfigure()
5757
}
58+
if state.startVPNOnLaunch{
59+
await vpn.start()
60+
}
5861
}
5962
}
6063

‎Coder Desktop/Coder Desktop/State.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ class AppState: ObservableObject {
5353
}
5454
}
5555

56+
@PublishedvarstartVPNOnLaunch:Bool=UserDefaults.standard.bool(forKey:Keys.startVPNOnLaunch){
57+
didSet{
58+
guard persistentelse{return}
59+
UserDefaults.standard.set(startVPNOnLaunch, forKey:Keys.startVPNOnLaunch)
60+
}
61+
}
62+
5663
func tunnelProviderProtocol()->NETunnelProviderProtocol?{
5764
if !hasSession{returnnil}
5865
letproto=NETunnelProviderProtocol()
@@ -132,6 +139,7 @@ class AppState: ObservableObject {
132139
staticletuseLiteralHeaders="UseLiteralHeaders"
133140
staticletliteralHeaders="LiteralHeaders"
134141
staticletstopVPNOnQuit="StopVPNOnQuit"
142+
staticletstartVPNOnLaunch="StartVPNOnLaunch"
135143
}
136144
}
137145

‎Coder Desktop/Coder Desktop/Views/Settings/GeneralTab.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@ struct GeneralTab: View {
66
varbody:someView{
77
Form{
88
Section{
9-
LaunchAtLogin.Toggle("Launch atLogin")
9+
LaunchAtLogin.Toggle("Launch atlogin")
1010
}
1111
Section{
1212
Toggle(isOn: $state.stopVPNOnQuit){
13-
Text("Stop Coder Connect on Quit")
13+
Text("Stop Coder Connect on quit")
14+
}
15+
}
16+
Section{
17+
Toggle(isOn: $state.startVPNOnLaunch){
18+
Text("Start Coder Connect on launch")
1419
}
1520
}
1621
}.formStyle(.grouped)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp