-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for updating multiple slack teams and slack apps
BREAKING CHANGE: This requires a completely new configuration format but everything else should remain the same. Closes #106 Closes #99 Closes #114
- Loading branch information
1 parent
2dc3b6a
commit 9eca19b
Showing
34 changed files
with
935 additions
and
878 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
dist | ||
.track.json | ||
data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
trailingComma: 'none', | ||
semi: false, | ||
singleQuote: true, | ||
arrowParens: 'avoid' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<p align="center"> | ||
<img src="./header.png" alt="slack-fm" /> | ||
<br /> | ||
<a href="https://travis-ci.org/JackCuthbert/slack-fm"> | ||
<img src="https://api.travis-ci.org/JackCuthbert/slack-fm.svg?branch=master" alt="Travis CI" /> | ||
</a> | ||
<a href="https://hub.docker.com/repository/docker/jckcthbrt/slack-fm"> | ||
<img src="https://img.shields.io/docker/pulls/jckcthbrt/slack-fm" alt="Docker Pulls" /> | ||
</a> | ||
<br /> | ||
<a href="https://www.producthunt.com/posts/slack-fm?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-slack-fm" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=173963&theme=dark" alt="slack-fm - Self-hosted service to sync Last.fm with your Slack status | Product Hunt Embed" style="width: 250px; height: 54px;" width="250px" height="54px" /> | ||
</a> | ||
</p> | ||
|
||
## Introduction | ||
|
||
**Slack-fm** is a tiny self-hosted service that automatically updates your Slack | ||
status from your Last.fm profile. It updates your Slack status when all the | ||
following conditions are met: | ||
|
||
* the user is not set to "away" | ||
* a custom status hasn't been set | ||
* something is now playing on Last.fm | ||
* the time is between 9am and 5pm (configurable) | ||
* it's not a weekend (configurable) | ||
|
||
To clear the status it will search Last.fm for the now playing tracks duration | ||
and use that as the status expiration time. If there is no duration information | ||
it defaults to a 10 minute expiration (configurable). | ||
|
||
It looks like this: | ||
|
||
![Slack Preview](./slack-preview.png) | ||
|
||
## Setup | ||
|
||
[Read SETUP.md](./SETUP.md) | ||
|
||
## Contributing | ||
|
||
This should be relatively simple to set up and run, all that's required is Node | ||
v12 and some environment variables. | ||
|
||
1. Fork this repository and clone your version | ||
1. Install dependencies with `npm install` | ||
1. Run the tests with `npm test` | ||
1. Copy the sample config file with `cp data/config.sample.yml data/config.yml` and edit it | ||
1. Start the app locally with `npm start` | ||
1. Commit and push your changes then submit a PR back to this repository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Setup slack-fm | ||
|
||
Since Slack has now removed the ability to create new Legacy Tokens you'll need | ||
to create a Slack App and find your member ID to enable slack-fm functionality. | ||
|
||
## 1. Create the Slack App Token | ||
|
||
1. Navigate to <https://api.slack.com/apps> | ||
1. Click "Create New App", give it a name like "slack-fm", and choose your | ||
Workspace. | ||
1. Click "Add features and functionality" | ||
1. Select "Permissions" and scroll down to "Scopes" | ||
1. Add 2x "User Token Scopes" | ||
1. `users.profile:write` | ||
1. `users:read` | ||
1. Copy the token at the top of this page | ||
|
||
## 2. Get your Slack member ID | ||
|
||
1. Go to Slack | ||
1. Click your profile image in the top right and select "View Profile" | ||
1. Click the "More" button and select "Copy member ID" | ||
|
||
## 3. Create a Last.fm app | ||
|
||
1. [Create an API account here](https://www.last.fm/api/account/create) | ||
2. Copy the API key and shared secret | ||
|
||
## 4. Create the config file | ||
|
||
Copy the below snippet and create a file called `config.yml` somewhere replacing | ||
the properties with what you created above. | ||
|
||
All the options here are required, the sample below contains some sensible | ||
defaults for the app. | ||
|
||
The `slack` property allows you to configure multiple Slack Teams so you can | ||
update your status across all of them at the same time. | ||
|
||
```yml | ||
# config.yml | ||
app: | ||
emoji: ':headphones:' | ||
separator: '·' | ||
update_interval: 1 | ||
update_weekends: false | ||
update_hour_start: 8 | ||
update_hour_end: 18 | ||
|
||
lastfm: | ||
username: 'your_lastfm_username' | ||
api_key: '00000000000000000000000000000000' | ||
shared_secret: '00000000000000000000000000000000' | ||
|
||
slack: | ||
- user_id: 'U00000000' | ||
token: 'xoxp-XXX-XXX-XXX-XXX' | ||
- user_id: 'U00000000' | ||
token: 'xoxp-XXX-XXX-XXX-XXX' | ||
``` | ||
This file will be used in the next step. | ||
## 5. Hosting | ||
I designed this to be easily self hosted on either your local machine or on a | ||
server somewhere with Docker. Slack-fm is automatically built and versioned on | ||
[Docker Hub](https://hub.docker.com/repository/docker/jckcthbrt/slack-fm/tags) | ||
based on GitHub activity. | ||
Define a `docker-compose.yml` file with the following content being careful to | ||
replace the `volumes` property with the correct `config.yml` path. | ||
|
||
```yml | ||
# docker-compose.yml | ||
version: '3.7' | ||
services: | ||
slack_fm: | ||
image: jckcthbrt/slack-fm:latest | ||
container_name: slack_fm | ||
restart: unless-stopped | ||
environment: | ||
TZ: '<YOUR_TIMEZONE>' | ||
volumes: | ||
- '</LOCAL/PATH/TO/config.yml>:/data/config.yml' | ||
``` | ||
|
||
```bash | ||
docker-compose up | ||
``` |
Empty file.
Oops, something went wrong.