JavaScript-optional public web frontend for Bluesky anartia.kelinci.net
sveltekit atcute bluesky typescript svelte
8
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: randomize casing on searchPosts

Mary 256a8ea7 62f04f57

+18 -1
+18 -1
src/routes/(app)/search/posts/+page.ts
··· 20 20 } 21 21 22 22 try { 23 - const { data } = await rpc.get('app.bsky.feed.searchPosts', { 23 + const { data } = await rpc.get(randomCase('app.bsky.feed.searchPosts', !!cursor), { 24 24 params: { 25 25 q: query, 26 26 limit: 50, ··· 46 46 throw err; 47 47 } 48 48 }; 49 + 50 + const randomCase = <T extends string>(str: T, enabled: boolean): T => { 51 + if (!enabled) { 52 + return str; 53 + } 54 + 55 + let result: string; 56 + 57 + do { 58 + result = str 59 + .split('') 60 + .map((char) => (Math.random() < 0.5 ? char.toLowerCase() : char.toUpperCase())) 61 + .join(''); 62 + } while (result === str); 63 + 64 + return result as T; 65 + };