refactor(route/twitter): keep twitter graphql endpoints consistent
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { baseUrl, gqlMap, gqlFeatures, gqlMapThirdParty } from './constants';
|
||||
import { baseUrl, gqlMap, gqlFeatures } from './constants';
|
||||
import { config } from '@/config';
|
||||
import cache from '@/utils/cache';
|
||||
import { twitterGot, paginationTweets, gatherLegacyFromData } from './utils';
|
||||
@@ -24,7 +24,7 @@ const getUserData = (id) =>
|
||||
};
|
||||
|
||||
if (config.twitter.thirdPartyApi) {
|
||||
const endpoint = id.startsWith('+') ? gqlMapThirdParty.UserByRestId : gqlMapThirdParty.UserByScreenName;
|
||||
const endpoint = id.startsWith('+') ? gqlMap.UserByRestId : gqlMap.UserByScreenName;
|
||||
|
||||
return ofetch(`${config.twitter.thirdPartyApi}${endpoint}`, {
|
||||
method: 'GET',
|
||||
|
||||
@@ -15,10 +15,6 @@ const graphQLEndpointsPlain = [
|
||||
|
||||
const gqlMap = Object.fromEntries(graphQLEndpointsPlain.map((endpoint) => [endpoint.split('/')[3].replace(/V2$|Query$|QueryV2$/, ''), endpoint]));
|
||||
|
||||
const graphQLEndpointsThirdParty = ['/graphql/xxxxxxx/UserByScreenName', '/graphql/xxxxxxx/UserByRestId'];
|
||||
|
||||
const gqlMapThirdParty = Object.fromEntries(graphQLEndpointsThirdParty.map((endpoint) => [endpoint.split('/')[3].replace(/V2$|Query$|QueryV2$/, ''), endpoint]));
|
||||
|
||||
const gqlFeatureUser = {
|
||||
hidden_profile_subscriptions_enabled: true,
|
||||
rweb_tipjar_consumption_enabled: true,
|
||||
@@ -116,4 +112,4 @@ const timelineParams = {
|
||||
|
||||
const bearerToken = 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA';
|
||||
|
||||
export { baseUrl, gqlMap, gqlMapThirdParty, gqlFeatures, timelineParams, bearerToken };
|
||||
export { baseUrl, gqlMap, gqlFeatures, timelineParams, bearerToken };
|
||||
|
||||
Reference in New Issue
Block a user