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

Commit4c892a6

Browse files
committed
also check at login
1 parent48c893c commit4c892a6

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

‎Coder Desktop/Coder Desktop/Views/LoginForm.swift‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import CoderSDK
22
import SwiftUI
3+
import VPNLib
34

45
structLoginForm:View{
56
@EnvironmentObjectvarstate:AppState
@@ -78,6 +79,22 @@ struct LoginForm: View {
7879
loginError=.failedAuth(error)
7980
return
8081
}
82+
letbuildInfo:BuildInfoResponse
83+
do{
84+
buildInfo=tryawait client.buildInfo()
85+
}catch{
86+
loginError=.failedAuth(error)
87+
return
88+
}
89+
guardlet semver= buildInfo.semverelse{
90+
loginError=.missingServerVersion
91+
return
92+
}
93+
// x.compare(y) is .orderedDescending if x > y
94+
guardSignatureValidator.minimumCoderVersion.compare(semver, options:.numeric)!=.orderedDescendingelse{
95+
loginError=.outdatedCoderVersion
96+
return
97+
}
8198
state.login(baseAccessURL: url, sessionToken: sessionToken)
8299
dismiss()
83100
}
@@ -190,6 +207,8 @@ enum LoginError: Error {
190207
case httpsRequired
191208
case noHost
192209
case invalidURL
210+
case outdatedCoderVersion
211+
case missingServerVersion
193212
case failedAuth(ClientError)
194213

195214
vardescription:String{
@@ -200,8 +219,15 @@ enum LoginError: Error {
200219
"URL must have a host"
201220
case.invalidURL:
202221
"Invalid URL"
222+
case.outdatedCoderVersion:
223+
"""
224+
The Coder deployment must be version\(SignatureValidator.minimumCoderVersion)
225+
or higher to use Coder Desktop.
226+
"""
203227
caselet.failedAuth(err):
204228
"Could not authenticate with Coder deployment:\n\(err.localizedDescription)"
229+
case.missingServerVersion:
230+
"Coder deployment did not provide a server version"
205231
}
206232
}
207233

‎Coder Desktop/VPNLib/Download.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public enum ValidationError: Error {
4343

4444
publicclassSignatureValidator{
4545
// Whilst older dylibs exist, this app assumes v2.20 or later.
46-
staticletminimumCoderVersion="2.20.0"
46+
publicstaticletminimumCoderVersion="2.20.0"
4747

4848
privatestaticletexpectedName="CoderVPN"
4949
privatestaticletexpectedIdentifier="com.coder.Coder-Desktop.VPN.dylib"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp