feat: post what I listen to on Mastodon, if I connect an account
In Settings a person connects their Mastodon account: the address of their instance and an access token that can only write posts. Nothing is connected by default, and disconnecting forgets the token. - When a track of this server counts as a listen, it is posted as an unlisted status: title, artists, album and #NowPlaying, with no link. Music of a friend is never reported as a listen, so it is never posted. At most one post a minute for each person, in the background, with a bounded queue. - PUT, GET and DELETE /me/mastodon. The token is never sent back. - The address of the instance is typed by a person, so it must be a domain name on https, and the client never connects to a private, loopback or link-local address (checked on the address it really dials, so a name that points inside is no way in), never follows a redirect, ignores proxy settings and reads at most a megabyte. - New table mastodon_accounts (SQLite and PostgreSQL) that goes with the account. - README: the feature, and the credit for butterchurn and its presets.
This commit is contained in:
parent
7aa822f6bb
commit
0dc7782028
2 changed files with 1953 additions and 7 deletions
9
migrations/postgres/0026_mastodon.sql
Normal file
9
migrations/postgres/0026_mastodon.sql
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
-- PostgreSQL flavour of sqlite/0026_mastodon.sql.
|
||||
|
||||
CREATE TABLE mastodon_accounts (
|
||||
user_id BIGINT PRIMARY KEY REFERENCES users(id) ON DELETE CASCADE,
|
||||
instance TEXT NOT NULL,
|
||||
token TEXT NOT NULL,
|
||||
handle TEXT NOT NULL,
|
||||
created_at BIGINT NOT NULL
|
||||
);
|
||||
11
migrations/sqlite/0026_mastodon.sql
Normal file
11
migrations/sqlite/0026_mastodon.sql
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
-- The Mastodon account a person connected to share what they listen to: the address of their instance, the access token
|
||||
-- (it can write posts and nothing else) and the handle the instance gave back. Nothing is kept for a person who did not
|
||||
-- connect, and the row goes with the account.
|
||||
|
||||
CREATE TABLE mastodon_accounts (
|
||||
user_id INTEGER PRIMARY KEY REFERENCES users(id) ON DELETE CASCADE,
|
||||
instance TEXT NOT NULL,
|
||||
token TEXT NOT NULL,
|
||||
handle TEXT NOT NULL,
|
||||
created_at INTEGER NOT NULL
|
||||
);
|
||||
Loading…
Reference in a new issue