Skip to content

Commit 72fb0bd

Browse files
chore(deps): bump several dependencies (elliptic, pbkdf2, fast-xml-parser etc) and replace twit (#40294)
1 parent 73c27a2 commit 72fb0bd

4 files changed

Lines changed: 81 additions & 316 deletions

File tree

apps/meteor/app/lib/server/oauth/twitter.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
import { Match, check } from 'meteor/check';
2-
import Twit from 'twit';
2+
import { TwitterApi } from 'twitter-api-v2';
33
import _ from 'underscore';
44

55
import { registerAccessTokenService } from './oauth';
66

77
const whitelistedFields = ['id', 'name', 'description', 'profile_image_url', 'profile_image_url_https', 'lang', 'email'];
88

99
const getIdentity = async function (accessToken, appId, appSecret, accessTokenSecret) {
10-
const Twitter = new Twit({
11-
consumer_key: appId,
12-
consumer_secret: appSecret,
13-
access_token: accessToken,
14-
access_token_secret: accessTokenSecret,
10+
const client = new TwitterApi({
11+
appKey: appId,
12+
appSecret,
13+
accessToken,
14+
accessSecret: accessTokenSecret,
1515
});
1616
try {
17-
const result = await Twitter.get('account/verify_credentials.json?include_email=true');
18-
19-
return result.data;
17+
return await client.v1.verifyCredentials({ include_email: true });
2018
} catch (err) {
21-
throw _.extend(new Error(`Failed to fetch identity from Twwiter. ${err.message}`), {
22-
response: err.response,
19+
throw _.extend(new Error(`Failed to fetch identity from Twitter. ${err.message}`), {
20+
data: err.data ?? err.response,
2321
});
2422
}
2523
};

apps/meteor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@
299299
"tsyringe": "^4.10.0",
300300
"tweetnacl": "^1.0.3",
301301
"twilio": "~5.4.5",
302-
"twit": "^2.2.11",
302+
"twitter-api-v2": "^1.29.0",
303303
"typia": "patch:typia@npm%3A9.7.2#~/.yarn/patches/typia-npm-9.7.2-5c5d9c80b4.patch",
304304
"ua-parser-js": "~1.0.41",
305305
"underscore": "^1.13.8",

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@
3939
"adm-zip": "0.5.9",
4040
"brace-expansion@npm:^2.0.1": "^2.0.3",
4141
"brace-expansion@npm:^5.0.2": "^5.0.5",
42+
"@meteorjs/crypto-browserify/pbkdf2": "3.1.3",
43+
"browserify-sign/elliptic": "6.6.1",
44+
"create-ecdh/elliptic": "6.6.1",
45+
"parse-asn1/pbkdf2": "3.1.3",
4246
"cross-spawn": "7.0.6",
4347
"drachtio-srf": "patch:drachtio-srf@npm%3A5.0.12#~/.yarn/patches/drachtio-srf-npm-5.0.12-b0b1afaad6.patch",
44-
"fast-xml-parser@npm:^4.2.4": "^4.5.5",
45-
"fast-xml-parser@npm:^4.4.1": "^4.5.5",
4648
"fast-xml-parser@npm:5.3.6": "^5.5.7",
49+
"is-svg/fast-xml-parser": "5.5.11",
50+
"webdav/fast-xml-parser": "5.5.11",
4751
"follow-redirects": "^1.16.0",
4852
"handlebars": "^4.7.9",
4953
"lodash": "^4.18.0",

0 commit comments

Comments
 (0)