forked from shadowfacts/Tusker
Detect gotosocial and calckey instances
This commit is contained in:
parent
48bd957276
commit
bac272a2db
|
@ -120,8 +120,11 @@ public class InstanceFeatures: ObservableObject {
|
||||||
|
|
||||||
public func update(instance: Instance, nodeInfo: NodeInfo?) {
|
public func update(instance: Instance, nodeInfo: NodeInfo?) {
|
||||||
let ver = instance.version.lowercased()
|
let ver = instance.version.lowercased()
|
||||||
|
// check glitch first b/c it still reports "mastodon" as the software in nodeinfo
|
||||||
if ver.contains("glitch") {
|
if ver.contains("glitch") {
|
||||||
instanceType = .mastodon(.glitch, Version(string: ver))
|
instanceType = .mastodon(.glitch, Version(string: ver))
|
||||||
|
} else if nodeInfo?.software.name == "mastodon" {
|
||||||
|
instanceType = .mastodon(.vanilla, Version(string: ver))
|
||||||
} else if nodeInfo?.software.name == "hometown" {
|
} else if nodeInfo?.software.name == "hometown" {
|
||||||
var mastoVersion: Version?
|
var mastoVersion: Version?
|
||||||
var hometownVersion: Version?
|
var hometownVersion: Version?
|
||||||
|
@ -157,6 +160,10 @@ public class InstanceFeatures: ObservableObject {
|
||||||
instanceType = .pleroma(.akkoma(akkomaVersion))
|
instanceType = .pleroma(.akkoma(akkomaVersion))
|
||||||
} else if ver.contains("pixelfed") {
|
} else if ver.contains("pixelfed") {
|
||||||
instanceType = .pixelfed
|
instanceType = .pixelfed
|
||||||
|
} else if nodeInfo?.software.name == "gotosocial" {
|
||||||
|
instanceType = .gotosocial
|
||||||
|
} else if ver.contains("calckey") {
|
||||||
|
instanceType = .calckey(nodeInfo?.software.version)
|
||||||
} else {
|
} else {
|
||||||
instanceType = .mastodon(.vanilla, Version(string: ver))
|
instanceType = .mastodon(.vanilla, Version(string: ver))
|
||||||
}
|
}
|
||||||
|
@ -194,6 +201,8 @@ extension InstanceFeatures {
|
||||||
case mastodon(MastodonType, Version?)
|
case mastodon(MastodonType, Version?)
|
||||||
case pleroma(PleromaType)
|
case pleroma(PleromaType)
|
||||||
case pixelfed
|
case pixelfed
|
||||||
|
case gotosocial
|
||||||
|
case calckey(String?)
|
||||||
|
|
||||||
var isMastodon: Bool {
|
var isMastodon: Bool {
|
||||||
if case .mastodon(_, _) = self {
|
if case .mastodon(_, _) = self {
|
||||||
|
|
|
@ -149,6 +149,13 @@ private func captureError(_ error: Client.Error, in mastodonController: Mastodon
|
||||||
}
|
}
|
||||||
case .pixelfed:
|
case .pixelfed:
|
||||||
event.tags!["instance_type"] = "pixelfed"
|
event.tags!["instance_type"] = "pixelfed"
|
||||||
|
case .gotosocial:
|
||||||
|
event.tags!["instance_type"] = "gotosocial"
|
||||||
|
case .calckey(let calckeyVersion):
|
||||||
|
event.tags!["instance_type"] = "calckey"
|
||||||
|
if let calckeyVersion {
|
||||||
|
event.tags!["calckey_version"] = calckeyVersion
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SentrySDK.capture(event: event)
|
SentrySDK.capture(event: event)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue