make webpush enabled check better

Because Continuwuity sends a VAPID even when webpush is disabled.
This commit is contained in:
Henry Hiles 2026-12-02 13:50:34 -05:00
commit 9d495410f6
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -10,6 +10,14 @@ class const Capabilities({
@JsonKey(name: "org.matrix.msc4174.webpush") final WebPush? webpush,
@JsonKey(name: "m.room_versions") final RoomVersions? roomVersions,
}) with _$Capabilities {
/// The VAPID key to register Web Push pushers with, or null if the
/// homeserver can't send Web Push. Continuwuity sends a key even when the
/// feature is disabled, so `enabled` must be checked too.
String? get webPushVapid => switch (webpush) {
WebPush(enabled: true, :final vapid) => vapid,
_ => null,
};
Map<String, Object?> toJson() => _$CapabilitiesToJson(this);
factory Capabilities.fromJson(Map<String, Object?> json) =>