Skip to content

Commit 382d200

Browse files
committed
Add bubble timeline support on Akkoma instances
1 parent 172801a commit 382d200

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

src/components/nav-menu.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ function NavMenu(props) {
349349
<Trans>Local</Trans>
350350
</span>
351351
</MenuLink>
352-
{supports("@mastodon/bubble-timeline") && (
352+
{(supports("@mastodon/bubble-timeline") ||
353+
supports("@akkoma/bubble-timeline")) && (
353354
<MenuLink to={`/${instance}/p/b`}>
354355
<Icon icon="star2" size="l" />{" "}
355356
<span>

src/locales/en.po

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils/supports.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,22 @@ const platformFeatures = {
3030
"@akkoma/local-visibility-post": containAkkoma,
3131
};
3232

33+
// Named features for which support is explicitly expressed by the instance
34+
const advertisedFeatures = {
35+
"@akkoma/bubble-timeline": "bubble_timeline",
36+
};
37+
3338
const supportsCache = {};
3439

3540
function supports(feature) {
3641
try {
37-
let { version, domain } = getCurrentInstance();
42+
let instanceData = getCurrentInstance();
43+
let version = instanceData.version;
44+
let domain = instanceData.domain;
45+
46+
// instanceData extension exclusive to Akkoma and Pleroma
47+
let pleroma = instanceData?.pleroma;
48+
3849
let softwareName = getCurrentNodeInfo()?.software?.name || "mastodon";
3950

4051
if (softwareName === "hometown") {
@@ -49,6 +60,13 @@ function supports(feature) {
4960
return (supportsCache[key] = platformFeatures[feature].test(version));
5061
}
5162

63+
// use Pleroma / Akkoma's advertised feature list to see if a given feature is supported
64+
if (pleroma) {
65+
return (supportsCache[key] = pleroma.metadata.features.includes(
66+
advertisedFeatures[feature],
67+
));
68+
}
69+
5270
const range = features[feature];
5371
if (!range) return false;
5472

0 commit comments

Comments
 (0)