Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
各个频道授权才要登录
i5bjbz9e15550dea8d
diff --git a/src/api/twitter.ts b/src/api/twitter.tsindex da4317e6..9489d370 100644--- a/src/api/twitter.ts+++ b/src/api/twitter.ts@@ -2,7 +2,7 @@ import http from "@/utils/request";import { request } from "@/utils/request";// 获取 Twitter 授权 URL-export const getTwitterAuthUrlApi = (mail: string) => {+export const getTwitterAuthUrlApi = (mail: string) => {return request({url: '/plat/twitter/auth/url',method: 'POST',diff --git a/src/app/[lng]/accounts/plat/BilibiliLogin.ts b/src/app/[lng]/accounts/plat/BilibiliLogin.tsindex 68863a72..d1042d05 100644--- a/src/app/[lng]/accounts/plat/BilibiliLogin.ts+++ b/src/app/[lng]/accounts/plat/BilibiliLogin.ts@@ -2,7 +2,7 @@ import qs from "qs";import { PlatType } from "@/app/config/platConfig";import { apiGetBilibiliLoginUrl, apiCheckBilibiliAuth } from "@/api/plat/bilibili";import { useAccountStore } from "@/store/account";-+import { useUserStore } from "@/store/user";/**@@ -13,6 +13,10 @@ export async function bilibiliSkip(platType: PlatType) {if (platType !== PlatType.BILIBILI) return;const res: any = await apiGetBilibiliLoginUrl('pc');+ if (res?.code == 1) {+ useUserStore.getState().logout();+ return+ }if (res?.code !== 0) return;const url = res.data.url;window.open(`${url}`);diff --git a/src/app/[lng]/accounts/plat/FacebookLogin.ts b/src/app/[lng]/accounts/plat/FacebookLogin.tsindex bb4281e1..a8461100 100644--- a/src/app/[lng]/accounts/plat/FacebookLogin.ts+++ b/src/app/[lng]/accounts/plat/FacebookLogin.ts@@ -5,6 +5,7 @@ import { useAccountStore } from "@/store/account";// 导入Facebook页面选择弹窗import FacebookPagesModal from "@/components/FacebookPagesModal";+import { useUserStore } from "@/store/user";/*** Facebook被点击@@ -14,6 +15,10 @@ export async function facebookSkip(platType: PlatType) {if (platType !== PlatType.Facebook) return;const res: any = await getFacebookAuthUrlApi('pc');+ if (res?.code == 1) {+ useUserStore.getState().logout();+ return+ }if (res?.code !== 0) return;const url = res.data.url;window.open(`${url}`);diff --git a/src/app/[lng]/accounts/plat/InstagramLogin.ts b/src/app/[lng]/accounts/plat/InstagramLogin.tsindex fd635ae3..a1eb0fe7 100644--- a/src/app/[lng]/accounts/plat/InstagramLogin.ts+++ b/src/app/[lng]/accounts/plat/InstagramLogin.ts@@ -2,7 +2,7 @@ import qs from "qs";import { PlatType } from "@/app/config/platConfig";import { getInstagramAuthUrlApi, checkMetaAuthApi } from "@/api/platAuth";import { useAccountStore } from "@/store/account";-+import { useUserStore } from "@/store/user";/**@@ -13,6 +13,10 @@ export async function instagramSkip(platType: PlatType) {if (platType !== PlatType.Instagram) return;const res: any = await getInstagramAuthUrlApi('pc');+ if (res?.code == 1) {+ useUserStore.getState().logout();+ return+ }if (res?.code !== 0) return;const url = res.data.url;window.open(`${url}`);diff --git a/src/app/[lng]/accounts/plat/PinterestLogin.ts b/src/app/[lng]/accounts/plat/PinterestLogin.tsindex bfdc12fd..f5c1d4d0 100644--- a/src/app/[lng]/accounts/plat/PinterestLogin.ts+++ b/src/app/[lng]/accounts/plat/PinterestLogin.ts@@ -2,17 +2,21 @@ import qs from "qs";import { PlatType } from "@/app/config/platConfig";import { getPinterestAuthUrlApi, checkPinterestAuthApi } from "@/api/platAuth";import { useAccountStore } from "@/store/account";-+import { useUserStore } from "@/store/user";/**- * b站被点击+ * Pinterest被点击* @param platType*/export async function pinterestSkip(platType: PlatType) {if (platType !== PlatType.Pinterest) return;const res: any = await getPinterestAuthUrlApi('pc');+ if (res?.code == 1) {+ useUserStore.getState().logout();+ return+ }if (res?.code !== 0) return;const url = res.data.uri;window.open(`${url}`);diff --git a/src/app/[lng]/accounts/plat/ThreadsLogin.ts b/src/app/[lng]/accounts/plat/ThreadsLogin.tsindex 3eb834d5..789fdcfc 100644--- a/src/app/[lng]/accounts/plat/ThreadsLogin.ts+++ b/src/app/[lng]/accounts/plat/ThreadsLogin.ts@@ -2,7 +2,7 @@ import qs from "qs";import { PlatType } from "@/app/config/platConfig";import { getThreadsAuthUrlApi, checkMetaAuthApi } from "@/api/platAuth";import { useAccountStore } from "@/store/account";-+import { useUserStore } from "@/store/user";/**@@ -13,6 +13,11 @@ export async function threadsSkip(platType: PlatType) {if (platType !== PlatType.Threads) return;const res: any = await getThreadsAuthUrlApi('pc');+ if (res?.code == 1) {+ useUserStore.getState().logout();+ return+ }+if (res?.code !== 0) return;const url = res.data.url;window.open(`${url}`);diff --git a/src/app/[lng]/accounts/plat/TiktokLogin.ts b/src/app/[lng]/accounts/plat/TiktokLogin.tsindex d18dabd6..8c7ab665 100644--- a/src/app/[lng]/accounts/plat/TiktokLogin.ts+++ b/src/app/[lng]/accounts/plat/TiktokLogin.ts@@ -2,7 +2,7 @@ import qs from "qs";import { PlatType } from "@/app/config/platConfig";import { checkTiktokAuthApi, getTiktokAuthUrlApi } from "@/api/platAuth";import { useAccountStore } from "@/store/account";-+import { useUserStore } from "@/store/user";/**@@ -13,6 +13,10 @@ export async function tiktokSkip(platType: PlatType) {if (platType !== PlatType.Tiktok) return;const res: any = await getTiktokAuthUrlApi('pc');+ if (res?.code == 1) {+ useUserStore.getState().logout();+ return+ }if (res?.code !== 0) return;const url = res.data.url;window.open(`${url}`);diff --git a/src/app/[lng]/accounts/plat/TwtterLogin.ts b/src/app/[lng]/accounts/plat/TwtterLogin.tsindex 729537ea..a463eb17 100644--- a/src/app/[lng]/accounts/plat/TwtterLogin.ts+++ b/src/app/[lng]/accounts/plat/TwtterLogin.ts@@ -1,8 +1,8 @@import qs from "qs";import { PlatType } from "@/app/config/platConfig";-import { getTwitterAuthUrlApi, apiCheckTwitterAuth } from "@/api/twitter";+import { getTwitterAuthUrlApi, apiCheckTwitterAuth } from "@/api/twitter";import { useAccountStore } from "@/store/account";-+import { useUserStore } from "@/store/user";/**@@ -13,6 +13,10 @@ export async function twitterSkip(platType: PlatType) {if (platType !== PlatType.Twitter) return;const res: any = await getTwitterAuthUrlApi('pc');+ if (res?.code == 1) {+ useUserStore.getState().logout();+ return+ }if (res?.code !== 0) return;const url = res.data.url;window.open(`${url}`);diff --git a/src/app/[lng]/accounts/plat/WxGzh.ts b/src/app/[lng]/accounts/plat/WxGzh.tsindex 25aae690..6d68f387 100644--- a/src/app/[lng]/accounts/plat/WxGzh.ts+++ b/src/app/[lng]/accounts/plat/WxGzh.ts@@ -2,7 +2,7 @@ import qs from "qs";import { PlatType } from "@/app/config/platConfig";import { checkWxGzAuthApi, getWxGzhAuthUrlApi } from "@/api/platAuth";import { useAccountStore } from "@/store/account";-+import { useUserStore } from "@/store/user";/**@@ -13,6 +13,10 @@ export async function wxGzhSkip(platType: PlatType) {if (platType !== PlatType.WxGzh) return;const res: any = await getWxGzhAuthUrlApi('pc');+ if (res?.code == 1) {+ useUserStore.getState().logout();+ return+ }if (res?.code !== 0) return;const url = res.data.url;window.open(`${url}`);diff --git a/src/app/[lng]/accounts/plat/YoutubeLogin.ts b/src/app/[lng]/accounts/plat/YoutubeLogin.tsindex 4cd8f633..1dc0061b 100644--- a/src/app/[lng]/accounts/plat/YoutubeLogin.ts+++ b/src/app/[lng]/accounts/plat/YoutubeLogin.ts@@ -2,7 +2,7 @@ import qs from "qs";import { PlatType } from "@/app/config/platConfig";import { getYouTubeAuthUrlApi, apiCheckYoutubeAuth } from "@/api/platAuth";import { useAccountStore } from "@/store/account";-+import { useUserStore } from "@/store/user";/**@@ -13,6 +13,10 @@ export async function youtubeSkip(platType: PlatType) {if (platType !== PlatType.YouTube) return;const res: any = await getYouTubeAuthUrlApi('pc');+ if (res?.code == 1) {+ useUserStore.getState().logout();+ return+ }if (res?.code !== 0) return;const url = res.data.url;window.open(`${url}`);diff --git a/src/app/[lng]/accounts/plat/kwaiLogin.ts b/src/app/[lng]/accounts/plat/kwaiLogin.tsindex 4a6824ef..c10c37f3 100644--- a/src/app/[lng]/accounts/plat/kwaiLogin.ts+++ b/src/app/[lng]/accounts/plat/kwaiLogin.ts@@ -2,15 +2,21 @@ import { PlatType } from "@/app/config/platConfig";import { createKwaiAuth, getKwaiAuthStatus } from "@/api/plat/kwai";import { sleep } from "@/utils";import { useAccountStore } from "@/store/account";+import { useUserStore } from "@/store/user";export async function kwaiSkip(platType: PlatType) {const res = await createKwaiAuth("pc");+ if (res?.code == 1) {+ useUserStore.getState().logout();+ return+ }if (!res?.data) return;window.open(res?.data.url);let queryCount = 0;while (queryCount < 120) {const autoStatusRes = await getKwaiAuthStatus(res.data.taskId);+if (!autoStatusRes?.data) break;if (autoStatusRes.data.status === 1) {useAccountStore.getState().getAccountList();