Files
voidarc-homepage/src/routes/+page.server.ts
2026-11-10 17:11:44 +00:00

41 lines
1.2 KiB
TypeScript

import type { PageServerLoad } from './$types';
import { getLatestPlaylistSong, getLatestWatchedSeries } from '#lib/server/jellyfin';
import { getLatestBook } from '#lib/server/komga';
import { getContentItems } from '#lib/server/content';
import { getLatestCommits } from '#lib/server/gitea';
import type { ContentItem } from '#lib/server/content';
import type { GitCommit } from '#lib/server/gitea';
import {
JELLYFIN_PLAYLIST_ID,
JELLYFIN_LIBRARY_ID,
KOMGA_LIBRARY_ID,
BLOG_URL,
CHANNEL_ID
} from '$app/env/private';
export const load: PageServerLoad = () => {
const latestSong = getLatestPlaylistSong(globalThis.fetch, JELLYFIN_PLAYLIST_ID);
const latestSeries = getLatestWatchedSeries(globalThis.fetch, JELLYFIN_LIBRARY_ID);
const latestBook = getLatestBook(globalThis.fetch, KOMGA_LIBRARY_ID);
const contentItems: ContentItem = getContentItems(globalThis.fetch, CHANNEL_ID, BLOG_URL);
const latestCommits: GitCommit = getLatestCommits(globalThis.fetch, 20);
latestSong.catch(() => {});
latestSeries.catch(() => {});
latestBook.catch(() => {});
contentItems.catch(() => {});
latestCommits.catch(() => {});
return {
streamed: {
latestSong,
latestSeries,
latestBook,
contentItems,
latestCommits
}
};
};