|
@@ -806,18 +806,18 @@ function setIframeRedPacket(type = 'twitter') {
|
|
|
} else if (item && item.post_Id && item.post_Id.includes('treasure/')) {
|
|
|
// https://testh5.denetme.net/treasure/{postid}
|
|
|
// https://testh5.denetme.net/treasure/invite/{inviteCode}
|
|
|
-
|
|
|
// 邀请链接
|
|
|
if (item.post_Id.includes('invite/')) {
|
|
|
- item.invite_code = item.post_Id.includes('invite/')[1] || ''
|
|
|
+ item.invite_code = item.post_Id.split('invite/')[1] || ''
|
|
|
item.page_type = '邀请链接'
|
|
|
if (item.invite_code) {
|
|
|
+ item.post_Id = ''
|
|
|
parseCard.replaceDOMRreasureCard(item)
|
|
|
}
|
|
|
} else {
|
|
|
// 原始链接
|
|
|
item.page_type = '原始链接'
|
|
|
- item.post_Id = item.post_Id.includes('treasure/')[1] || ''
|
|
|
+ item.post_Id = item.post_Id.split('treasure/')[1] || ''
|
|
|
if (item.post_Id) {
|
|
|
parseCard.replaceDOMRreasureCard(item)
|
|
|
}
|
|
@@ -1306,7 +1306,7 @@ export function getTweetAuthorByDom(params) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-export function doTaskTwitterAPI({ task_data, task_type, params }) {
|
|
|
+export function doTaskTwitterAPI({ task_data, task_type, tasks }) {
|
|
|
switch (task_type) {
|
|
|
case 'like':
|
|
|
TwitterLikeAPI(task_data.tweet_Id)
|
|
@@ -1321,16 +1321,31 @@ export function doTaskTwitterAPI({ task_data, task_type, params }) {
|
|
|
}
|
|
|
})
|
|
|
break
|
|
|
- case 'four_task':
|
|
|
- TwitterRetweetAPI(task_data.tweet_Id)
|
|
|
- TwitterLikeAPI(task_data.tweet_Id)
|
|
|
- task_data.follow_data.forEach((item) => {
|
|
|
- if (item.name && item.twitterUserId) {
|
|
|
- TwitterFollowAPI(item, task_data.tweet_Id)
|
|
|
+ case 'tasks':
|
|
|
+ tasks.forEach((item) => {
|
|
|
+ //
|
|
|
+ switch (String(item.type)) {
|
|
|
+ // 关注指定用户
|
|
|
+ case '1':
|
|
|
+ item.relatedUsers.forEach((item) => {
|
|
|
+ if (item.name && item.twitterUserId) {
|
|
|
+ TwitterFollowAPI(item, task_data.tweet_Id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ break
|
|
|
+ // 点赞
|
|
|
+ case '2':
|
|
|
+ TwitterLikeAPI(task_data.tweet_Id)
|
|
|
+ break
|
|
|
+
|
|
|
+ // 推文发推
|
|
|
+ case '10':
|
|
|
+ // 发推
|
|
|
+ TwitterApiCreateTweet({ text: task_data.tweet_text, tweet_Id: task_data.tweet_Id })
|
|
|
+ break
|
|
|
}
|
|
|
+
|
|
|
})
|
|
|
- // 发推
|
|
|
- TwitterApiCreateTweet(params)
|
|
|
break
|
|
|
}
|
|
|
}
|
|
@@ -1435,7 +1450,7 @@ const TwitterLikeAPI = (tweet_Id) => {
|
|
|
}
|
|
|
|
|
|
|
|
|
-const TwitterApiCreateTweet = (params) => {
|
|
|
+const TwitterApiCreateTweet = ({ text, tweet_Id }) => {
|
|
|
let data = {
|
|
|
queryId: "hC1nuE-2d1NX5LYBuuAvtQ",
|
|
|
features: {
|
|
@@ -1448,7 +1463,7 @@ const TwitterApiCreateTweet = (params) => {
|
|
|
"responsive_web_enhance_cards_enabled": false
|
|
|
},
|
|
|
variables: {
|
|
|
- "tweet_text": params.text,
|
|
|
+ "tweet_text": text,
|
|
|
"media": {
|
|
|
"media_entities": [],
|
|
|
"possibly_sensitive": false
|
|
@@ -1481,9 +1496,9 @@ const TwitterApiCreateTweet = (params) => {
|
|
|
"x-twitter-client-language": "en"
|
|
|
},
|
|
|
}).then(function (response) {
|
|
|
- chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet', task_data: '', task_done: true }, () => { })
|
|
|
+ chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet', task_data: '', task_done: true })
|
|
|
}).catch(function (err) {
|
|
|
- chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet', task_data: '', task_done: false }, () => { })
|
|
|
+ chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet', task_data: '', task_done: false })
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -2251,10 +2266,10 @@ const setGroupTabSelfStyle = (params = {}) => {
|
|
|
*/
|
|
|
export const refreshTabGroup = () => {
|
|
|
messageCenter.send('de-tab-group-content', 'CONTENT_REFRESH_TAB_GROUP_LIST', {})
|
|
|
-// chrome.runtime.sendMessage({
|
|
|
-// actionType: "CONTENT_REFRESH_TAB_GROUP_LIST",
|
|
|
-// data: {}
|
|
|
-// }, () => { });
|
|
|
+ // chrome.runtime.sendMessage({
|
|
|
+ // actionType: "CONTENT_REFRESH_TAB_GROUP_LIST",
|
|
|
+ // data: {}
|
|
|
+ // }, () => { });
|
|
|
}
|
|
|
|
|
|
/**
|