Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions HomeAssistant.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
1104FD06253292CD00B8BE34 /* Guarantee+Additions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1104FD04253292CD00B8BE34 /* Guarantee+Additions.swift */; };
1105CE1C272B9CB300F33BD8 /* ServerManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1105CE1B272B9CB300F33BD8 /* ServerManager.swift */; };
1105CE1D272B9CB300F33BD8 /* ServerManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1105CE1B272B9CB300F33BD8 /* ServerManager.swift */; };
42C95E822F7EDAAA00112233 /* ServerManagerPersistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42C95E812F7EDAAA00112233 /* ServerManagerPersistence.swift */; };
42C95E832F7EDAAA00112233 /* ServerManagerPersistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42C95E812F7EDAAA00112233 /* ServerManagerPersistence.swift */; };
42C95E852F7EDB1000112233 /* ServerManagerMirrorStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42C95E842F7EDB1000112233 /* ServerManagerMirrorStore.swift */; };
42C95E862F7EDB1000112233 /* ServerManagerMirrorStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42C95E842F7EDB1000112233 /* ServerManagerMirrorStore.swift */; };
1108BC4325A2FB5A006B3C83 /* MacBridgeAppDelegateHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1108BC4225A2FB5A006B3C83 /* MacBridgeAppDelegateHandler.swift */; };
1109F81F24A1C011002590F2 /* SensorProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1109F81E24A1C011002590F2 /* SensorProvider.swift */; };
1109F82024A1C011002590F2 /* SensorProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1109F81E24A1C011002590F2 /* SensorProvider.swift */; };
Expand Down Expand Up @@ -839,6 +843,8 @@
42790C472C4809DD00E31B38 /* UIScreen+PerfectCornerRadius.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42BE698E2C46D37800745ECA /* UIScreen+PerfectCornerRadius.swift */; };
4279407F2B8369EC001D7E14 /* AppIntentVocabulary.plist in Resources */ = {isa = PBXBuildFile; fileRef = 42805A142B0226050095414C /* AppIntentVocabulary.plist */; };
427940812B836A1A001D7E14 /* AppIntentVocabulary.plist in Resources */ = {isa = PBXBuildFile; fileRef = 42805A142B0226050095414C /* AppIntentVocabulary.plist */; };
427A21772F7EA57600BD40B7 /* ServerInfoMirrorTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 427A21762F7EA57600BD40B7 /* ServerInfoMirrorTable.swift */; };
427A21782F7EA57600BD40B7 /* ServerInfoMirrorTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 427A21762F7EA57600BD40B7 /* ServerInfoMirrorTable.swift */; };
427A7CD92EBDFB1700D17841 /* AppArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 427A7CD82EBDFB1700D17841 /* AppArea.swift */; };
427A7CDA2EBDFB1700D17841 /* AppArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 427A7CD82EBDFB1700D17841 /* AppArea.swift */; };
427A7CDC2EBDFB1D00D17841 /* AppAreaTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 427A7CDB2EBDFB1D00D17841 /* AppAreaTable.swift */; };
Expand Down Expand Up @@ -1867,6 +1873,8 @@
1104FCCE253275CF00B8BE34 /* WatchBackgroundRefreshScheduler.test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchBackgroundRefreshScheduler.test.swift; sourceTree = "<group>"; };
1104FD04253292CD00B8BE34 /* Guarantee+Additions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Guarantee+Additions.swift"; sourceTree = "<group>"; };
1105CE1B272B9CB300F33BD8 /* ServerManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerManager.swift; sourceTree = "<group>"; };
42C95E812F7EDAAA00112233 /* ServerManagerPersistence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerManagerPersistence.swift; sourceTree = "<group>"; };
42C95E842F7EDB1000112233 /* ServerManagerMirrorStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerManagerMirrorStore.swift; sourceTree = "<group>"; };
1108BC4225A2FB5A006B3C83 /* MacBridgeAppDelegateHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MacBridgeAppDelegateHandler.swift; sourceTree = "<group>"; };
1109B6BA25263EEE005D51C2 /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/Intents.strings; sourceTree = "<group>"; };
1109B6BC25263EEF005D51C2 /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/InfoPlist.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2547,6 +2555,7 @@
42790C432C48077200E31B38 /* ImprovSuccessView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImprovSuccessView.swift; sourceTree = "<group>"; };
42790C452C4808FA00E31B38 /* AppleLikeBottomSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleLikeBottomSheet.swift; sourceTree = "<group>"; };
4279407E2B8369EA001D7E14 /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = bg; path = bg.lproj/AppIntentVocabulary.plist; sourceTree = "<group>"; };
427A21762F7EA57600BD40B7 /* ServerInfoMirrorTable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerInfoMirrorTable.swift; sourceTree = "<group>"; };
427A7CD82EBDFB1700D17841 /* AppArea.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppArea.swift; sourceTree = "<group>"; };
427A7CDB2EBDFB1D00D17841 /* AppAreaTable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppAreaTable.swift; sourceTree = "<group>"; };
427A7CDE2EBDFB4200D17841 /* AppArea+Queries.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AppArea+Queries.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4724,6 +4733,7 @@
420CFC622D3F9C1F009A94F3 /* Tables */ = {
isa = PBXGroup;
children = (
427A21762F7EA57600BD40B7 /* ServerInfoMirrorTable.swift */,
420CFC632D3F9C2C009A94F3 /* HAppEntityTable.swift */,
420CFC832D3FECF6009A94F3 /* CustomWidgetTable.swift */,
420CFC672D3F9C40009A94F3 /* WatchConfigTable.swift */,
Expand Down Expand Up @@ -7083,6 +7093,8 @@
D05A4D31216DD206009FD1EB /* MJPEGStreamer.swift */,
11195F6C267EFC15003DF674 /* HACancellable+App.swift */,
1105CE1B272B9CB300F33BD8 /* ServerManager.swift */,
42C95E812F7EDAAA00112233 /* ServerManagerPersistence.swift */,
42C95E842F7EDB1000112233 /* ServerManagerMirrorStore.swift */,
11CFD78027364F450082D557 /* Identifier.swift */,
11CFD783273662DF0082D557 /* Server.swift */,
1120C57E274638330046C38B /* PerServerContainer.swift */,
Expand Down Expand Up @@ -9784,6 +9796,7 @@
119DE934263325C20099F7D8 /* IconDrawable+Settings.swift in Sources */,
42FF5E972E22E5C100BDF5EF /* TodoListItem.swift in Sources */,
114CBAE92839E49E00A9BAFF /* CustomServerTrustManager.swift in Sources */,
427A21782F7EA57600BD40B7 /* ServerInfoMirrorTable.swift in Sources */,
4251AABE2C6CE242004CCC9D /* MagicItemProvider.swift in Sources */,
42D3E4BE2C5D31E000444BE6 /* LocalNotificationDispatcher.swift in Sources */,
420AE9E12CA559FE0020E9CB /* Color+hex.swift in Sources */,
Expand Down Expand Up @@ -9911,6 +9924,8 @@
B67CE8A622200F220034C1D0 /* HAAPI.swift in Sources */,
42B2637E2E16A1DC0042DF10 /* BaseColors.swift in Sources */,
1105CE1D272B9CB300F33BD8 /* ServerManager.swift in Sources */,
42C95E832F7EDAAA00112233 /* ServerManagerPersistence.swift in Sources */,
42C95E862F7EDB1000112233 /* ServerManagerMirrorStore.swift in Sources */,
42D334272D105990008D8E78 /* AppPanel.swift in Sources */,
1141182724AF9A0500E6525C /* WebhookManager.swift in Sources */,
1104FC9225322C1800B8BE34 /* Dictionary+Additions.swift in Sources */,
Expand Down Expand Up @@ -9966,6 +9981,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
427A21772F7EA57600BD40B7 /* ServerInfoMirrorTable.swift in Sources */,
42462E722DA4114800ECC8A7 /* Sizes.swift in Sources */,
118F046924CB895A00CBBD5C /* UIColor+CSS3+Hex.swift in Sources */,
1109F81F24A1C011002590F2 /* SensorProvider.swift in Sources */,
Expand Down Expand Up @@ -10257,6 +10273,8 @@
11EE9B5424C62EB300404AF8 /* RealmScene.swift in Sources */,
11F2F26E25871D8200F61F7C /* NotificationAttachmentParserURL.swift in Sources */,
1105CE1C272B9CB300F33BD8 /* ServerManager.swift in Sources */,
42C95E822F7EDAAA00112233 /* ServerManagerPersistence.swift in Sources */,
42C95E852F7EDB1000112233 /* ServerManagerMirrorStore.swift in Sources */,
D0EEF322214DE56B00D1D360 /* LocationTrigger.swift in Sources */,
422368902D40FCDE005911E4 /* CustomWidget.swift in Sources */,
D0B25BD62133128800678C2C /* UNNotificationContent+ClientEvent.swift in Sources */,
Expand Down
25 changes: 25 additions & 0 deletions Sources/Shared/API/Server.swift
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,31 @@ public struct ServerInfo: Codable, Equatable {
}
}

extension ServerInfo {
// Used in the GRDB mirror so recovered servers have an explicit "no credentials"
// state instead of accidentally persisting real auth tokens outside Keychain.
static var mirrorPlaceholderToken: TokenInfo {
.init(accessToken: "", refreshToken: "", expiration: .distantPast)
}

// Webhook-based features must stay disabled for mirrored servers because the
// webhook path itself is effectively a credential.
static var mirrorPlaceholderWebhookID: String { "" }

var mirroredForPersistence: ServerInfo {
// Start from the full server info, then remove secrets before writing to GRDB.
var info = self
// The GRDB mirror is only for recovering non-secret server metadata if Keychain
// entries disappear during the developer-account migration.
info.token = Self.mirrorPlaceholderToken
info.connection.cloudhookURL = nil
info.connection.webhookID = Self.mirrorPlaceholderWebhookID
info.connection.webhookSecret = nil
info.connection.clientCertificate = nil
return info
}
}

public final class Server: Hashable, Comparable, CustomStringConvertible {
public static let historicId: Identifier<Server> = "historic"

Expand Down
Loading
Loading