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

Commitde63a7a

Browse files
feat: add start vpn on launch setting (#108)
Relates to#104.On-demand is a pretty big lift - in the meantime we'll add a 'start VPN on launch' config setting.
1 parent6947811 commitde63a7a

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
@@ -58,6 +58,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
5858
ifawait !vpn.loadNetworkExtensionConfig(){
5959
state.reconfigure()
6060
}
61+
if state.startVPNOnLaunch{
62+
await vpn.start()
63+
}
6164
}
6265
// TODO: Start the daemon only once a file sync is configured
6366
Task{

‎Coder-Desktop/Coder-Desktop/State.swift

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

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

‎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