diff --git a/.vscode/settings.json b/.vscode/settings.json index b1fa6443..67f4468a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,5 +3,11 @@ "Bluesky", "BSKY" ], - "editor.defaultFormatter": "biomejs.biome" + "editor.defaultFormatter": "biomejs.biome", + "[typescriptreact]": { + "editor.defaultFormatter": "vscode.typescript-language-features" + }, + "[typescript]": { + "editor.defaultFormatter": "vscode.typescript-language-features" + } } diff --git a/package-lock.json b/package-lock.json index 4c2cac34..398110c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "sky-follower-bridge", - "version": "2.9.1", + "version": "2.9.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "sky-follower-bridge", - "version": "2.9.1", + "version": "2.9.2", "dependencies": { "@atproto/api": "^0.13.12", "@changesets/cli": "^2.27.1", diff --git a/src/background/messages/login.ts b/src/background/messages/login.ts index ae885bb6..318e879d 100644 --- a/src/background/messages/login.ts +++ b/src/background/messages/login.ts @@ -4,14 +4,28 @@ import { AUTH_FACTOR_TOKEN_REQUIRED_ERROR_MESSAGE } from "~lib/constants"; import { BskyClient } from "../../lib/bskyClient"; const handler: PlasmoMessaging.MessageHandler = async (req, res) => { - const { identifier, password, authFactorToken } = req.body; + const { domain, identifier, password, authFactorToken } = req.body; + console.log("[handler] Received domain:", domain); // DEBUG domain received try { - const agent = await BskyClient.createAgent({ + // Prepare params, only include domain if truthy + const params: { + identifier: string; + password: string; + domain?: string; + authFactorToken?: string; + } = { identifier, password, - ...(authFactorToken && { authFactorToken: authFactorToken }), - }); + }; + + if (domain) params.domain = domain; + if (authFactorToken) params.authFactorToken = authFactorToken; + + console.log("[Caller] Using domain:", params.domain); + + // Pass the prepared params object here instead of hardcoded values + const agent = await BskyClient.createAgent(params); res.send({ session: agent.session, diff --git a/src/components/popup/AuthForm.tsx b/src/components/popup/AuthForm.tsx index 3e7518a3..249a9092 100644 --- a/src/components/popup/AuthForm.tsx +++ b/src/components/popup/AuthForm.tsx @@ -1,10 +1,11 @@ import { BSKY_DOMAIN } from "~lib/constants"; import { getMessageWithLink } from "~lib/utils"; - interface AuthFormProps { isLoading: boolean; password: string; setPassword: (value: string) => void; + domain: string; + setDomain: (value: string) => void; identifier: string; setIdentifier: (value: string) => void; authFactorToken: string; @@ -17,6 +18,8 @@ export const AuthForm = ({ isLoading, password, setPassword, + domain, + setDomain, identifier, setIdentifier, authFactorToken, @@ -26,6 +29,32 @@ export const AuthForm = ({ }: AuthFormProps) => { return (
+