your personal website on atproto - mirror
blento.app
1import { createCache } from '$lib/cache';
2import { getCache, loadData } from '$lib/website/load';
3import { env } from '$env/dynamic/private';
4import { json } from '@sveltejs/kit';
5import type { AppBskyActorDefs } from '@atcute/bluesky';
6
7export async function GET({ platform }) {
8 const cache = createCache(platform);
9 if (!cache) return json('no cache');
10
11 const existingUsers = await cache.get('meta', 'updatedBlentos');
12
13 const existingUsersArray: AppBskyActorDefs.ProfileViewDetailed[] = existingUsers
14 ? JSON.parse(existingUsers)
15 : [];
16
17 const existingUsersHandle = existingUsersArray.map((v) => v.handle);
18
19 for (const handle of existingUsersHandle) {
20 if (!handle) continue;
21
22 try {
23 const cached = await getCache(handle, 'self', cache);
24 if (!cached) await loadData(handle, cache, true, 'self', env);
25 } catch (error) {
26 console.error(error);
27 return json('error');
28 }
29 }
30
31 return json('ok');
32}