mirror of
https://github.com/Ad-closeNN/blog-fuwari.git
synced 2026-05-31 01:20:06 -04:00
feat(viewSource): 新增 CNB 源码链接
- 新增 cnb.cool 镜像源码链接(Gitea 格式 /-/blob/main/) - CNB 置顶排在 Gitea 之后第二位 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -99,6 +99,14 @@ function getGiteaRawSourceUrl(repo: string | undefined, sourcePath: string | und
|
|||||||
return `https://${giteaHost}/${encodeURIComponent(owner)}/${encodeURIComponent(repository)}/src/branch/main/${encodedSourcePath}?display=source`;
|
return `https://${giteaHost}/${encodeURIComponent(owner)}/${encodeURIComponent(repository)}/src/branch/main/${encodedSourcePath}?display=source`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCnbsSourceUrl(baseUrl: string, sourcePath: string | undefined) {
|
||||||
|
if (!sourcePath) return "";
|
||||||
|
|
||||||
|
const normalizedUrl = baseUrl.replace(/\.git$/, "").replace(/\/+$/, "");
|
||||||
|
const encodedSourcePath = sourcePath.split("/").map(encodeURIComponent).join("/");
|
||||||
|
return `${normalizedUrl}/-/blob/main/${encodedSourcePath}`;
|
||||||
|
}
|
||||||
|
|
||||||
function parseAiSummaryValue(value: string) {
|
function parseAiSummaryValue(value: string) {
|
||||||
const trimmed = value.trim();
|
const trimmed = value.trim();
|
||||||
if (!trimmed) return "";
|
if (!trimmed) return "";
|
||||||
@@ -155,6 +163,7 @@ const postSourcePath = getPostSourcePath(postSourceKey);
|
|||||||
const postSourceUrl = getGitHubPostSourceUrl(siteConfig.githubRepo, postSourcePath);
|
const postSourceUrl = getGitHubPostSourceUrl(siteConfig.githubRepo, postSourcePath);
|
||||||
const postRawSourceUrl = getGitHubRawSourceUrl(siteConfig.githubRepo, postSourcePath);
|
const postRawSourceUrl = getGitHubRawSourceUrl(siteConfig.githubRepo, postSourcePath);
|
||||||
const postGiteaRawSourceUrl = getGiteaRawSourceUrl(siteConfig.githubRepo, postSourcePath, "git.adclosenn.top");
|
const postGiteaRawSourceUrl = getGiteaRawSourceUrl(siteConfig.githubRepo, postSourcePath, "git.adclosenn.top");
|
||||||
|
const postCnbsSourceUrl = getCnbsSourceUrl("https://cnb.cool/CLN-Grated/blog-fuwari", postSourcePath);
|
||||||
const aiPrompt = `Read from ${postRawSourceUrl} so I can ask questions about it.`;
|
const aiPrompt = `Read from ${postRawSourceUrl} so I can ask questions about it.`;
|
||||||
const encodedAiPrompt = encodeURIComponent(aiPrompt);
|
const encodedAiPrompt = encodeURIComponent(aiPrompt);
|
||||||
const copyPageAiLinks = [
|
const copyPageAiLinks = [
|
||||||
@@ -163,6 +172,11 @@ const copyPageAiLinks = [
|
|||||||
icon: "cln-gitea",
|
icon: "cln-gitea",
|
||||||
href: postGiteaRawSourceUrl,
|
href: postGiteaRawSourceUrl,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "CNB",
|
||||||
|
icon: "cnb",
|
||||||
|
href: postCnbsSourceUrl,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "ChatGPT",
|
label: "ChatGPT",
|
||||||
icon: "gpt",
|
icon: "gpt",
|
||||||
@@ -298,6 +312,9 @@ const isOutdated = entry.data.outdated;
|
|||||||
{link.icon === "cln-gitea" && (
|
{link.icon === "cln-gitea" && (
|
||||||
<img aria-hidden="true" class="h-4 w-4" src="https://git.adclosenn.top/assets/img/logo.svg" alt="" />
|
<img aria-hidden="true" class="h-4 w-4" src="https://git.adclosenn.top/assets/img/logo.svg" alt="" />
|
||||||
)}
|
)}
|
||||||
|
{link.icon === "cnb" && (
|
||||||
|
<img aria-hidden="true" class="h-4 w-4" src="https://cnb.cool/images/favicon.svg" alt="" />
|
||||||
|
)}
|
||||||
<span>在 {link.label} 中打开</span>
|
<span>在 {link.label} 中打开</span>
|
||||||
</span>
|
</span>
|
||||||
<Icon is:inline name="material-symbols:open-in-new-rounded" class="text-[0.95rem] text-[var(--primary)]"></Icon>
|
<Icon is:inline name="material-symbols:open-in-new-rounded" class="text-[0.95rem] text-[var(--primary)]"></Icon>
|
||||||
|
|||||||
Reference in New Issue
Block a user