mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-20 13:45:54 +00:00
linting
This commit is contained in:
parent
971e1f1b11
commit
15eea702ab
4 changed files with 20 additions and 23 deletions
|
|
@ -192,7 +192,7 @@ final class AuthenticationService: ObservableObject {
|
|||
|
||||
/// Get token for query parameters (used for SSE)
|
||||
func getTokenForQuery() -> String? {
|
||||
return authToken
|
||||
authToken
|
||||
}
|
||||
|
||||
// MARK: - Private Methods
|
||||
|
|
@ -203,7 +203,6 @@ final class AuthenticationService: ObservableObject {
|
|||
let userDataJson = try? KeychainService.loadPassword(for: userDataKey),
|
||||
let userDataData = userDataJson.data(using: .utf8),
|
||||
let userData = try? JSONDecoder().decode(UserData.self, from: userDataData) {
|
||||
|
||||
// Check if token is less than 24 hours old
|
||||
let tokenAge = Date().timeIntervalSince(userData.loginTime)
|
||||
if tokenAge < 24 * 60 * 60 { // 24 hours
|
||||
|
|
@ -231,10 +230,10 @@ final class AuthenticationService: ObservableObject {
|
|||
|
||||
extension APIError {
|
||||
static func authenticationFailed(_ message: String) -> APIError {
|
||||
return APIError.serverError(500, message)
|
||||
APIError.serverError(500, message)
|
||||
}
|
||||
|
||||
static var dataEncodingFailed: APIError {
|
||||
return APIError.serverError(500, "Failed to encode authentication data")
|
||||
APIError.serverError(500, "Failed to encode authentication data")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,12 +98,11 @@ struct ConnectionView: View {
|
|||
LoginView(
|
||||
isPresented: $viewModel.showLoginView,
|
||||
serverConfig: config,
|
||||
authenticationService: authService,
|
||||
onSuccess: {
|
||||
authenticationService: authService
|
||||
) {
|
||||
// Authentication successful, mark as connected
|
||||
connectionManager.isConnected = true
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,9 +217,8 @@ struct LoginView_Previews: PreviewProvider {
|
|||
authenticationService: AuthenticationService(
|
||||
apiClient: APIClient.shared,
|
||||
serverConfig: ServerConfig(host: "localhost", port: 3000)
|
||||
),
|
||||
onSuccess: {}
|
||||
)
|
||||
)
|
||||
) {}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,29 +6,29 @@ extension Process {
|
|||
func configureForParentTermination() {
|
||||
// Set quality of service to tie lifecycle to parent
|
||||
self.qualityOfService = .userInitiated
|
||||
|
||||
|
||||
// On macOS, we can use process groups to ensure child termination
|
||||
// When the parent dies, all processes in the same process group receive SIGHUP
|
||||
#if os(macOS)
|
||||
// This will be called just before the process launches
|
||||
// We'll use posix_spawn attributes to set up the process group
|
||||
if #available(macOS 10.15, *) {
|
||||
// Modern approach: let the system handle it
|
||||
// NSTask/Process on modern macOS automatically handles parent death
|
||||
// when qualityOfService is set
|
||||
}
|
||||
// This will be called just before the process launches
|
||||
// We'll use posix_spawn attributes to set up the process group
|
||||
if #available(macOS 10.15, *) {
|
||||
// Modern approach: let the system handle it
|
||||
// NSTask/Process on modern macOS automatically handles parent death
|
||||
// when qualityOfService is set
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/// Enhanced run method that ensures proper process group setup
|
||||
func runWithParentTermination() throws {
|
||||
configureForParentTermination()
|
||||
try run()
|
||||
}
|
||||
|
||||
|
||||
/// Async version of runWithParentTermination
|
||||
func runWithParentTerminationAsync() async throws {
|
||||
configureForParentTermination()
|
||||
try await runAsync()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue