feat: use version service for docs archive switcher (#30675)

This commit is contained in:
bo0tzz 2026-08-12 13:36:33 +02:00 committed by GitHub
parent 199723261c
commit 0344c61e4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 6 additions and 399 deletions

View file

@ -2,6 +2,8 @@ import { useWindowSize } from '@docusaurus/theme-common';
import DropdownNavbarItem from '@theme/NavbarItem/DropdownNavbarItem';
import React, { useEffect, useState } from 'react';
const ARCHIVED_VERSIONS_URL = 'https://version.immich.cloud/v1/docs/versions';
export default function VersionSwitcher(): JSX.Element {
const [versions, setVersions] = useState([]);
const [activeLabel, setLabel] = useState('Versions');
@ -11,12 +13,7 @@ export default function VersionSwitcher(): JSX.Element {
useEffect(() => {
async function getVersions() {
try {
let baseUrl = 'https://docs.immich.app';
if (window.location.origin === 'http://localhost:3005') {
baseUrl = window.location.origin;
}
const response = await fetch(`${baseUrl}/archived-versions.json`);
const response = await fetch(ARCHIVED_VERSIONS_URL);
const archiveVersions = await response.json();