🐛 fix(tutorial): Comment out unused getVersion function and simplify getVersionPath

This commit is contained in:
web 2025-07-11 02:58:37 -07:00
parent 1fb305e7a1
commit 7cdc6bdd8f

View File

@ -3,22 +3,23 @@ import matter from 'gray-matter';
const BASE_URL = `${NEXT_PUBLIC_CDN_URL}/gh/perfect-panel/ppanel-tutorial`; const BASE_URL = `${NEXT_PUBLIC_CDN_URL}/gh/perfect-panel/ppanel-tutorial`;
async function getVersion() { // async function getVersion() {
// API rate limit: 60 requests per hour // // API rate limit: 60 requests per hour
const response = await fetch( // const response = await fetch(
'https://data.jsdelivr.com/v1/stats/packages/gh/perfect-panel/ppanel-tutorial/versions', // 'https://data.jsdelivr.com/v1/stats/packages/gh/perfect-panel/ppanel-tutorial/versions',
); // );
const json = await response.json(); // const json = await response.json();
return json[0].version; // return json[0].version;
} // }
async function getVersionPath() { async function getVersionPath() {
return getVersion() // return getVersion()
.then((version) => `${BASE_URL}@${version}`) // .then((version) => `${BASE_URL}@${version}`)
.catch((error) => { // .catch((error) => {
console.warn('Error fetching the version:', error); // console.warn('Error fetching the version:', error);
return `${BASE_URL}@latest`; // return `${BASE_URL}@latest`;
}); // });
return `${BASE_URL}@latest`;
} }
export async function getTutorial(path: string): Promise<{ export async function getTutorial(path: string): Promise<{