feat: move images to b2 and route through bunny

This commit is contained in:
Cory Dransfeldt 2024-07-10 08:57:00 -07:00
parent cb2d536189
commit 6a338ceb92
No known key found for this signature in database
32 changed files with 322 additions and 375 deletions

View file

@ -66,7 +66,10 @@ const fetchAllPosts = async () => {
while (fetchMore) {
const { data, error } = await supabase
.from('posts')
.select('*')
.select(`
*,
image(filename_disk)
`)
.order('date', { ascending: false })
.range(page * PAGE_SIZE, (page + 1) * PAGE_SIZE - 1)
@ -78,17 +81,17 @@ const fetchAllPosts = async () => {
if (data.length < PAGE_SIZE) fetchMore = false
for (const post of data) {
if (uniqueSlugs.has(post.slug)) continue
if (uniqueSlugs.has(post['slug'])) continue
uniqueSlugs.add(post.slug)
post.tags = await fetchTagsForPost(post.id)
post.blocks = await fetchBlocksForPost(post.id)
post['tags'] = await fetchTagsForPost(post['id'])
post['blocks'] = await fetchBlocksForPost(post['id'])
if (post?.['image']?.['filename_disk']) post['image'] = post['image']['filename_disk']
posts.push(post)
}
page++
}
return posts
}