|
@@ -10,7 +10,7 @@ import { jumpTwitterDetailByAlert, showEditTweet } from '@/logic/content/help/tw
|
|
|
import { clearPostContent, setGroupIconStatus } from '@/logic/content/nft.js'
|
|
|
import { toolBox } from '@/logic/content/ToolBox'
|
|
|
import axios from 'axios';
|
|
|
-import messageCenter from '@/uilts/messageCenter';
|
|
|
+import messageCenter from '@/uilts/messageCenter/content';
|
|
|
import { PlayType } from '@/types';
|
|
|
import { reSetBindPostContent } from '@/http/help.js';
|
|
|
import { setDeviceInfo } from '@/logic/content/help/twitter';
|
|
@@ -882,10 +882,10 @@ function setIframeCard(type = 'twitter') {
|
|
|
index = Number(i) + 1
|
|
|
if (arr[i] == 'invite' && arr.length >= index) {
|
|
|
item.invite_code = arr[index];
|
|
|
- if(arr.length > index + 1) {
|
|
|
- item.invite_channel = arr[index+1];
|
|
|
+ if (arr.length > index + 1) {
|
|
|
+ item.invite_channel = arr[index + 1];
|
|
|
} else {
|
|
|
- item.invite_channel = '';
|
|
|
+ item.invite_channel = '';
|
|
|
}
|
|
|
break
|
|
|
}
|
|
@@ -1079,13 +1079,13 @@ export const getTweetUserFollowStatus = (params) => {
|
|
|
Promise.allSettled(promiseList).then((res) => {
|
|
|
let list = [];
|
|
|
if (res && res.length) {
|
|
|
- let resList = res.filter(item => item.status == 'fulfilled');
|
|
|
- for (let i = 0; i < resList.length; i++) {
|
|
|
- let item = resList[i];
|
|
|
- if (item && item.value && item.value.data && item.value.data.data) {
|
|
|
- list.push(item.value.data.data)
|
|
|
- }
|
|
|
- }
|
|
|
+ let resList = res.filter(item => item.status == 'fulfilled');
|
|
|
+ for (let i = 0; i < resList.length; i++) {
|
|
|
+ let item = resList[i];
|
|
|
+ if (item && item.value && item.value.data && item.value.data.data) {
|
|
|
+ list.push(item.value.data.data)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
messageCenter.send(params.iframeId, 'CONTENT_GET_TWEET_USER_FOLLOW_STATUS_RES', {
|
|
|
list, tweetId, type, iframeId: params.iframeId, iframeGUId
|
|
@@ -1498,45 +1498,45 @@ export function showJoinDialog(data) {
|
|
|
}
|
|
|
|
|
|
const TwitterFriendshipsUpdate = (params) => {
|
|
|
- let {id = '', device = true, name} = params || {};
|
|
|
- let data = {
|
|
|
- include_profile_interstitial_type: 1,
|
|
|
- include_blocking: 1,
|
|
|
- include_blocked_by: 1,
|
|
|
- include_followed_by: 1,
|
|
|
- include_want_retweets: 1,
|
|
|
- include_mute_edge: 1,
|
|
|
- include_can_dm: 1,
|
|
|
- include_can_media_tag: 1,
|
|
|
- include_ext_has_nft_avatar: 1,
|
|
|
- skip_status: 1,
|
|
|
- cursor: -1,
|
|
|
- id,
|
|
|
- device
|
|
|
- }
|
|
|
- if(!id) {
|
|
|
- return;
|
|
|
- }
|
|
|
- return fetch("https://twitter.com/i/api/1.1/friendships/update.json", {
|
|
|
- "headers": {
|
|
|
- "authorization": "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA",
|
|
|
- "content-type": "application/x-www-form-urlencoded",
|
|
|
- "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"102\", \"Google Chrome\";v=\"102\"",
|
|
|
- "sec-ch-ua-mobile": "?0",
|
|
|
- "sec-ch-ua-platform": "\"macOS\"",
|
|
|
- "x-csrf-token": getCookie('ct0'),
|
|
|
- "x-twitter-active-user": "yes",
|
|
|
- "x-twitter-auth-type": "OAuth2Session",
|
|
|
- "x-twitter-client-language": "en",
|
|
|
- "referer": `https://twitter.com/${name}`
|
|
|
- },
|
|
|
- "referrer": `https://twitter.com/${name}`,
|
|
|
- "referrerPolicy": "strict-origin-when-cross-origin",
|
|
|
- "body": `include_profile_interstitial_type=1&include_blocking=1&include_blocked_by=1&include_followed_by=1&include_want_retweets=1&include_mute_edge=1&include_can_dm=1&include_can_media_tag=1&include_ext_has_nft_avatar=1&skip_status=1&cursor=-1&id=${id}&device=true`,
|
|
|
- "method": "POST",
|
|
|
- "mode": "cors",
|
|
|
- "credentials": "include"
|
|
|
- })
|
|
|
+ let { id = '', device = true, name } = params || {};
|
|
|
+ let data = {
|
|
|
+ include_profile_interstitial_type: 1,
|
|
|
+ include_blocking: 1,
|
|
|
+ include_blocked_by: 1,
|
|
|
+ include_followed_by: 1,
|
|
|
+ include_want_retweets: 1,
|
|
|
+ include_mute_edge: 1,
|
|
|
+ include_can_dm: 1,
|
|
|
+ include_can_media_tag: 1,
|
|
|
+ include_ext_has_nft_avatar: 1,
|
|
|
+ skip_status: 1,
|
|
|
+ cursor: -1,
|
|
|
+ id,
|
|
|
+ device
|
|
|
+ }
|
|
|
+ if (!id) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ return fetch("https://twitter.com/i/api/1.1/friendships/update.json", {
|
|
|
+ "headers": {
|
|
|
+ "authorization": "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA",
|
|
|
+ "content-type": "application/x-www-form-urlencoded",
|
|
|
+ "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"102\", \"Google Chrome\";v=\"102\"",
|
|
|
+ "sec-ch-ua-mobile": "?0",
|
|
|
+ "sec-ch-ua-platform": "\"macOS\"",
|
|
|
+ "x-csrf-token": getCookie('ct0'),
|
|
|
+ "x-twitter-active-user": "yes",
|
|
|
+ "x-twitter-auth-type": "OAuth2Session",
|
|
|
+ "x-twitter-client-language": "en",
|
|
|
+ "referer": `https://twitter.com/${name}`
|
|
|
+ },
|
|
|
+ "referrer": `https://twitter.com/${name}`,
|
|
|
+ "referrerPolicy": "strict-origin-when-cross-origin",
|
|
|
+ "body": `include_profile_interstitial_type=1&include_blocking=1&include_blocked_by=1&include_followed_by=1&include_want_retweets=1&include_mute_edge=1&include_can_dm=1&include_can_media_tag=1&include_ext_has_nft_avatar=1&skip_status=1&cursor=-1&id=${id}&device=true`,
|
|
|
+ "method": "POST",
|
|
|
+ "mode": "cors",
|
|
|
+ "credentials": "include"
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
const TwitterFollowAPI = (item, tweet_Id) => {
|
|
@@ -1562,7 +1562,7 @@ const TwitterFollowAPI = (item, tweet_Id) => {
|
|
|
let task_data = {
|
|
|
follow_name: item.name
|
|
|
}
|
|
|
- TwitterFriendshipsUpdate({id: item.twitterUserId, name: item.name})
|
|
|
+ TwitterFriendshipsUpdate({ id: item.twitterUserId, name: item.name })
|
|
|
|
|
|
chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'follow', task_data, task_done: true }, () => { })
|
|
|
}).catch(() => {
|
|
@@ -2403,7 +2403,12 @@ const addPageScrollEvent = () => {
|
|
|
contentHeight: contentDom.offsetHeight
|
|
|
}
|
|
|
|
|
|
- messageCenter.send('de-tab-group-content', 'CONTENT_GROUP_LIST_SCROLL', data)
|
|
|
+ messageCenter.send({
|
|
|
+ info: {
|
|
|
+ iframeId: 'de-tab-group-content', actionType: 'CONTENT_GROUP_LIST_SCROLL'
|
|
|
+ },
|
|
|
+ data
|
|
|
+ })
|
|
|
|
|
|
// chrome.runtime.sendMessage({
|
|
|
// actionType: "CONTENT_GROUP_LIST_SCROLL",
|
|
@@ -2489,7 +2494,11 @@ const setGroupTabSelfStyle = (params = {}) => {
|
|
|
* 切换到 Group tab时 刷新列表
|
|
|
*/
|
|
|
export const refreshTabGroup = () => {
|
|
|
- messageCenter.send('de-tab-group-content', 'CONTENT_REFRESH_TAB_GROUP_LIST', {})
|
|
|
+ messageCenter.send({
|
|
|
+ info: {
|
|
|
+ iframeId: 'de-tab-group-content', actionType: 'CONTENT_REFRESH_TAB_GROUP_LIST'
|
|
|
+ }
|
|
|
+ })
|
|
|
// chrome.runtime.sendMessage({
|
|
|
// actionType: "CONTENT_REFRESH_TAB_GROUP_LIST",
|
|
|
// data: {}
|
|
@@ -2570,7 +2579,7 @@ const addTabGroupContent = (cb) => {
|
|
|
}
|
|
|
let iframe = document.createElement('iframe');
|
|
|
iframe.id = 'de-tab-group-content';
|
|
|
- iframe.src = getInnerIframeURL(`${iframeHost}/tab-group` + `?params=${JSON.stringify(params)}&iframeID=${iframe.id}`);
|
|
|
+ iframe.src = getInnerIframeURL(`${iframeHost}/tab-group` + `?params=${JSON.stringify(params)}&iframeId=${iframe.id}`);
|
|
|
iframe.style.cssText = `border: medium none; height: 500px;display: none`
|
|
|
|
|
|
let iframeContent = getGroupTabContentNode();
|
|
@@ -2672,7 +2681,9 @@ export const getTweetProfileNavTop = (params) => {
|
|
|
let top = document.querySelector('div[role="tablist"]').closest('nav').getBoundingClientRect().top;
|
|
|
|
|
|
messageCenter.send({
|
|
|
- actionType: "CONTENT_SEND_GROUP_NAV_TOP",
|
|
|
+ info: {
|
|
|
+ actionType: "CONTENT_SEND_GROUP_NAV_TOP"
|
|
|
+ },
|
|
|
data: {
|
|
|
top,
|
|
|
scrollTop: params.scrollTop
|
|
@@ -2718,7 +2729,13 @@ export const setGroupInfo = (params = {}) => {
|
|
|
|
|
|
export const getExtensionStorgeDataForIframe = (data) => {
|
|
|
getChromeStorage(data.key).then((res) => {
|
|
|
- messageCenter.send(data.iframeID, `IFRAME_GET_EXTENSION_STORGE_DATA-${data.messageID}`, res)
|
|
|
+ messageCenter.send({
|
|
|
+ info: {
|
|
|
+ iframeId: data.iframeId,
|
|
|
+ actionType: `IFRAME_GET_EXTENSION_STORGE_DATA-${data.messageId}`
|
|
|
+ },
|
|
|
+ data: res
|
|
|
+ })
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -2745,7 +2762,9 @@ const sysThemeChange = () => {
|
|
|
setTimeout(() => {
|
|
|
let bgColor = document.querySelector('body').style.backgroundColor;
|
|
|
messageCenter.send({
|
|
|
- actionType: "CONTENT_SYS_THEME_CHANGE",
|
|
|
+ info: {
|
|
|
+ actionType: "CONTENT_SYS_THEME_CHANGE"
|
|
|
+ },
|
|
|
data: {
|
|
|
theme: systemInfo.theme,
|
|
|
twitterTheme: bgColor == 'rgb(0, 0, 0)' ? 'dark' : 'light'
|