~ knotless Search/
↑↓ move↵ open⇧↵ all results

johnandersen777.bsky.social/knotless

git that lives in your Atmosphere account

Forked from chadtmiller.com/knotless

0
0
22 lines · 1017 B Raw History
import type * as getRepoSettings from '#lib/lexicons/dev/knotless/getRepoSettings.ts';
import type * as getRepoStorage from '#lib/lexicons/dev/knotless/getRepoStorage.ts';
import type { PageLoad } from './$types';
import { branches, repoPage, xrpc } from '#lib/data.ts';

/**
 * A repository's settings, as its record has them now, and its branches, to
 * name the default from; and what it takes up, streamed after, as counting
 * it reads its PDS: none if that could not be read.
 */
export const load: PageLoad = async (event) => {
	const [{ repo, answer }, names] = await Promise.all([
		repoPage<typeof getRepoSettings.main>(event, 'dev.knotless.getRepoSettings'),
		branches(event)
	]);
	// The page is cached as its settings are, and its headers are sent by then.
	const quiet = { ...event, setHeaders: () => {} };
	const storage = xrpc<typeof getRepoStorage.main>(quiet, 'dev.knotless.getRepoStorage', {
		repo: repo.uri
	}).catch(() => null);
	return { repo, settings: answer, branches: names, storage };
};