Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 08db74f397 | |||
| 9be8d41c94 | |||
| d978c51fbd | |||
| b8f80932ed |
@@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 26.1.9
|
||||||
|
- Reduced idle CPU usage and energy impact by changing the interval indicator from a permanent 60 FPS timer to a 1-second update cadence.
|
||||||
|
- Reset the interval indicator cleanly when the refresh interval changes or when the indicator is hidden.
|
||||||
|
|
||||||
|
## 26.1.8
|
||||||
|
- Fixed a crash in `PingService` caused by concurrent mutation of shared ping state from multiple async ping tasks.
|
||||||
|
- Moved ping state tracking and reboot suppression windows into an actor so ping success/failure handling is serialized safely.
|
||||||
|
|
||||||
## 26.1.7
|
## 26.1.7
|
||||||
- Added remote reboot support for hosts running KeyHelp API 2.14 or newer.
|
- Added remote reboot support for hosts running KeyHelp API 2.14 or newer.
|
||||||
- Added a dedicated `APIv2_14` client and mapped 2.14+ hosts to it instead of treating them as API 2.13.
|
- Added a dedicated `APIv2_14` client and mapped 2.14+ hosts to it instead of treating them as API 2.13.
|
||||||
|
|||||||
@@ -2,18 +2,15 @@ import Foundation
|
|||||||
import UserNotifications
|
import UserNotifications
|
||||||
|
|
||||||
enum PingService {
|
enum PingService {
|
||||||
private static var previousPingStates: [String: Bool] = [:]
|
private static let stateStore = PingStateStore()
|
||||||
private static var suppressedUntil: [String: Date] = [:]
|
|
||||||
|
|
||||||
static func suppressChecks(for hostname: String, duration: TimeInterval) {
|
static func suppressChecks(for hostname: String, duration: TimeInterval) async {
|
||||||
suppressedUntil[hostname] = Date().addingTimeInterval(duration)
|
await stateStore.suppressChecks(for: hostname, duration: duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
static func ping(hostname: String, apiKey: String, notificationsEnabled: Bool = true) async -> Bool {
|
static func ping(hostname: String, apiKey: String, notificationsEnabled: Bool = true) async -> Bool {
|
||||||
if let suppressedUntil = suppressedUntil[hostname], suppressedUntil > Date() {
|
if await stateStore.shouldSkipPing(for: hostname) {
|
||||||
return false
|
return false
|
||||||
} else {
|
|
||||||
suppressedUntil.removeValue(forKey: hostname)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let url = URL(string: "https://\(hostname)/api/v2/ping") else {
|
guard let url = URL(string: "https://\(hostname)/api/v2/ping") else {
|
||||||
@@ -29,38 +26,32 @@ enum PingService {
|
|||||||
do {
|
do {
|
||||||
let (data, response) = try await URLSession.shared.data(for: request)
|
let (data, response) = try await URLSession.shared.data(for: request)
|
||||||
if let httpResponse = response as? HTTPURLResponse, httpResponse.statusCode != 200 {
|
if let httpResponse = response as? HTTPURLResponse, httpResponse.statusCode != 200 {
|
||||||
handlePingFailure(for: hostname, notificationsEnabled: notificationsEnabled)
|
await handlePingFailure(for: hostname, notificationsEnabled: notificationsEnabled)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if let result = try? JSONDecoder().decode([String: String].self, from: data), result["response"] == "pong" {
|
if let result = try? JSONDecoder().decode([String: String].self, from: data), result["response"] == "pong" {
|
||||||
handlePingSuccess(for: hostname, notificationsEnabled: notificationsEnabled)
|
await handlePingSuccess(for: hostname, notificationsEnabled: notificationsEnabled)
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
handlePingFailure(for: hostname, notificationsEnabled: notificationsEnabled)
|
await handlePingFailure(for: hostname, notificationsEnabled: notificationsEnabled)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
handlePingFailure(for: hostname, notificationsEnabled: notificationsEnabled)
|
await handlePingFailure(for: hostname, notificationsEnabled: notificationsEnabled)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func handlePingSuccess(for hostname: String, notificationsEnabled: Bool) {
|
private static func handlePingSuccess(for hostname: String, notificationsEnabled: Bool) async {
|
||||||
let wasPreviouslyDown = previousPingStates[hostname] == false
|
if let notification = await stateStore.recordSuccess(for: hostname, notificationsEnabled: notificationsEnabled) {
|
||||||
previousPingStates[hostname] = true
|
sendNotification(title: notification.title, body: notification.body)
|
||||||
|
|
||||||
if wasPreviouslyDown && notificationsEnabled {
|
|
||||||
sendNotification(title: "Server Online", body: "\(hostname) is now online")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func handlePingFailure(for hostname: String, notificationsEnabled: Bool) {
|
private static func handlePingFailure(for hostname: String, notificationsEnabled: Bool) async {
|
||||||
let wasPreviouslyUp = previousPingStates[hostname] != false
|
if let notification = await stateStore.recordFailure(for: hostname, notificationsEnabled: notificationsEnabled) {
|
||||||
previousPingStates[hostname] = false
|
sendNotification(title: notification.title, body: notification.body)
|
||||||
|
|
||||||
if wasPreviouslyUp && notificationsEnabled {
|
|
||||||
sendNotification(title: "Server Offline", body: "\(hostname) is offline")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,3 +65,55 @@ enum PingService {
|
|||||||
UNUserNotificationCenter.current().add(request)
|
UNUserNotificationCenter.current().add(request)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private actor PingStateStore {
|
||||||
|
private var previousPingStates: [String: Bool] = [:]
|
||||||
|
private var suppressedUntil: [String: Date] = [:]
|
||||||
|
|
||||||
|
func suppressChecks(for hostname: String, duration: TimeInterval) {
|
||||||
|
suppressedUntil[hostname] = Date().addingTimeInterval(duration)
|
||||||
|
previousPingStates[hostname] = false
|
||||||
|
}
|
||||||
|
|
||||||
|
func shouldSkipPing(for hostname: String) -> Bool {
|
||||||
|
if let suppressedUntil = suppressedUntil[hostname], suppressedUntil > Date() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
suppressedUntil.removeValue(forKey: hostname)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func recordSuccess(for hostname: String, notificationsEnabled: Bool) -> PingNotification? {
|
||||||
|
let wasPreviouslyDown = previousPingStates[hostname] == false
|
||||||
|
previousPingStates[hostname] = true
|
||||||
|
|
||||||
|
guard wasPreviouslyDown, notificationsEnabled else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return PingNotification(
|
||||||
|
title: "Server Online",
|
||||||
|
body: "\(hostname) is now online"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func recordFailure(for hostname: String, notificationsEnabled: Bool) -> PingNotification? {
|
||||||
|
let wasPreviouslyUp = previousPingStates[hostname] != false
|
||||||
|
previousPingStates[hostname] = false
|
||||||
|
|
||||||
|
guard wasPreviouslyUp, notificationsEnabled else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return PingNotification(
|
||||||
|
title: "Server Offline",
|
||||||
|
body: "\(hostname) is offline"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private struct PingNotification {
|
||||||
|
let title: String
|
||||||
|
let body: String
|
||||||
|
}
|
||||||
|
|||||||
@@ -381,14 +381,14 @@ struct MainView: View {
|
|||||||
api = try await APIFactory.detectAndCreateAPI(baseURL: baseURL, apiKey: apiKey)
|
api = try await APIFactory.detectAndCreateAPI(baseURL: baseURL, apiKey: apiKey)
|
||||||
}
|
}
|
||||||
try await api.restartServer(apiKey: apiKey)
|
try await api.restartServer(apiKey: apiKey)
|
||||||
PingService.suppressChecks(for: server.hostname, duration: 90)
|
await PingService.suppressChecks(for: server.hostname, duration: 90)
|
||||||
|
|
||||||
return ServerActionFeedback(
|
return ServerActionFeedback(
|
||||||
title: "Reboot Requested",
|
title: "Reboot Requested",
|
||||||
message: "The reboot command was sent to \(server.hostname). The host may become unavailable briefly while it restarts."
|
message: "The reboot command was sent to \(server.hostname). The host may become unavailable briefly while it restarts."
|
||||||
)
|
)
|
||||||
} catch let error as URLError where Self.isExpectedRestartDisconnect(error) {
|
} catch let error as URLError where Self.isExpectedRestartDisconnect(error) {
|
||||||
PingService.suppressChecks(for: server.hostname, duration: 90)
|
await PingService.suppressChecks(for: server.hostname, duration: 90)
|
||||||
return ServerActionFeedback(
|
return ServerActionFeedback(
|
||||||
title: "Reboot Requested",
|
title: "Reboot Requested",
|
||||||
message: "The reboot command appears to have been accepted by \(server.hostname). The connection dropped while the host was going away, which is expected during a reboot."
|
message: "The reboot command appears to have been accepted by \(server.hostname). The connection dropped while the host was going away, which is expected during a reboot."
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ struct ServerDetailView: View {
|
|||||||
@State private var progress: Double = 0
|
@State private var progress: Double = 0
|
||||||
@State private var showRestartSheet = false
|
@State private var showRestartSheet = false
|
||||||
@State private var restartFeedback: ServerActionFeedback?
|
@State private var restartFeedback: ServerActionFeedback?
|
||||||
let timer = Timer.publish(every: 1.0 / 60.0, on: .main, in: .common).autoconnect()
|
private let indicatorTimer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
@@ -85,13 +85,21 @@ struct ServerDetailView: View {
|
|||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onReceive(timer) { _ in
|
.onReceive(indicatorTimer) { _ in
|
||||||
guard showIntervalIndicator else { return }
|
guard showIntervalIndicator else { return }
|
||||||
withAnimation(.linear(duration: 1.0 / 60.0)) {
|
withAnimation(.linear(duration: 1)) {
|
||||||
progress += 1.0 / (Double(refreshInterval) * 60.0)
|
progress += 1.0 / Double(refreshInterval)
|
||||||
if progress >= 1 { progress = 0 }
|
if progress >= 1 { progress = 0 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.onChange(of: refreshInterval) { _, _ in
|
||||||
|
progress = 0
|
||||||
|
}
|
||||||
|
.onChange(of: showIntervalIndicator) { _, isVisible in
|
||||||
|
if !isVisible {
|
||||||
|
progress = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
.sheet(isPresented: $showRestartSheet) {
|
.sheet(isPresented: $showRestartSheet) {
|
||||||
RestartConfirmationSheet(
|
RestartConfirmationSheet(
|
||||||
hostname: server.hostname,
|
hostname: server.hostname,
|
||||||
|
|||||||
32
Sparkle/appcast.xml
vendored
32
Sparkle/appcast.xml
vendored
@@ -2,6 +2,22 @@
|
|||||||
<rss xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" version="2.0">
|
<rss xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" version="2.0">
|
||||||
<channel>
|
<channel>
|
||||||
<title>iKeyMon</title>
|
<title>iKeyMon</title>
|
||||||
|
<item>
|
||||||
|
<title>26.1.9</title>
|
||||||
|
<pubDate>Sun, 19 Apr 2026 23:04:07 +0200</pubDate>
|
||||||
|
<sparkle:version>181</sparkle:version>
|
||||||
|
<sparkle:shortVersionString>26.1.9</sparkle:shortVersionString>
|
||||||
|
<sparkle:minimumSystemVersion>15.2</sparkle:minimumSystemVersion>
|
||||||
|
<enclosure url="https://git.24unix.net/tracer/iKeyMon/releases/download/v26.1.9/iKeyMon-26.1.9.zip" length="3109488" type="application/octet-stream" sparkle:edSignature="ZV96uUMdYC/X90H3G10FMzmZHKUEWpe1geSe/5IBJ7EOCUmx7Mz352i6VMWumFnCtDD4jHo173W9eySUX9KvDA=="/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<title>26.1.8</title>
|
||||||
|
<pubDate>Sun, 19 Apr 2026 22:50:15 +0200</pubDate>
|
||||||
|
<sparkle:version>179</sparkle:version>
|
||||||
|
<sparkle:shortVersionString>26.1.8</sparkle:shortVersionString>
|
||||||
|
<sparkle:minimumSystemVersion>15.2</sparkle:minimumSystemVersion>
|
||||||
|
<enclosure url="https://git.24unix.net/tracer/iKeyMon/releases/download/v26.1.8/iKeyMon-26.1.8.zip" length="3108005" type="application/octet-stream" sparkle:edSignature="OyoweSuRk5kusKUlqKQudZjrHkw5UPrLkix+ccpKphO1en2XdtQZa61hnA6HwcHM302jb+YlvN8n9f2Zkr9GBg=="/>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<title>26.1.7</title>
|
<title>26.1.7</title>
|
||||||
<pubDate>Sun, 19 Apr 2026 16:54:42 +0200</pubDate>
|
<pubDate>Sun, 19 Apr 2026 16:54:42 +0200</pubDate>
|
||||||
@@ -10,21 +26,5 @@
|
|||||||
<sparkle:minimumSystemVersion>15.2</sparkle:minimumSystemVersion>
|
<sparkle:minimumSystemVersion>15.2</sparkle:minimumSystemVersion>
|
||||||
<enclosure url="https://git.24unix.net/tracer/iKeyMon/releases/download/v26.1.7/iKeyMon-26.1.7.zip" length="3106520" type="application/octet-stream" sparkle:edSignature="xuNlxCsTtVgroriFU7fphcfHxAEC8cpd6tHnHMXknJ2jvKm27ShQMqjSW2jdqNAz0a0kNtPM8HwTL+e6nvUyCQ=="/>
|
<enclosure url="https://git.24unix.net/tracer/iKeyMon/releases/download/v26.1.7/iKeyMon-26.1.7.zip" length="3106520" type="application/octet-stream" sparkle:edSignature="xuNlxCsTtVgroriFU7fphcfHxAEC8cpd6tHnHMXknJ2jvKm27ShQMqjSW2jdqNAz0a0kNtPM8HwTL+e6nvUyCQ=="/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<title>26.1.6</title>
|
|
||||||
<pubDate>Sun, 19 Apr 2026 15:26:19 +0200</pubDate>
|
|
||||||
<sparkle:version>175</sparkle:version>
|
|
||||||
<sparkle:shortVersionString>26.1.6</sparkle:shortVersionString>
|
|
||||||
<sparkle:minimumSystemVersion>15.2</sparkle:minimumSystemVersion>
|
|
||||||
<enclosure url="https://git.24unix.net/tracer/iKeyMon/releases/download/v26.1.6/iKeyMon-26.1.6.zip" length="3063130" type="application/octet-stream" sparkle:edSignature="QPy3zm31ZTXE9grlj7Ul6kEG2t0veODEBjJ/qADM8A88lLJ8V9L4WhNnD8wmM7Urh1O6eZKl1qrCLTk0oo3WBA=="/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<title>26.1.5</title>
|
|
||||||
<pubDate>Sun, 19 Apr 2026 12:09:33 +0200</pubDate>
|
|
||||||
<sparkle:version>173</sparkle:version>
|
|
||||||
<sparkle:shortVersionString>26.1.5</sparkle:shortVersionString>
|
|
||||||
<sparkle:minimumSystemVersion>15.2</sparkle:minimumSystemVersion>
|
|
||||||
<enclosure url="https://git.24unix.net/tracer/iKeyMon/releases/download/v26.1.5/iKeyMon-26.1.5.zip" length="3065231" type="application/octet-stream" sparkle:edSignature="HVV7iZ4eyJC1VMh2q4GUoAESZnk4HoFU00QlA9qM4X4dJAT5oBEVB55m4wuF4u9iVFAeohkB0vleLlV39mxrBA=="/>
|
|
||||||
</item>
|
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
@@ -322,7 +322,7 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = iKeyMon.entitlements;
|
CODE_SIGN_ENTITLEMENTS = iKeyMon.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 177;
|
CURRENT_PROJECT_VERSION = 181;
|
||||||
DEVELOPMENT_ASSET_PATHS = "\"Preview Content\"";
|
DEVELOPMENT_ASSET_PATHS = "\"Preview Content\"";
|
||||||
DEVELOPMENT_TEAM = Q5486ZVAFT;
|
DEVELOPMENT_TEAM = Q5486ZVAFT;
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
@@ -337,7 +337,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 26.1.7;
|
MARKETING_VERSION = 26.1.9;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = net.24unix.iKeyMon;
|
PRODUCT_BUNDLE_IDENTIFIER = net.24unix.iKeyMon;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
@@ -353,7 +353,7 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = iKeyMon.entitlements;
|
CODE_SIGN_ENTITLEMENTS = iKeyMon.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 177;
|
CURRENT_PROJECT_VERSION = 181;
|
||||||
DEVELOPMENT_ASSET_PATHS = "\"Preview Content\"";
|
DEVELOPMENT_ASSET_PATHS = "\"Preview Content\"";
|
||||||
DEVELOPMENT_TEAM = Q5486ZVAFT;
|
DEVELOPMENT_TEAM = Q5486ZVAFT;
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
@@ -368,7 +368,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 26.1.7;
|
MARKETING_VERSION = 26.1.9;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = net.24unix.iKeyMon;
|
PRODUCT_BUNDLE_IDENTIFIER = net.24unix.iKeyMon;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"marketing_version": "26.1.7"
|
"marketing_version": "26.1.9"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user