mirror of
https://github.com/snachodog/tok-to-insta-follower-bridge.git
synced 2025-04-17 17:22:23 -06:00
feat: support 2fA
This commit is contained in:
parent
e9f8d3de46
commit
8abfc4de5c
@ -32,6 +32,7 @@ const STORAGE_PREFIX = "sky_follower_bridge_storage";
|
|||||||
export const STORAGE_KEYS = {
|
export const STORAGE_KEYS = {
|
||||||
BSKY_USER_ID: `${STORAGE_PREFIX}_bsky_password`,
|
BSKY_USER_ID: `${STORAGE_PREFIX}_bsky_password`,
|
||||||
BSKY_PASSWORD: `${STORAGE_PREFIX}_bsky_user`,
|
BSKY_PASSWORD: `${STORAGE_PREFIX}_bsky_user`,
|
||||||
|
BSKY_SHOW_AUTH_FACTOR_TOKEN_INPUT: `${STORAGE_PREFIX}_bsky_show_auth_factor_token_input`,
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const TARGET_URLS_REGEX = {
|
export const TARGET_URLS_REGEX = {
|
||||||
|
@ -49,12 +49,21 @@ function IndexPopup() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const saveShowAuthFactorTokenInputToStorage = (value: boolean) => {
|
||||||
|
chrome.storage.local.set({
|
||||||
|
[STORAGE_KEYS.BSKY_SHOW_AUTH_FACTOR_TOKEN_INPUT]: value,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const loadCredentialsFromStorage = useCallback(async () => {
|
const loadCredentialsFromStorage = useCallback(async () => {
|
||||||
chrome.storage.local.get(
|
chrome.storage.local.get(
|
||||||
[STORAGE_KEYS.BSKY_PASSWORD, STORAGE_KEYS.BSKY_USER_ID],
|
[STORAGE_KEYS.BSKY_PASSWORD, STORAGE_KEYS.BSKY_USER_ID, STORAGE_KEYS.BSKY_SHOW_AUTH_FACTOR_TOKEN_INPUT],
|
||||||
(result) => {
|
(result) => {
|
||||||
setPassword(result[STORAGE_KEYS.BSKY_PASSWORD] || "");
|
setPassword(result[STORAGE_KEYS.BSKY_PASSWORD] || "");
|
||||||
setIdentifier(result[STORAGE_KEYS.BSKY_USER_ID] || "");
|
setIdentifier(result[STORAGE_KEYS.BSKY_USER_ID] || "");
|
||||||
|
setIsShowAuthFactorTokenInput(
|
||||||
|
result[STORAGE_KEYS.BSKY_SHOW_AUTH_FACTOR_TOKEN_INPUT] || false,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}, []);
|
}, []);
|
||||||
@ -111,10 +120,12 @@ function IndexPopup() {
|
|||||||
if (res.hasError) {
|
if (res.hasError) {
|
||||||
if (res.message.includes(AUTH_FACTOR_TOKEN_REQUIRED_ERROR_MESSAGE)) {
|
if (res.message.includes(AUTH_FACTOR_TOKEN_REQUIRED_ERROR_MESSAGE)) {
|
||||||
setIsShowAuthFactorTokenInput(true);
|
setIsShowAuthFactorTokenInput(true);
|
||||||
|
saveShowAuthFactorTokenInputToStorage(true);
|
||||||
} else {
|
} else {
|
||||||
setErrorMessage(res.message);
|
setErrorMessage(res.message);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
saveShowAuthFactorTokenInputToStorage(false);
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user