diff --git a/README.md b/README.md index 0d9d222..154c9c1 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,16 @@ -# The Church of Memes Cross Poster +# tusky -Listens to a public [Mastodon](https://mastodon.social/about) feed and cross posts new toots to a Slack channel as configured by an incoming webhook integration. +A Dockerized Node service for pushing new toots from a [Mastodon](https://api.slack.com/incoming-webhooks) instance to a Slack channel. -Expects the following environment variables in a `.env` file +## Running tusky + +### What you'll need + +* A Mastodon URL and access token +* A Slack "incoming webhook" endpoint +* Docker (Or Node 6+ and Yarn if running natively) + +Create a `.env` file in your `tusky` directory that defines the following environment variables: ```bash ACCESS_TOKEN=mastodon-access-token @@ -10,7 +18,7 @@ MASTODON_URL=https://some-mastodon-instance.com SLACK_WEBHOOK_ENDPOINT=https://hook.some-slack-instance.com ``` -Dockerized for your convenience. As long as you `.env` file is set up, just run `docker-compose up -d` to start the container. App runs on a `node:8-alpine` image. +Once you have your environment variables set up, run `docker-compose up -d` to start the container. This will start a `tusky` Docker container in the background. After that you're all set - tusky will listen for new Mastodon toots and post to your configured Slack endpoint to push the toots into your Slack instance. Note: This doesn't have crash recovery or any real error handling yet, so the docker container may die intermittently. @@ -19,8 +27,8 @@ Note: This doesn't have crash recovery or any real error handling yet, so the do Install dependencies with [Yarn](https://yarnpkg.com/en/) ```bash -cd churchofmemes-xposter +cd tusky yarn ``` -Start app with `yarn start` or use [nodemon](https://github.com/remy/nodemon) for auto-reloading. e.g. `nodemon index.js`. \ No newline at end of file +Start app with `yarn start` or use [nodemon](https://github.com/remy/nodemon) for auto-reloading in development. e.g. `nodemon index.js`. \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 2933b19..f3bfaae 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ version: '3' services: - churchofmemes-xposter: + tusky: build: context: . \ No newline at end of file diff --git a/index.js b/index.js index ca30e7f..02df7dd 100644 --- a/index.js +++ b/index.js @@ -38,7 +38,7 @@ function createSlackMessage(data) { const statusId = uri.match(/statuses\/([0-9]+)/)[1] const statusUrl = `${process.env.MASTODON_URL}/web/statuses/${statusId}` - const defaultText = `New post from ${username} on Memestodon!\n<${statusUrl}>` + const defaultText = `New post from ${username} on Mastodon!\n<${statusUrl}>` // The presence of a `media_attachments` array denotes an uploaded or pasted image. Mastodon handles // creating a link tag for these by default, and so they're included in the unfurled message in Slack, @@ -52,7 +52,7 @@ function createSlackMessage(data) { // Mastodon posts with no uploaded/pasted items and a link get an unfurl-friendly link appended if (!hasMediaItem && !!imageLinkMatch) { - return `New post from ${username} on Memestodon!\n<${statusUrl}>\n${imageLinkMatch[1]}` + return `New post from ${username} on Mastodon!\n<${statusUrl}>\n${imageLinkMatch[1]}` } return defaultText diff --git a/package.json b/package.json index 295fb1d..fd65da5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "churchofmemes-xposter", - "version": "1.0.0", + "name": "tusky", + "version": "0.0.1", "main": "index.js", "license": "MIT", "scripts": {