mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +00:00
warning fixes
This commit is contained in:
parent
fe2f30ed73
commit
e9a1ce0555
11 changed files with 92 additions and 81 deletions
|
|
@ -136,7 +136,8 @@ final class EventSource: NSObject {
|
|||
}
|
||||
|
||||
// Dispatch event
|
||||
logger.debug("🎯 Dispatching event - type: \(event.event ?? "default"), data: \(event.data ?? "none")")
|
||||
logger
|
||||
.debug("🎯 Dispatching event - type: \(event.event ?? "default"), data: \(event.data ?? "none")")
|
||||
DispatchQueue.main.async {
|
||||
self.onMessage?(event)
|
||||
}
|
||||
|
|
@ -228,7 +229,7 @@ extension EventSource: URLSessionDataDelegate {
|
|||
// Check if data might be compressed
|
||||
if data.count > 2 {
|
||||
let header = [UInt8](data.prefix(2))
|
||||
if header[0] == 0x1f && header[1] == 0x8b {
|
||||
if header[0] == 0x1F && header[1] == 0x8B {
|
||||
logger.error("❌ Received gzip compressed data! SSE should not be compressed.")
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -423,7 +423,6 @@ final class NotificationService: NSObject {
|
|||
// This prevents dual-path connection attempts
|
||||
}
|
||||
|
||||
|
||||
private func connect() {
|
||||
logger.info("🔌 NotificationService.connect() called - isConnected: \(self.isConnected)")
|
||||
guard !isConnected else {
|
||||
|
|
@ -434,7 +433,8 @@ final class NotificationService: NSObject {
|
|||
// When auth mode is "none", we can connect without a token.
|
||||
// In any other auth mode, a token is required for the local Mac app to connect.
|
||||
if serverManager.authMode != "none", serverManager.localAuthToken == nil {
|
||||
logger.error("No auth token available for notification service in auth mode '\(self.serverManager.authMode)'")
|
||||
logger
|
||||
.error("No auth token available for notification service in auth mode '\(self.serverManager.authMode)'")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -489,7 +489,10 @@ final class NotificationService: NSObject {
|
|||
|
||||
eventSource?.onMessage = { [weak self] event in
|
||||
Task { @MainActor in
|
||||
self?.logger.info("🎯 EventSource onMessage fired! Event type: \(event.event ?? "default"), Has data: \(event.data != nil)")
|
||||
self?.logger
|
||||
.info(
|
||||
"🎯 EventSource onMessage fired! Event type: \(event.event ?? "default"), Has data: \(event.data != nil)"
|
||||
)
|
||||
self?.handleEvent(event)
|
||||
}
|
||||
}
|
||||
|
|
@ -733,7 +736,7 @@ final class NotificationService: NSObject {
|
|||
let content = UNMutableNotificationContent()
|
||||
content.title = title
|
||||
content.body = body
|
||||
if let message = message {
|
||||
if let message {
|
||||
content.subtitle = message
|
||||
}
|
||||
content.sound = getNotificationSound()
|
||||
|
|
@ -821,7 +824,10 @@ final class NotificationService: NSObject {
|
|||
}
|
||||
|
||||
// Log server info
|
||||
logger.info("Server info - Port: \(self.serverManager.port), Running: \(self.serverManager.isRunning), SSE Connected: \(self.isConnected)")
|
||||
logger
|
||||
.info(
|
||||
"Server info - Port: \(self.serverManager.port), Running: \(self.serverManager.isRunning), SSE Connected: \(self.isConnected)"
|
||||
)
|
||||
|
||||
guard let url = serverManager.buildURL(endpoint: "/api/test-notification") else {
|
||||
logger.error("❌ Failed to build test notification URL")
|
||||
|
|
@ -870,4 +876,3 @@ final class NotificationService: NSObject {
|
|||
// NotificationCenter observers are automatically removed on deinit in modern Swift
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ final class SessionMonitor {
|
|||
private func fetchSessions() async {
|
||||
do {
|
||||
// Snapshot previous sessions for exit notifications
|
||||
let _ = sessions
|
||||
_ = sessions
|
||||
|
||||
let sessionsArray = try await serverManager.performRequest(
|
||||
endpoint: APIEndpoints.sessions,
|
||||
|
|
|
|||
|
|
@ -74,11 +74,13 @@ final class TailscaleServeStatusService {
|
|||
|
||||
let decoder = JSONDecoder()
|
||||
// Use custom date decoder to handle ISO8601 with fractional seconds
|
||||
let formatter = ISO8601DateFormatter()
|
||||
formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
|
||||
decoder.dateDecodingStrategy = .custom { decoder in
|
||||
let container = try decoder.singleValueContainer()
|
||||
let dateString = try container.decode(String.self)
|
||||
|
||||
// Create formatter inside the closure to avoid Sendable warning
|
||||
let formatter = ISO8601DateFormatter()
|
||||
formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
|
||||
if let date = formatter.date(from: dateString) {
|
||||
return date
|
||||
}
|
||||
|
|
@ -87,7 +89,10 @@ final class TailscaleServeStatusService {
|
|||
if let date = formatter.date(from: dateString) {
|
||||
return date
|
||||
}
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "Cannot decode date string \(dateString)")
|
||||
throw DecodingError.dataCorruptedError(
|
||||
in: container,
|
||||
debugDescription: "Cannot decode date string \(dateString)"
|
||||
)
|
||||
}
|
||||
|
||||
let status = try decoder.decode(TailscaleServeStatus.self, from: data)
|
||||
|
|
@ -98,7 +103,6 @@ final class TailscaleServeStatusService {
|
|||
startTime = status.startTime
|
||||
|
||||
logger.debug("Tailscale Serve status - Running: \(status.isRunning), Error: \(status.lastError ?? "none")")
|
||||
|
||||
} catch {
|
||||
logger.error("Failed to fetch Tailscale Serve status: \(error.localizedDescription)")
|
||||
// On error, assume not running
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import SwiftUI
|
||||
import AppKit
|
||||
import os.log
|
||||
import SwiftUI
|
||||
|
||||
/// Authentication configuration section for remote access settings
|
||||
struct AuthenticationSection: View {
|
||||
|
|
|
|||
|
|
@ -80,7 +80,8 @@ struct NotificationSettingsView: View {
|
|||
}
|
||||
.help(sseConnectionStatus
|
||||
? "Real-time notification stream is connected"
|
||||
: "Real-time notification stream is disconnected. Check if the server is running.")
|
||||
: "Real-time notification stream is disconnected. Check if the server is running."
|
||||
)
|
||||
|
||||
// Show warning when disconnected
|
||||
if showNotifications && !sseConnectionStatus {
|
||||
|
|
|
|||
|
|
@ -94,7 +94,8 @@ struct RemoteAccessSettingsView: View {
|
|||
onAppearSetup()
|
||||
updateLocalIPAddress()
|
||||
// Initialize authentication mode from stored value
|
||||
let storedMode = UserDefaults.standard.string(forKey: AppConstants.UserDefaultsKeys.authenticationMode) ?? "os"
|
||||
let storedMode = UserDefaults.standard
|
||||
.string(forKey: AppConstants.UserDefaultsKeys.authenticationMode) ?? "os"
|
||||
authMode = AuthenticationMode(rawValue: storedMode) ?? .osAuth
|
||||
// Start monitoring Tailscale Serve status
|
||||
tailscaleServeStatus.startMonitoring()
|
||||
|
|
@ -628,7 +629,6 @@ private struct ErrorView: View {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Previews
|
||||
|
||||
#Preview("Remote Access Settings") {
|
||||
|
|
|
|||
Loading…
Reference in a new issue