Update docs

This commit is contained in:
Alan Grainger
2026-10-08 08:57:34 +13:00
parent aacbc1d79c
commit dbab0d3394
6 changed files with 117 additions and 28 deletions
+33 -2
View File
@@ -1,8 +1,38 @@
import { defineConfig } from 'vitepress'
import { defineConfigWithTheme, type DefaultTheme } from 'vitepress'
const REPO_URL = 'https://github.com/alangrainger/immich-public-proxy'
export default defineConfig({
/** The default theme's config plus the star count the navbar pill shows. */
export interface ThemeConfig extends DefaultTheme.Config {
/** GitHub stars at build time; the pill is omitted when undefined. */
stars?: number
}
/**
* The repo's star count, fetched once per build so visitors' browsers never
* call GitHub themselves. Undefined when the API can't be reached (a local
* build with no network, or the anonymous rate limit), which hides the pill.
* The docs workflow passes GITHUB_TOKEN for a higher limit and rebuilds
* weekly so the number stays current.
*/
async function fetchStars (): Promise<number | undefined> {
const headers: Record<string, string> = { Accept: 'application/vnd.github+json' }
if (process.env.GITHUB_TOKEN) headers.Authorization = 'Bearer ' + process.env.GITHUB_TOKEN
try {
const res = await fetch('https://api.github.com/repos/alangrainger/immich-public-proxy', {
headers,
signal: AbortSignal.timeout(5000)
})
const body = res.ok ? await res.json() : undefined
if (typeof body?.stargazers_count === 'number') return body.stargazers_count
console.warn('Star count unavailable (GitHub API status ' + res.status + '); the navbar pill is omitted.')
} catch (e) {
console.warn('Star count unavailable (' + (e instanceof Error ? e.message : String(e)) + '); the navbar pill is omitted.')
}
return undefined
}
export default async () => defineConfigWithTheme<ThemeConfig>({
title: 'Immich Public Proxy',
description: 'Share your Immich photos and albums publicly without exposing your Immich instance to the internet.',
lang: 'en-NZ',
@@ -15,6 +45,7 @@ export default defineConfig({
],
themeConfig: {
logo: '/ipp.svg',
stars: await fetchStars(),
search: {
provider: 'local'
},