Skip to content

Commit

Permalink
Convert to generic project
Browse files Browse the repository at this point in the history
* Remove churchofmemes references
* Clean up README.md slightly
  • Loading branch information
kpollich committed Nov 15, 2017
1 parent 0adf6d5 commit 4eb89d3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
20 changes: 14 additions & 6 deletions README.md
@@ -1,16 +1,24 @@
# 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
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.

Expand All @@ -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`.
Start app with `yarn start` or use [nodemon](https://github.com/remy/nodemon) for auto-reloading in development. e.g. `nodemon index.js`.
2 changes: 1 addition & 1 deletion docker-compose.yml
@@ -1,6 +1,6 @@
version: '3'

services:
churchofmemes-xposter:
tusky:
build:
context: .
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -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,
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions 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": {
Expand Down

0 comments on commit 4eb89d3

Please sign in to comment.