mirror of
https://github.com/jason5ng32/MyIP.git
synced 2026-11-04 08:55:47 +00:00
A pass over every file the branch touched, after the iOS animation hunt left tries and reverts behind it. Removed what nothing reaches: the view-transition rule for a transition no code starts, an unreachable guard in the transition hook, a no-op KeepAlive key branch, a sign-in guard the menu already enforces, usage-dialog wrappers that only forwarded to the store, a duplicated modifier-click check and card filter (isPlainClick / listedTools), a test that hand-rolled listedTools, a drawer-era fixture parameter. auth-flow.js folded into auth-redirect.js. Comments cut to what the code cannot say itself — file headers of a few lines, the measured iOS reasons, non-obvious orderings — and stale ones fixed (Nav under KeepAlive, Home.vue reusing DEFAULT_META, "from Nav", enabledCards). AGENTS.md sections tightened to the code as it is now. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013GbLTGMZ45MV78qd2tHoco
25 lines
1.1 KiB
JavaScript
25 lines
1.1 KiB
JavaScript
// Which Firebase auth domain this session signs in through, and which
|
|
// providers that leaves: browsers keep the shared default, the installed PWA
|
|
// may use VITE_FIREBASE_PWA_AUTH_DOMAIN (why: api/AGENTS.md "Firebase Auth
|
|
// handler proxy"). GitHub's single callback URL is on the default domain, so a
|
|
// PWA on another domain offers only Google.
|
|
|
|
const ALL_PROVIDERS = ['google', 'github'];
|
|
const DEFAULT_DOMAIN_ONLY = new Set(['github']);
|
|
|
|
const clean = (value) => (typeof value === 'string' ? value.trim() : '');
|
|
|
|
// The domain to initialise Firebase with; a blank PWA value means unset.
|
|
export const resolveAuthDomain = ({ runningAsPwa, authDomain, pwaAuthDomain }) => {
|
|
const fallback = clean(authDomain);
|
|
if (!runningAsPwa) return fallback;
|
|
return clean(pwaAuthDomain) || fallback;
|
|
};
|
|
|
|
// Sign-in provider keys (store.js SIGN_IN_PROVIDERS) usable on that domain.
|
|
export const signInProvidersFor = (inputs) => {
|
|
const domain = resolveAuthDomain(inputs);
|
|
if (domain === clean(inputs.authDomain)) return [...ALL_PROVIDERS];
|
|
return ALL_PROVIDERS.filter((key) => !DEFAULT_DOMAIN_ONLY.has(key));
|
|
};
|