惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
IT之家
IT之家
博客园 - 聂微东
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed
人人都是产品经理
人人都是产品经理
PCI Perspectives
PCI Perspectives
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 叶小钗
V
Vulnerabilities – Threatpost
美团技术团队
S
Secure Thoughts
N
News | PayPal Newsroom
L
LINUX DO - 最新话题
腾讯CDC
Application and Cybersecurity Blog
Application and Cybersecurity Blog
雷峰网
雷峰网
B
Blog
MyScale Blog
MyScale Blog
T
The Blog of Author Tim Ferriss
TaoSecurity Blog
TaoSecurity Blog
N
News and Events Feed by Topic
Blog — PlanetScale
Blog — PlanetScale
C
Check Point Blog
T
Tailwind CSS Blog
月光博客
月光博客
Simon Willison's Weblog
Simon Willison's Weblog
Hacker News: Ask HN
Hacker News: Ask HN
The Last Watchdog
The Last Watchdog
Google DeepMind News
Google DeepMind News
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
MongoDB | Blog
MongoDB | Blog
S
Security @ Cisco Blogs
Jina AI
Jina AI
Engineering at Meta
Engineering at Meta
S
Security Affairs
Forbes - Security
Forbes - Security
P
Palo Alto Networks Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
T
Tor Project blog
O
OpenAI News
L
Lohrmann on Cybersecurity
Security Archives - TechRepublic
Security Archives - TechRepublic
P
Proofpoint News Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
LangChain Blog
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More

齐物 on 老刘博客

Arch Linux 电源优化指南 Ubuntu 26.04 用了一个月 告别 PaperMod:审美疲劳后的 Hugo 博客“换装”记 Ubuntu25.10编译安装Ibus-libpinyin 博客托管平台换成edgeone pages 博客评论换回Giscus EndeavourOS + Btrfs + Snapper + GRUB:完整的快照回滚系统配置指南 给Hugo PaperMod主题添加一个漂亮又简洁的友情链接页面 群晖NAS安装FRP客户端(frpc) Ubuntu24.04安装Windterm 从 Windows 到 Linux:重新体验的过程与心得 解决腾讯 EdgeOne 域名解析与 SSL 证书申请失败问题 折腾杀毒软件的一点感想 开箱|媳妇的华为 Watch Fit 4 Ghost 博客与 Mailgun 邮件服务申请全流程 Ubuntu部署ghost博客所踩的小坑 当GitHub二次验证丢失:我的完整恢复经历 在群晖里安装简单的笔记软件flatnotes 手机上有好用的输入法吗? 再次使用 KeepassXC进行密码管理 解决Windows11打开安全中心空白的方法 修汽车空调 给Hugo PaperMod增加giscus评论系统 2024年,高德地图和百度地图选哪个? 电视和投影仪,哪个对孩子的眼睛更好? 使用Fcitx5 for Android,读《万历十五年》 2024年 Web 开发趋势 利用cloudflare页面规则设置301永久跳转 初冬时节话镜片防雾 在群晖中使用tailscale实现内网穿透 EndeavourOS安装之后的几件事 Hugo-papermod主题的优化记录 视光周刊(第9期):年轻的时候近视,年老不花眼? 从WordPress转到Hugo 思源笔记群晖正确的部署方法 近视人群夏季佩戴太阳镜的几种方案 在manjaro中安装使用Rime并启用雾凇输入法 开始试用小狼毫输入法 使用群晖自动备份网站 manjaro安装配置fcitx5输入法 没有公网IP也能玩转群晖DDNS ubuntu20.10升级编译安装ibus-libpinyin输入法 电波表如何接收日本电波对时塔的信号 奇葩的京东无线宝 keepass加群辉实现数据同步及浏览器自动填充密码(二) zerotier加openwrt路由实现内网穿透控制群晖 打造一个安全的宝塔面板服务器环境 网易词典笔2.0简单开箱 给鱼缸上了沼泽过滤 破磨边机,早晚换了你 Apple iPad第七代使用小计 使用群晖,配置打印机,实现无线打印机的功能 宝塔面板安装FRP内网穿透控制群晖 推荐一款免费的视频剪辑软件shotcut 使用zerotier进行内网穿透 再次折腾黑群晖系统 记暴风酷播云2期折腾黑群晖 WordPress开启Nginx fastcgi_cache缓存加速 lnmp一键开启waf及使用 Fail2Ban防护 给7B2主题加上外链自动跳转功能 这次发现百度收录的挺快的 百度输入法小测 黑莓8830上网利器之浏览器 做博客比做网站难 网站又搬家了—这次选的衡天小张的服务器 换到pipni的空间了 杯具,原来上传的图片等都没有能转过来 换了个模板 小测三款博客离线编辑软件 开发出godaddy免费空间的另外一个用途 体验了下失而复得 解决godaddy免费空间广告带来影响的方法 小测QQ刚推出的webqq mini wordpress中文tag、中文分类找不到文章的解决方法 提供WordPress 主题 Marcelle的汉化版本 博客整体细节基本完成 虚惊一场 如何增加WordPress上传文件类型 ubuntu9.10 sis显卡驱动程序 聪明的宝宝 lnkillprocess.exe – DLL 初始化失败终极解决方案 lnkillprocess.exe-dll初始化失败的原因终于找到了 如何安全使用计算机4 如何安全使用计算机 3 如何安全使用计算机 2 如何安全使用计算机 1 KPI考评——企业绩效管理的基础 推荐大家使用Symantec Endpoint Protection 11.0.4000_MR4简体中文正式版
把GotoSocial嵌入到Hugo
老刘 · 2025-10-21 · via 齐物 on 老刘博客
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160

