diff --git a/Tusker/API/InstanceFeatures.swift b/Tusker/API/InstanceFeatures.swift index 902093b0..20532507 100644 --- a/Tusker/API/InstanceFeatures.swift +++ b/Tusker/API/InstanceFeatures.swift @@ -8,6 +8,7 @@ import Foundation import Pachyderm +import Sentry struct InstanceFeatures { private static let pleromaVersionRegex = try! NSRegularExpression(pattern: "\\(compatible; pleroma (.*)\\)", options: .caseInsensitive) @@ -136,6 +137,8 @@ struct InstanceFeatures { } maxStatusChars = instance.maxStatusCharacters ?? 500 + + setInstanceBreadcrumb(instance: instance, nodeInfo: nodeInfo) } func hasMastodonVersion(_ major: Int, _ minor: Int, _ patch: Int) -> Bool { @@ -244,3 +247,19 @@ extension InstanceFeatures { } } } + +private func setInstanceBreadcrumb(instance: Instance, nodeInfo: NodeInfo?) { + let crumb = Breadcrumb(level: .info, category: "MastodonController") + crumb.data = [ + "instance": [ + "version": instance.version + ], + ] + if let nodeInfo { + crumb.data!["nodeInfo"] = [ + "version": nodeInfo.version, + "software": nodeInfo.software, + ] + } + SentrySDK.addBreadcrumb(crumb: crumb) +}