diff --git a/src/components/widget/Profile.astro b/src/components/widget/Profile.astro index 58bb748..bf9c974 100644 --- a/src/components/widget/Profile.astro +++ b/src/components/widget/Profile.astro @@ -147,16 +147,16 @@ fetch("https://v1.hitokoto.cn") statsElement.textContent = 'Err. invalid domain name'; } // 第一步:调用 API - const githubResponse = await fetch(`https://api.adclosenn.top/.netlify/functions/commit`); + const githubResponse = await fetch(`https://api.github.com/repos/Ad-closeNN/blog-fuwari/commits?per_page=1`); if (!githubResponse.ok) { throw new Error('获取信息失败'); } - const Data = await githubResponse.json(); - + let Data = await githubResponse.json(); + Data = Data[0]; // 第二步:获取 Commit 数据 - const latestCommit = Data + const latestCommit = Data; const commitData = { hash: latestCommit.sha.slice(0, 7), diff --git a/src/content/spec/info.md b/src/content/spec/info.md index 9547448..c7bb9ee 100644 --- a/src/content/spec/info.md +++ b/src/content/spec/info.md @@ -45,16 +45,17 @@ statsElement.textContent = 'Err. invalid domain name'; } // 第一步:调用 API - const githubResponse = await fetch(`https://api.adclosenn.top/.netlify/functions/commit`); + const githubResponse = await fetch(`https://api.github.com/repos/Ad-closeNN/blog-fuwari/commits?per_page=1`); if (!githubResponse.ok) { throw new Error('获取信息失败'); } - const Data = await githubResponse.json(); + let Data = await githubResponse.json(); + Data = Data[0]; // 第二步:获取 Commit 数据 - const latestCommit = Data + const latestCommit = Data; const commitData = { hash: latestCommit.sha.slice(0, 7), diff --git a/src/pages/friends.astro b/src/pages/friends.astro index adc93e1..f1cda34 100644 --- a/src/pages/friends.astro +++ b/src/pages/friends.astro @@ -16,9 +16,9 @@ import { Icon } from "astro-icon/components";
-
Netlify(本站托管平台)
+
Netlify(主站托管平台)
-
AWS CDN,优选后简直不要太香!
+
亚马逊 AWS CDN
@@ -126,7 +126,34 @@ import { Icon } from "astro-icon/components"; diff --git a/src/plugins/rehype-component-github-card.mjs b/src/plugins/rehype-component-github-card.mjs index e37e948..4a4226b 100644 --- a/src/plugins/rehype-component-github-card.mjs +++ b/src/plugins/rehype-component-github-card.mjs @@ -64,7 +64,7 @@ export function GithubCardComponent(properties, children) { document.getElementById('${cardUuid}-forks').innerText = Intl.NumberFormat('en-us', { notation: "compact", maximumFractionDigits: 1 }).format(data.forks).replaceAll("\u202f", ''); document.getElementById('${cardUuid}-stars').innerText = Intl.NumberFormat('en-us', { notation: "compact", maximumFractionDigits: 1 }).format(data.stargazers_count).replaceAll("\u202f", ''); const avatarEl = document.getElementById('${cardUuid}-avatar'); - avatarEl.style.backgroundImage = 'url(' + data.owner.avatar_url + ')'; + avatarEl.style.backgroundImage = 'url(' + data.owner.avatar_url.replace("https://avatars.githubusercontent.com", "https://avatars.gh.api.adclosenn.dev") + ')'; avatarEl.style.backgroundColor = 'transparent'; document.getElementById('${cardUuid}-license').innerText = data.license?.spdx_id || "no-license"; document.getElementById('${cardUuid}-card').classList.remove("fetch-waiting");