@@ -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+
3338const supportsCache = { } ;
3439
3540function 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