diff --git a/src/API/Instance.vala b/src/API/Instance.vala index c7e90c64..5fad1cdd 100644 --- a/src/API/Instance.vala +++ b/src/API/Instance.vala @@ -17,7 +17,7 @@ public class Tuba.API.Instance : Entity { public Gee.ArrayList? rules { get; set; } public bool tuba_can_translate { get; set; default=false; } - public int8 tuba_mastodon_version { get; set; default=0; } + public API.InstanceV2.APIVersions tuba_api_versions { get; set; default= new API.InstanceV2.APIVersions (); } public override Type deserialize_array_type (string prop) { switch (prop) { @@ -44,6 +44,8 @@ public class Tuba.API.Instance : Entity { get { if (pleroma != null && pleroma.metadata != null && pleroma.metadata.features != null) { return "bubble_timeline" in pleroma.metadata.features; + } else if (tuba_api_versions.chuckya > 0) { + return true; } return false; diff --git a/src/API/InstanceV2.vala b/src/API/InstanceV2.vala index 104602f9..04ce79a3 100644 --- a/src/API/InstanceV2.vala +++ b/src/API/InstanceV2.vala @@ -8,6 +8,7 @@ public class Tuba.API.InstanceV2 : Entity { public class APIVersions : Entity { public int8 mastodon { get; set; default = 0; } + public int8 chuckya { get; set; default = 0; } } public Configuration configuration { get; set; default = null; } diff --git a/src/Services/Accounts/InstanceAccount.vala b/src/Services/Accounts/InstanceAccount.vala index ba25b6f5..f80b7dc3 100644 --- a/src/Services/Accounts/InstanceAccount.vala +++ b/src/Services/Accounts/InstanceAccount.vala @@ -530,12 +530,14 @@ public class Tuba.InstanceAccount : API.Account, Streamable { this.instance_info.tuba_can_translate = instance_v2.configuration.translation.enabled; if (instance_v2.api_versions != null && instance_v2.api_versions.mastodon > 0) { - this.instance_info.tuba_mastodon_version = instance_v2.api_versions.mastodon; + this.instance_info.tuba_api_versions = instance_v2.api_versions; this.probably_has_notification_filters = true; - if (this.instance_info.tuba_mastodon_version > 1) gather_annual_report (); + if (this.instance_info.tuba_api_versions.mastodon > 1) gather_annual_report (); } } + + bump_sidebar_items (); }) .exec (); } @@ -557,7 +559,6 @@ public class Tuba.InstanceAccount : API.Account, Streamable { return; } - new Request.GET (@"/api/v1/annual_reports/$(year)") .with_account (accounts.active) .then ((in_stream) => { diff --git a/src/Views/Bubble.vala b/src/Views/Bubble.vala index fbb6b251..100db5b6 100644 --- a/src/Views/Bubble.vala +++ b/src/Views/Bubble.vala @@ -1,8 +1,16 @@ public class Tuba.Views.Bubble : Views.Timeline { construct { - url = "/api/v1/timelines/bubble"; + url = accounts.active.instance_info.tuba_api_versions.chuckya > 0 + ? "/api/v1/timelines/public?bubble=true&only_media=false" + : "/api/v1/timelines/bubble"; label = "Bubble"; // NOTE: Leave untranslated for now icon = "tuba-fish-symbolic"; is_public = true; } + + public override string? get_stream_url () { + return account != null && accounts.active.instance_info.tuba_api_versions.chuckya > 0 + ? @"$(account.instance)/api/v1/streaming?stream=public:bubble&access_token=$(account.access_token)" + : null; + } } diff --git a/src/Widgets/AccountSuggestions.vala b/src/Widgets/AccountSuggestions.vala index b543b884..ded23179 100644 --- a/src/Widgets/AccountSuggestions.vala +++ b/src/Widgets/AccountSuggestions.vala @@ -175,7 +175,9 @@ public class Tuba.Widgets.AccountSuggestions : Gtk.ListBoxRow { if (widgets.size > 0) { this.visible = true; populate_account_suggestions_relationships (widgets); - }; + } else { + this.visible = false; + } on_page_changed (); }) .on_error (() => { diff --git a/src/Widgets/PreviewCardExplore.vala b/src/Widgets/PreviewCardExplore.vala index c9845508..66f5404b 100644 --- a/src/Widgets/PreviewCardExplore.vala +++ b/src/Widgets/PreviewCardExplore.vala @@ -91,7 +91,7 @@ public class Tuba.Widgets.PreviewCardExplore : Gtk.ListBoxRow { css_classes = { "caption" } }; - if (accounts.active.instance_info.tuba_mastodon_version >= 1) { + if (accounts.active.instance_info.tuba_api_versions.mastodon >= 1) { Gtk.Button discussions_button = new Gtk.Button () { margin_top = 6, child = used_times_label, diff --git a/src/Widgets/ProfileCover.vala b/src/Widgets/ProfileCover.vala index e774a973..d8be64ea 100644 --- a/src/Widgets/ProfileCover.vala +++ b/src/Widgets/ProfileCover.vala @@ -277,7 +277,7 @@ protected class Tuba.Widgets.Cover : Gtk.Box { note_row.sensitive = false; } else if (!is_self) { moved_btn.clicked.connect (on_moved_btn_clicked); - if (accounts.active.instance_info != null && accounts.active.instance_info.tuba_mastodon_version > 0) { + if (accounts.active.instance_info != null && accounts.active.instance_info.tuba_api_versions.mastodon > 0) { GLib.Idle.add (populate_mutuals); } }