diff --git a/.env.example b/.env.example index efd49c6b..1877b30b 100644 --- a/.env.example +++ b/.env.example @@ -7,3 +7,6 @@ NUXT_RESEND_API_KEY= DEVTO_TOKEN= NUXT_SOCIAL_NETWORKS_BLUESKY_PASSWORD= NUXT_SESSION_PASSWORD= + +NUXT_TWITCH_CLIENT_ID= +NUXT_TWITCH_CLIENT_SECRET= diff --git a/nuxt.config.ts b/nuxt.config.ts index 7565a885..db53ddea 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -12,6 +12,10 @@ export default defineNuxtConfig({ sessionPassword: '', // emailing ideas resendApiKey: '', + twitch: { + clientId: '', + clientSecret: '', + }, github: { // my GH ID id: 'MDQ6VXNlcjI4NzA2Mzcy', @@ -165,6 +169,7 @@ export default defineNuxtConfig({ image: { domains: [ + 'static-cdn.jtvnw.net', 'avatars.githubusercontent.com', 's3.nl-ams.scw.cloud', 'cdn.bsky.social', diff --git a/src/components/TheTalks.server.vue b/src/components/TheTalks.server.vue index c3e92e6b..b82d9586 100644 --- a/src/components/TheTalks.server.vue +++ b/src/components/TheTalks.server.vue @@ -52,19 +52,33 @@ const upcomingConferences = [ // } // } -const { data: talks } = await useAsyncData( - () => - ((process.server || process.dev) as true) && - import('../data/talks.json').then(r => r.default as any as Talk[]), - { - transform: talks => - (talks - ?.sort( +const [{ data: talks }, { data: streams }] = await Promise.all([ + useAsyncData( + () => + ((process.server || process.dev) as true) && + import('../data/talks.json').then(r => r.default as any as Talk[]), + { + transform: talks => + talks.sort( (a, b) => new Date(b.date).getTime() - new Date(a.date).getTime() - ) - .map(formatDateField) as Talk[]) || [], - } -) + ), + } + ), + useFetch('/api/streams', { + transform: streams => + streams.slice(0, 4).map(stream => ({ + title: stream.title, + thumbnail: stream.thumbnail_url + .replace('%{width}', '1200') + .replace('%{height}', '630'), + source: 'Twitch', + link: stream.url, + date: stream.created_at, + type: 'video', + video: stream.url, + })), + }), +])