export default {
  async fetch(request, env) {
    const url = new URL(request.url);
    const headers = {
      "Access-Control-Allow-Origin": "*",
      "Access-Control-Allow-Methods": "GET, OPTIONS",
      "Access-Control-Allow-Headers": "*",
    };

    if (request.method === "OPTIONS") {
      return new Response(null, { headers });
    }

    const target = `https://你的域名${url.pathname}${url.search}`;
    const resp = await fetch(target, {
      headers: {
        "Authorization": "Bearer " + env.GTS_TOKEN,
        "User-Agent": "GTS-Proxy-Worker",
      },
    });

    if (!resp.ok) {
      return new Response(await resp.text(), {
        status: resp.status,
        headers: { ...headers, "Content-Type": "application/json" },
      });
    }

    const data = await resp.json();
细步骤
    // 并行拉取每条嘟文的回复
    const statuses = await Promise.all(data.map(async (status) => {
      let replies = [];
      try {
        const ctx = await fetch(`https://你的域名/api/v1/statuses/${status.id}/context`, {
          headers: { "Authorization": "Bearer " + env.GTS_TOKEN },
        });
        if (ctx.ok) {
          const contextData = await ctx.json();
          replies = contextData?.descendants?.map(r => ({
            id: r.id,
            content: r.content,
            account: {<details>
<summary>点击展开查看完整的配置代码大约 100 </summary>
              username: r.account?.username,
              display_name: r.account?.display_name,
              avatar完全正确 : r.account?.avatar,
            }
          })) || [];
        }
      } catch (err) {
        console.log("Reply fetch failed:", err);
      }

      return {
        id: status.id,
        created_at: status.created_at,
        content: status.content,
        url: status.url,
        account: {
          username: status.account?.username,
          display_name: statuexport default {
  async fetch(request, env) {
    const url = new URL(request.url);
    const headers = {
      "Access-Control-Allow-Origin": "*",
      "Access-Control-Allow-Methods": "GET, OPTIONS",
      "Access-Control-Allow-Headers": "*",
    };

    if (request.method === "OPTIONS") {
      return new Response(null, { headers });
    }

    const target = `https://l22.org${url.pathname}${url.search}`;
    const resp = await fetch(target, {
      headers: {
        "Authorization": "Bearer " + env.GTS_TOKEN,
        "User-Agent": "GTS-Proxy-Worker",
      },
    });

    if (!resp.ok) {
      return new Response(await resp.text(), {
        status: resp.status,
        headers: { ...headers, "Content-Type": "application/json" },
      });
    }

    const data = await resp.json();

    // 并行拉取每条嘟文的回复
    const statuses = await Promise.all(data.map(async (status) => {
      let replies = [];
      try {
        const ctx = await fetch(`https://l22.org/api/v1/statuses/${status.id}/context`, {
          headers: { "Authorization": "Bearer " + env.GTS_TOKEN },
        });
        if (ctx.ok) {
          const contextData = await ctx.json();
          replies = contextData?.descendants?.map(r => ({
            id: r.id,
            content: r.content,
            account: {
              username: r.account?.username,
              display_name: r.account?.display_name,
              avatar: r.account?.avatar,
            }
          })) || [];
        }
      } catch (err) {
        console.log("Reply fetch failed:", err);
      }

      return {
        id: status.id,
        created_at: status.created_at,
        content: status.content,
        url: status.url,
        account: {
          username: status.account?.username,
          display_name: status.account?.display_name,
          avatar: status.account?.avatar,
        },
        replies_count: status.replies_count || 0,
        reblogs_count: status.reblogs_count || 0,
        favourites_count: status.favourites_count || 0,
        media_attachments: (status.media_attachments || []).map(media => ({
          url: media.url?.startsWith("/") ? "https://域名" + media.url : media.url,
          preview_url: media.preview_url?.startsWith("/") ? "https://域名" + media.preview_url : media.preview_url,
        })),
        replies,
      };
    }));

    return new Response(JSON.stringify(statuses, null, 2), {
      headers: { ...headers, "Content-Type": "application/json" },
    });
  },
};</details>
s.account?.display_name,
          avatar: status.account?.avatar,
        },
        replies_count: status.replies_count || 0,
        reblogs_count: status.reblogs_count || 0,
        favourites_count: status.favourites_count || 0,
        media_attachments: (status.media_attachments || []).map(media => ({
          url: media.url?.startsWith("/") ? "https://你的域名" + media.url : media.url,
          preview_url: media.preview_url?.startsWith("/") ? "https://你的域名" + media.preview_url : media.preview_url,
        })),
        replies,
      };
    }));

    return new Response(JSON.stringify(statuses, null, 2), {
      headers: { ...headers, "Content-Type": "application/json" },
    });
  },
};