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.
11 lines
532 B
SQL
11 lines
532 B
SQL
-- 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
|
|
);
|