mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2026-01-20 07:03:02 -05:00
Potential fix for code scanning alert no. 2: Incomplete URL substring sanitization
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
@@ -169,11 +169,12 @@ export function WalletTab() {
|
||||
*/
|
||||
useEffect(() => {
|
||||
// Check if we're in a Farcaster client environment
|
||||
const isInFarcasterClient = typeof window !== 'undefined' &&
|
||||
(window.location.href.includes('warpcast.com') ||
|
||||
window.location.href.includes('farcaster') ||
|
||||
window.ethereum?.isFarcaster ||
|
||||
context?.client);
|
||||
const isInFarcasterClient = typeof window !== 'undefined' && (() => {
|
||||
const hostname = window.location.hostname.toLowerCase();
|
||||
const isWarpcastHost = hostname === 'warpcast.com' || hostname.endsWith('.warpcast.com');
|
||||
const isFarcasterHost = hostname === 'farcaster.com' || hostname.endsWith('.farcaster.com');
|
||||
return isWarpcastHost || isFarcasterHost || window.ethereum?.isFarcaster || context?.client;
|
||||
})();
|
||||
|
||||
if (context?.user?.fid && !isConnected && connectors.length > 0 && isInFarcasterClient) {
|
||||
console.log("Attempting auto-connection with Farcaster context...");
|
||||
|
||||
Reference in New Issue
Block a user