mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-13 07:49:29 +00:00
Merge commit '7ed9c590b98610f8d68deab9ef8df260eec6d8f0' into glitch-soc/merge-upstream
This commit is contained in:
@@ -44,7 +44,6 @@ initializeLogLevel(process.env, environment);
|
||||
* @property {string[]} scopes
|
||||
* @property {string} accountId
|
||||
* @property {string[]} chosenLanguages
|
||||
* @property {string} deviceId
|
||||
*/
|
||||
|
||||
|
||||
@@ -355,7 +354,7 @@ const startServer = async () => {
|
||||
* @returns {Promise<ResolvedAccount>}
|
||||
*/
|
||||
const accountFromToken = async (token, req) => {
|
||||
const result = await pgPool.query('SELECT oauth_access_tokens.id, oauth_access_tokens.resource_owner_id, users.account_id, users.chosen_languages, oauth_access_tokens.scopes, devices.device_id FROM oauth_access_tokens INNER JOIN users ON oauth_access_tokens.resource_owner_id = users.id LEFT OUTER JOIN devices ON oauth_access_tokens.id = devices.access_token_id WHERE oauth_access_tokens.token = $1 AND oauth_access_tokens.revoked_at IS NULL LIMIT 1', [token]);
|
||||
const result = await pgPool.query('SELECT oauth_access_tokens.id, oauth_access_tokens.resource_owner_id, users.account_id, users.chosen_languages, oauth_access_tokens.scopes FROM oauth_access_tokens INNER JOIN users ON oauth_access_tokens.resource_owner_id = users.id WHERE oauth_access_tokens.token = $1 AND oauth_access_tokens.revoked_at IS NULL LIMIT 1', [token]);
|
||||
|
||||
if (result.rows.length === 0) {
|
||||
throw new AuthenticationError('Invalid access token');
|
||||
@@ -365,14 +364,12 @@ const startServer = async () => {
|
||||
req.scopes = result.rows[0].scopes.split(' ');
|
||||
req.accountId = result.rows[0].account_id;
|
||||
req.chosenLanguages = result.rows[0].chosen_languages;
|
||||
req.deviceId = result.rows[0].device_id;
|
||||
|
||||
return {
|
||||
accessTokenId: result.rows[0].id,
|
||||
scopes: result.rows[0].scopes.split(' '),
|
||||
accountId: result.rows[0].account_id,
|
||||
chosenLanguages: result.rows[0].chosen_languages,
|
||||
deviceId: result.rows[0].device_id
|
||||
};
|
||||
};
|
||||
|
||||
@@ -990,10 +987,6 @@ const startServer = async () => {
|
||||
const channelsForUserStream = req => {
|
||||
const arr = [`timeline:${req.accountId}`];
|
||||
|
||||
if (isInScope(req, ['crypto']) && req.deviceId) {
|
||||
arr.push(`timeline:${req.accountId}:${req.deviceId}`);
|
||||
}
|
||||
|
||||
if (isInScope(req, ['read', 'read:notifications'])) {
|
||||
arr.push(`timeline:${req.accountId}:notifications`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user