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