(id)
- returns a dynamic rendering of an identities avatar.
(id)
returns a dynamic rendering of an identities name that is also a link to their id.
just a wrapper around ssb-social-index
- name
- description
- image
- imageUrl
- names
- images
- color
- latestValue
- valueFrom
- socialValue
- groupedValues
- socialValues
truncates the feed id to 10 chars long.
wraps blobFiles(files, server, opts cb) method on ssb-blob-files
returns a html file input, and calls back to onAdded
when a file is selected by the user.
return an observable that resolves to true when the local sbot has the blob_id
no-op, just returns the id.
returns config
(id, cb)
- follow feed with key = id
(id, cb)
- unfollow feed with key = id
...
(id, cb)
- block feed with key = id
Note that blocking influences the observeable state of following, followers, blockers, blocking,
(id, cb)
- unblock feed with key = id
(id)
returns an observeable which resolves to an array of feeds that id
is following
(id)
returns an observeable which resolves to an array of feeds that follow id
(id)
returns an observeable which resolves to an array of feeds that id
is blocking
(id)
returns an observeable which resolves to an array of feeds that block id
returns the list of emoji-named-characters
returns the url for the image for a specific emoji name.
takes a createStream
function (that returns a stream of raw messages)
and it passes each one to message.html.render
returning a html element with the
dynamic output of that stream.
returns an observable of the most recent limit
(defaults to 50) messages.
returns an object containing observables about every aspect of a thread.
- messages
- lastId
- rootId
- branchId
- previousKey
- isPrivate
- channel
- recps
- sync - resolves to true once all the observables are loaded.
returns a source stream of a channel
returns a source stream of public messages, filtering out messages by blocked users.
similar to feed.pull.public
but for private messages. does not filter blocked users though.
acceps ssb-query style map-filter-reduce
queries.
returns a stream of messages by a particular user. an id
option must be provided.
returns a function that takes options and returns a stream of messages with the type property.
returns a through stream that takes messages or ids and filters out items that have already been through the stream.
returns a through stream that filters messages that have replies
returns a function that takes options and returns a stream of messages that mention message_id
returns a through stream that filters root messages (via user-provided root_filter
function) and adds repiles.
messages from blocked users are removed.
accept an invite code.
check wether you are already following the pub in the invite, and if not accept the invite.
return the keys to the main identity.
return the main identity
read the message from the database an cb a short teaser (say, the first 40 chars in the post) that can be used as the message name (in the worst case, the id is truncated to 10 chars)
publishes a message. wraps sbot.async.publish
returns an observable that resolves to the id of the auther, once the message has been retrived.
returns an observable that resolves to an array of metadata about messages that link to id
(except if they are type vote
or about
)
each item has the following fields
- dest
- id
- timestamp
- type
- root
- branch
- author
returns an observable that wraps sbot.async.get
. if a message isn't available,
it resolves to a message like object with {value: {missing: true, author: possibleAuthor}}
returns an observable that resolves to a map of {<author_id>: [timestamp, vote, expression]}
an observable version of message.async.name
returns a HtmlElement div
with Markdown
classname, that has the markdown rendered
inside of it. Because of some legacy quirks of patchwork@2, and historic messages
that should still be displayed correctly, the markdown method takes the content
of the ssb message - i.e {text: <markdown_string>, mentions: [{name: <string>, link: <@id>}]}
this will mean all markdown mentions are rendered into links correctly.
renders a link to a message, shown as a relative time passed since that message was written, for example "1 week ago"
a when loaded as a depject map will return an array of rendered metadatas about a message. Patchcore only provides the channel, patchbay adds several other things. patchwork does not use this, instead it hardcodes all the message metadata.
message.html.action
returnns a button that applies an action to a message. (such as like or reply)message.html.blacklinks
returns an html element formessage.obs.backlinks
message.html.layout(msg, opts={content})
returns an html wrapper for a message, an html element, content must be provided.
... and a bunch more
Patchcore collects routes from router.sync.routes
as a reduce. It expects the final routes collection to be an array of arrays of the form:
[ routeValidator, routeFunction ]
Where routeValidator
is a function that returns true / false when given a location
object.
Here's a simple example of extending the routes
exports.create = (api) => {
return { router: { sync: { routes } } }
function routes (sofar = []) {
const moreRoutes = [
[ (location) => location.page === 'home', api.app.page.home ],
[ (location) => location.type === 'group', api.app.page.group ],
[ () => true, api.app.page.notFound ]
]
return [...moreRoutes, ...sofar]
// Note order matters here
}
}
The router is accessible at app.sync.router
, and can be used like :
const location = { page: 'inbox', theme: 'dark' }
const newView = api.app.sync.router(location)
The router finds the first route which matches the location it is passed, then automatically calls the associated routeFunction
with the location
object as an argument.
In our example the route is generating a view, which we might insert / append to the DOM, but this doesn't have to be the case.
just wraps everything on the sbot api, except renames things to the art-hack naming style.
returns the message cache. I don't think anything uses this.
calls sbot.get(id|opts, cb)
calls sbot.publish(content, cb)
calls sbot.blobs.add()
except as an async function instead of a stream.
ssb-blobs
calls sbot.gossip.connect(opts, cb)
calls sbot.friends.get(opts, cb)
calls sbot.backlinks.read(query)
ssb-backlinks
calls sbot.createUserStream(opts)
calls sbot.createFeedStream(opts)
calls sbot.messagesByType(opts)
calls sbot.createFeedStream(opts)
calls sbot.createLogStream(opts)
calls sbot.links(opts)
takes a function that returns a stream, that will be called once the backend is connected. the createStream function will be passed an ordinary instance of muxrpc, it is not renamed to arthack style.
assigns a listener to observable of connection status.
assigns a listener to observable of connection status.
returns the connectedPeers
observable.
returns the localPeers
observable.