mirror of
https://github.com/snachodog/tok-to-insta-follower-bridge.git
synced 2025-04-09 13:41:23 -06:00
feat: support 2fA
This commit is contained in:
parent
7e79d62a10
commit
1df5e2ba76
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "sky-follower-bridge",
|
||||
"displayName": "Sky Follower Bridge",
|
||||
"version": "0.9.4",
|
||||
"version": "0.9.5",
|
||||
"description": "Instantly find and follow the same users from your Twitter follows on Bluesky.",
|
||||
"author": "kawamataryou",
|
||||
"scripts": {
|
||||
|
@ -46,6 +46,7 @@ const App = () => {
|
||||
body: {
|
||||
identifier: string;
|
||||
password: string;
|
||||
authFactorToken?: string;
|
||||
};
|
||||
},
|
||||
_sender: chrome.runtime.MessageSender,
|
||||
@ -56,6 +57,9 @@ const App = () => {
|
||||
identifier: message.body.identifier,
|
||||
password: message.body.password,
|
||||
messageName: message.name,
|
||||
...(message.body.authFactorToken && {
|
||||
authFactorToken: message.body.authFactorToken,
|
||||
}),
|
||||
})
|
||||
.then(() => {
|
||||
sendResponse({ hasError: false });
|
||||
|
@ -4,6 +4,7 @@ import { sendToBackground } from "@plasmohq/messaging";
|
||||
export type BskyLoginParams = {
|
||||
identifier: string;
|
||||
password: string;
|
||||
authFactorToken?: string;
|
||||
};
|
||||
|
||||
export class BskyServiceWorkerClient {
|
||||
@ -14,6 +15,7 @@ export class BskyServiceWorkerClient {
|
||||
public static async createAgent({
|
||||
identifier,
|
||||
password,
|
||||
authFactorToken,
|
||||
}: BskyLoginParams): Promise<BskyServiceWorkerClient> {
|
||||
const client = new BskyServiceWorkerClient();
|
||||
const { session, error } = await sendToBackground({
|
||||
@ -21,6 +23,7 @@ export class BskyServiceWorkerClient {
|
||||
body: {
|
||||
identifier,
|
||||
password,
|
||||
...(authFactorToken && { authFactorToken: authFactorToken }),
|
||||
},
|
||||
});
|
||||
if (error) throw new Error(error.message);
|
||||
|
@ -196,10 +196,12 @@ export const useRetrieveBskyUsers = () => {
|
||||
identifier,
|
||||
password,
|
||||
messageName,
|
||||
authFactorToken,
|
||||
}: {
|
||||
identifier: string;
|
||||
password: string;
|
||||
messageName: (typeof MESSAGE_NAMES)[keyof typeof MESSAGE_NAMES];
|
||||
authFactorToken?: string;
|
||||
}) => {
|
||||
setRetrievalParams({
|
||||
identifier,
|
||||
@ -210,6 +212,7 @@ export const useRetrieveBskyUsers = () => {
|
||||
bskyClient.current = await BskyServiceWorkerClient.createAgent({
|
||||
identifier,
|
||||
password,
|
||||
...(authFactorToken && { authFactorToken: authFactorToken }),
|
||||
});
|
||||
|
||||
setActionMode(MESSAGE_NAME_TO_ACTION_MODE_MAP[messageName]);
|
||||
|
@ -109,7 +109,7 @@ function IndexPopup() {
|
||||
},
|
||||
});
|
||||
if (res.hasError) {
|
||||
if (res.message === AUTH_FACTOR_TOKEN_REQUIRED_ERROR_MESSAGE) {
|
||||
if (res.message.includes(AUTH_FACTOR_TOKEN_REQUIRED_ERROR_MESSAGE)) {
|
||||
setIsShowAuthFactorTokenInput(true);
|
||||
} else {
|
||||
setErrorMessage(res.message);
|
||||
@ -130,7 +130,6 @@ function IndexPopup() {
|
||||
setErrorMessage(
|
||||
"Error: Something went wrong. Please reload the web page and try again.",
|
||||
);
|
||||
console.error(e);
|
||||
}
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user