@impro.social/impro-plugin 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main.js +45 -1
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -147,6 +147,17 @@ class PluginData {
|
|
|
147
147
|
getProfile(did) {
|
|
148
148
|
return hostCall("getProfile", { did });
|
|
149
149
|
}
|
|
150
|
+
// Like getProfile, but includes viewer relationship details not present
|
|
151
|
+
// on the basic profile view: viewer.following, viewer.followedBy, and
|
|
152
|
+
// viewer.knownFollowers (a summary of mutual followers).
|
|
153
|
+
getDetailedProfile(did) {
|
|
154
|
+
return hostCall("getDetailedProfile", { did });
|
|
155
|
+
}
|
|
156
|
+
// The full known-followers list for did (the summary on
|
|
157
|
+
// getDetailedProfile's viewer.knownFollowers is capped to a handful).
|
|
158
|
+
getKnownFollowers(did) {
|
|
159
|
+
return hostCall("getKnownFollowers", { did });
|
|
160
|
+
}
|
|
150
161
|
getRecord(repo, collection, rkey) {
|
|
151
162
|
return hostCall("getRecord", { repo, collection, rkey });
|
|
152
163
|
}
|
|
@@ -164,6 +175,32 @@ class App {
|
|
|
164
175
|
refreshFeedFilters(feedURI = null) {
|
|
165
176
|
return hostCall("refreshFeedFilters", feedURI);
|
|
166
177
|
}
|
|
178
|
+
|
|
179
|
+
// Actions on behalf of the signed-in user. Each method requires the
|
|
180
|
+
// corresponding scope ("mute", "block", "feedFeedback") to be declared in
|
|
181
|
+
// the plugin manifest's `permissions.actions` array, which the user must
|
|
182
|
+
// grant at install time.
|
|
183
|
+
muteActor(did) {
|
|
184
|
+
return hostCall("muteActor", { did, mute: true });
|
|
185
|
+
}
|
|
186
|
+
unmuteActor(did) {
|
|
187
|
+
return hostCall("muteActor", { did, mute: false });
|
|
188
|
+
}
|
|
189
|
+
blockActor(did) {
|
|
190
|
+
return hostCall("blockActor", { did, block: true });
|
|
191
|
+
}
|
|
192
|
+
unblockActor(did) {
|
|
193
|
+
return hostCall("blockActor", { did, block: false });
|
|
194
|
+
}
|
|
195
|
+
// Acts like the user clicking "Show less like this": sends the requestLess
|
|
196
|
+
// feedback signal to the feed that served the post and collapses the post
|
|
197
|
+
// behind a feedback message in feeds.
|
|
198
|
+
showLessLikeThis(postUri, feedUri) {
|
|
199
|
+
return hostCall("showLessLikeThis", { postUri, feedUri });
|
|
200
|
+
}
|
|
201
|
+
showMoreLikeThis(postUri, feedUri) {
|
|
202
|
+
return hostCall("showMoreLikeThis", { postUri, feedUri });
|
|
203
|
+
}
|
|
167
204
|
}
|
|
168
205
|
|
|
169
206
|
export async function fetch(url, init = {}) {
|
|
@@ -316,7 +353,10 @@ export class Plugin {
|
|
|
316
353
|
// callback(tokens, context) receives the rich-text token stream for one
|
|
317
354
|
// post and returns a new token array (or the input unchanged). The host
|
|
318
355
|
// batches all posts of a render into one call per plugin.
|
|
319
|
-
|
|
356
|
+
//
|
|
357
|
+
// options.handlesFacetTypes: array of facet feature $type strings this
|
|
358
|
+
// transform owns, to prevent render flash of fallback text
|
|
359
|
+
registerRichTextTransform(callback = (tokens) => tokens, options = {}) {
|
|
320
360
|
const handlerId = uuid.create();
|
|
321
361
|
callHandlers.set(handlerId, async (batch) => {
|
|
322
362
|
const results = [];
|
|
@@ -330,10 +370,14 @@ export class Plugin {
|
|
|
330
370
|
}
|
|
331
371
|
return results;
|
|
332
372
|
});
|
|
373
|
+
const handlesFacetTypes = Array.isArray(options.handlesFacetTypes)
|
|
374
|
+
? options.handlesFacetTypes.filter((type) => typeof type === "string")
|
|
375
|
+
: [];
|
|
333
376
|
self.postMessage({
|
|
334
377
|
type: "register",
|
|
335
378
|
target: "richTextTransform",
|
|
336
379
|
handlerId,
|
|
380
|
+
handlesFacetTypes,
|
|
337
381
|
});
|
|
338
382
|
}
|
|
339
383
|
|