Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Threadcap helps you take and update snapshots of a public ActivityPub comment thread, given a root post url.
Threadcap helps you take and update snapshots of a public ActivityPub comment thread, given a root post url.
A Minipub subproject.
Carefully packaged so that it can be used from either newer-style ESM-based or older-style CommonJS-based Node projects.
Written using Deno, so also can be used without this NPM package at all (see Deno example below).
replies
property)See the API docs in threadcap.ts for now.
These are also used to generate TypeScript typings for this NPM package, so you'll get them as hover documentation in your IDE.
Installation:
npm install threadcap
npm install node-fetch # you'll need a fetch implementation
example.mjs
import { makeThreadcap, InMemoryCache, updateThreadcap, makeRateLimitedFetcher } from 'threadcap';
import fetch from 'node-fetch';
const userAgent = 'my-podcast-app/1.0';
const cache = new InMemoryCache();
const fetcher = makeRateLimitedFetcher(fetch); // respect any rate-limits defined by remote hosts
// initialize the threadcap
const threadcap = await makeThreadcap('https://example.social/users/alice/statuses/123456123456123456', { userAgent, cache, fetcher });
// update the threadcap, process all replies
const callbacks = {
onEvent: e => {
if (e.kind === 'node-processed' && e.part === 'comment') {
console.log(`Processed ${e.nodeId}`);
// threadcap is now updated with a new comment, update your UI incrementally
}
}
}
await updateThreadcap(threadcap, { updateTime: new Date().toISOString(), userAgent, cache, fetcher, callbacks });
// final threadcap includes the comment/commenter info for the root post and all replies
console.log(JSON.stringify(threadcap, undefined, 2));
Installation:
npm install threadcap
npm install node-fetch@2 # you'll need a commonjs-based fetch implementation
example.js
const { makeThreadcap, InMemoryCache, updateThreadcap, makeRateLimitedFetcher } = require('threadcap');
const fetch = require('node-fetch');
async function run() {
const userAgent = 'my-podcast-app/1.0';
const cache = new InMemoryCache();
const fetcher = makeRateLimitedFetcher(fetch); // respect any rate-limits defined by remote hosts
// initialize the threadcap
const threadcap = await makeThreadcap('https://example.social/users/alice/statuses/123456123456123456', { userAgent, cache, fetcher });
// update the threadcap, process all replies
const callbacks = {
onEvent: e => {
if (e.kind === 'node-processed' && e.part === 'comment') {
console.log(`Processed ${e.nodeId}`);
// threadcap is now updated with a new comment, update your UI incrementally
}
}
}
await updateThreadcap(threadcap, { updateTime: new Date().toISOString(), userAgent, cache, fetcher, callbacks });
// final threadcap includes the comment/commenter info for the root post and all replies
console.log(JSON.stringify(threadcap, undefined, 2));
}
run(); // no top-level await when using CommonJS
You don't need this NPM package or to install anything, just remote-import threadcap.ts
from the source repo
example.ts
import { makeThreadcap, InMemoryCache, updateThreadcap, makeRateLimitedFetcher, Callbacks } from 'https://raw.githubusercontent.com/skymethod/minipub/v0.1.1/src/threadcap/threadcap.ts';
const userAgent = 'my-podcast-app/1.0';
const cache = new InMemoryCache();
const fetcher = makeRateLimitedFetcher(fetch); // respect any rate-limits defined by remote hosts
// initialize the threadcap
const threadcap = await makeThreadcap('https://example.social/users/alice/statuses/123456123456123456', { userAgent, cache, fetcher });
// update the threadcap, process all replies
const callbacks: Callbacks = {
onEvent: e => {
if (e.kind === 'node-processed' && e.part === 'comment') {
console.log(`Processed ${e.nodeId}`);
// threadcap is now updated with a new comment, update your UI incrementally
}
}
}
await updateThreadcap(threadcap, { updateTime: new Date().toISOString(), userAgent, cache, fetcher, callbacks });
// final threadcap includes the comment/commenter info for the root post and all replies
console.log(JSON.stringify(threadcap, undefined, 2));
FAQs
Threadcap helps you take and update snapshots of a public ActivityPub comment thread, given a root post url.
The npm package threadcap receives a total of 3 weekly downloads. As such, threadcap popularity was classified as not popular.
We found that threadcap demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.