0.2.4 release + Mattermost plug doc update

pull/211/head
Zef Hemel 2022-12-16 16:45:29 +01:00
parent 3af82495d1
commit c2b2aeca6f
3 changed files with 39 additions and 30 deletions

View File

@ -3,7 +3,7 @@ release.
---
## Next
## 0.2.4
* Vim mode is here! This mode can be enabled on a per-client basis (its state is stored in the browser). To toggle Vim mode on or off use the {[Editor: Toggle Vim Mode]} command.
* Security update: SB now binds to `127.0.0.1` by default, allowing just connections via `localhost`. To allow outside connections, pass the `--hostname 0.0.0.0` flag (and ideally combine it with a `--user username:password` flag to add basic authentication).

View File

@ -3,11 +3,19 @@ type: plug
uri: github:silverbulletmd/silverbullet-mattermost/mattermost.plug.json
repo: https://github.com/silverbulletmd/silverbullet-mattermost
author: Zef Hemel
share-support: true
---
<!-- #include [[https://raw.githubusercontent.com/silverbulletmd/silverbullet-mattermost/main/README.md]] -->
# Mattermost plug for Silver Bullet
This plug provides a few query providers to query data from some of the [Mattermost suite](https://www.mattermost.com) of products. Please follow the installation, configuration sections, and have a look at the example.
# Mattermost for Silver Bullet
This plug provides various integrations with the [Mattermost suite](https://www.mattermost.com) of products. Please follow the installation, configuration sections, and have a look at the example.
Features:
* Integration with [Silver Bullet Share](https://silverbullet.md/%F0%9F%94%8C_Share), allowing you to publish and update a page as a post on Mattermost, as well as load existing posts into SB as a page using the {[Share: Mattermost Post: Publish]} (to publish an existing page as a Mattermost post) and {[Share: Mattermost Post: Load]} (to load an existing post into SB) commands.
* Access your saved posts via the `mm-saved` query provider
* Unfurl support for posts (after dumping a permalink URL to a post in a page, use the {[Link: Unfurl]} command).
* Boards support is WIP
## Installation
Open your `PLUGS` note in SilverBullet and add this plug to the list:
@ -19,52 +27,52 @@ Open your `PLUGS` note in SilverBullet and add this plug to the list:
Then run the `Plugs: Update` command and off you go!
## Configuration
When using the `mm-saved` query provide, you need two bits of configuration to make this plug work. In `SETTINGS` provide the `mattermostUrl` and `mattermostDefaultTeam` settings, they default to the following:
In `SETTINGS` provide the `mattermost` key with a `url` and `defaultTeam` for each server (you can name them arbitrarily):
```yaml
mattermostUrl: https://community.mattermost.com
mattermostDefaultTeam: core
mattermost:
community:
url: https://community.mattermost.com
defaultTeam: core
silverbullet:
url: https://silverbullet.cloud.mattermost.com
defaultTeam: main
```
In `SECRETS` provide a Mattermost personal access token (or hijack one from your current session):
In `SECRETS` provide a Mattermost personal access token (or hijack one from your current session) for each server:
```yaml
mattermostToken: your-token
mattermost:
community: 1234
silverbullet: 1234
```
To make this look good, it's recommended you render your query results a template. Here is one to start with, you can keep it in e.g. `templates/mm-saved`:
[{{username}}]({{desktopUrl}}) in **{{channelName}}** at {{updatedAt}} {[Unsave]}:
## Query sources
* `mm-saved` fetches (by default 15) saved posts in Mattermost, you need to add a `where server = "community"` (with server name) clause to your query to select the mattermost server to query.
To make the `mm-saved` query results look good, it's recommended you render your query results a template. Here is one to start with, you can keep it in e.g. `templates/mm-saved`:
[{{username}}]({{url}}) in {{#if channelName}}**{{channelName}}**{{else}}a DM{{/if}} at _{{updatedAt}}_ {[Unsave]}:
{{prefixLines (substring message 0 300 " ... (More)") "> "}}
---
Note that the `{[Unsaved]}` "button" when clicked, will unsave the post automatically 😎
If you use the `mm-boards` query provider, you do not need any configuration of secrets.
## Query sources
* `mm-saved` fetches (by default 15) saved posts in Mattermost
* `mm-board` fetches all cards from a Mattermost board exposed via a public share URL (obtained via Share > Publish > Publish to Web > Copy Link) via an `url =` filter (see example below)
## Commands
* `Convert post to note` fetches a post by passing its permalink and adds it to a note. If the note doesn't exist, it creates a new one.
* `Unfurl: permalink` available while positioning the caret on top of a mattermost permalink related to the configured url, will fetch the post contents.
## Example
Note that the `{[Unsave]}` button when clicked, will unsave the post automatically 😎
Example use of `mm-saved` (using the `template/mm-saved` template above):
<!-- #query mm-saved order by updatedAt desc limit 5 render "template/mm-saved" -->
<!-- #query mm-saved where server = "community" order by updatedAt desc limit 5 render "template/mm-saved" -->
<!-- /query -->
Example use of `mm-board`:
## Posting to a channel
<!-- #query mm-board where url = "https://community.mattermost.com/plugins/focalboard/workspace/p33mj7xh4frntrtbxbp5xp1joy/shared/bbam1crdg6jn93qhcgiq8xbpk8a/vqnxrjaewnibrtnp8m38fswt63e?r=keadbck8m8oc84ng6ozhcqqcgpc" and team = "Server Platform" and quarter = "2022 Q3" select objective, title, status -->
<!-- /query -->
You can use the {[Share: Mattermost Post: Publish]} command to publish the current page to a channel. You will be prompted to select the server and channel to post to. A `$share` key will be injected into frontmatter after the initial post. Subsequent post edits can be published via the standard {[Share: Publish]} command.
## Loading a post into SB
Using the {[Share: Mattermost Post: Load]} command you can load an existing post into your space. All you need for this is to have the Mattermost authentication configured as described above. You will be prompted for a post permalink and a page to save it to. If you are the author of the post, the `$share` frontmatter will also be set up so you can change the page and push changes back into Mattermost.
<!-- /include -->

View File

@ -11,5 +11,6 @@ Specific implementations for sharing are implemented in other plugs, specificall
<!-- #query page where share-support = true render [[template/page]] -->
* [[🔌 Markdown]]
* [[🔌 Collab]]
* [[🔌 Mattermost]]
* [[🔌 Github]]
<!-- /query -->