GitHub PAT:为 AI 智能体提供的安全 GitHub 集成 - Openclaw Skills

作者:互联网

2026-04-10

AI快讯

什么是 GitHub PAT 集成?

GitHub PAT 技能为 AI 智能体通过个人访问令牌与 GitHub 仓库交互提供了一套稳健的机制。通过利用 PAT,开发者可以对授予智能体的权限保持细粒度控制,确保其仅能访问特定任务所需的仓库和操作。这种方法是 Openclaw Skills 理念的核心部分,优先考虑安全性及最小权限访问,而非广泛的 OAuth 权限。

该技能支持直接通过 CLI 界面进行广泛的版本控制操作,允许智能体克隆仓库、管理分支以及处理拉取请求(Pull Request)的完整生命周期。它专为需要在现有 GitHub 基础架构中集成 AI 驱动的编码工作流,同时保持严格安全协议的开发者而设计。

下载入口:https://github.com/openclaw/skills/tree/main/skills/dannyshmueli/github-token

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install github-token

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 github-token。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

GitHub PAT 集成 应用场景

  • 在智能体完成编码任务后,自动创建拉取请求 (PR)。
  • 克隆远程仓库,为智能体提供本地上下文以进行分析。
  • 直接从终端管理项目 Issue 和文档更新。
  • 作为 Openclaw Skills 自动化 CI/CD 流水线的一部分,将代码更改推送到特定分支。
GitHub PAT 集成 工作原理
  1. 用户在 GitHub 上生成具有所需作用域的个人访问令牌。
  2. 令牌通过命令行参数传递给智能体,或存储在配置文件中。
  3. 智能体利用基于 Python 的包装器脚本向 GitHub REST API 发送经过身份验证的请求。
  4. 执行命令以执行列出仓库、创建分支或提交代码等操作。
  5. 该技能管理交互生命周期,确保令牌的安全使用并对操作进行适当记录。

GitHub PAT 集成 配置指南

要开始使用此技能,您必须首先从您的 GitHub 帐户生成一个令牌。

  1. 导航至 github.com/settings/tokens 并创建一个新的 PAT。
  2. 选择适当的作用域(例如,repo 用于完全访问私有仓库,或 public_repo 用于公共访问)。
  3. 将令牌提供给智能体或将其存储在您的配置中。
# 示例:列出您的可用仓库
python3 scripts/gh.py repos --token YOUR_GITHUB_TOKEN

# 示例:克隆特定仓库
python3 scripts/gh.py clone owner/repo

GitHub PAT 集成 数据架构与分类体系

GitHub PAT 技能的配置和元数据组织如下:

功能 描述 存储位置
身份验证 GitHub 个人访问令牌 TOOLS.md(GitHub 部分下方)
仓库上下文 所有者和仓库名称映射 通过 CLI 参数管理
操作日志 API 调用的执行详情 本地智能体日志
作用域管理 PAT 权限的定义 GitHub 用户设置
name: github-pat
description: Interact with GitHub using Personal Access Tokens. Secure, user-controlled access - no OAuth, no full account access. Clone, push, branch, PR, issues. Use when user wants to work with GitHub repos.

GitHub PAT

Interact with GitHub using Personal Access Tokens. User controls access via PAT scopes.

Setup

User provides their PAT:

1. Create PAT at github.com/settings/tokens
2. Select scopes (repo for full, public_repo for public only)
3. Provide token to agent

Store in TOOLS.md or pass via --token.

Commands

# List repos you have access to
python3 scripts/gh.py repos [--token TOKEN]

# Clone a repo
python3 scripts/gh.py clone owner/repo [--token TOKEN]

# Create branch
python3 scripts/gh.py branch  [--repo owner/repo]

# Commit and push
python3 scripts/gh.py push "" [--branch branch] [--repo owner/repo]

# Open a pull request
python3 scripts/gh.py pr "" [--body "description"] [--base main] [--head branch]

# Create an issue
python3 scripts/gh.py issue "<title>" [--body "description"] [--repo owner/repo]

# View repo info
python3 scripts/gh.py info owner/repo
</CODE></PRE>
<H2 id=security-model>Security Model</H2>
<UL>
<LI><STRONG>User controls access</STRONG> via PAT scopes</LI>
<LI><STRONG>No OAuth</STRONG> - no "allow full access" prompts</LI>
<LI><STRONG>Least privilege</STRONG> - user creates PAT with minimal needed scopes</LI>
<LI><STRONG>Fine-grained PATs</STRONG> supported for specific repo access</LI></UL>
<H2 id=token-storage>Token Storage</H2>
<P>Agent stores token in TOOLS.md under <CODE>### GitHub</CODE> section. Never expose in logs or messages.</P>                                                        
                             
                           </div>
														                            <div class="lastanext flexRow">
							 							 							  <a class="lastart flexRow"  href="/wz/332859.html"  ><span>上一篇:</span><span>余额查询助手:AI API 额度监控 - Openclaw Skills</span></a>
							 							 
                             							                                 <a class="nextart flexRow"  href="/wz/332862.html" ><span>下一篇:</span><span>业务策略:验证创意并跟踪决策 - Openclaw Skills</span></a>
							                             </div>
                        </div>
                        <div class="dtl-xgtj">
                            <div class="jb-titles flexRow">
                                <div class="jbtle-left flexRow"><b></b><p>相关推荐</p></div>
                                
                            </div>
                            <div class="tjlist flexRow">
														                                <div class="tj-item ">
                                    <div class="tjitemd">
									
                                        <div class="tjimd-top flexRow">
                                            <a class="imdta flexRow"  href="/wz/368515.html"  >
                                                                                        <img src="https://images.jiaoben.net/uploads/20260418/logo_69e379de9e63b1.png" >
                                                                                        </a>
                                            <div class="imdt-right flexColumn">
                                                <a class="imdtra flexRow overflowclass"  href="/wz/368515.html"  >【新手零难度操作 】OpenClaw 2.6.4 安装误区规避与快速使用指南(包含最新版安装包)</a>
                                                <a class="imdtrap flexRow overflowclass"  href="/wz/368515.html"  >
                                                                                                                                     OpenClaw(小龙虾)是开源本地AI智能体工具,支持Windows一键部署(5分钟搞定),无需代码与复杂配置。具备本地运行、数据安全、零门槛操作、开箱即用等优势,可自动完成文件整理、数据提取、浏览器操控等办公自动化任务。
                                                                                                                </a>
                                            </div>
                                        </div>
									
                                        <div class="tjimd-down flexRow">
                                            <div class="imdd-tab flexRow">
                                                <p class="imddt-time flexRow"><b></b><span>2026-04-18</span></p>
                                                
                                            </div>
                                            <a  href="/wz/368515.html"   class="imdd-more flexRow flexcenter"  >立即查看</a>
                                        </div>
                                    </div>
                                </div>
								                                <div class="tj-item ">
                                    <div class="tjitemd">
									
                                        <div class="tjimd-top flexRow">
                                            <a class="imdta flexRow"  href="/wz/368514.html"  >
                                                                                        <img src="https://images.jiaoben.net/uploads/20260418/logo_69e379c6ef2641.png" >
                                                                                        </a>
                                            <div class="imdt-right flexColumn">
                                                <a class="imdtra flexRow overflowclass"  href="/wz/368514.html"  >Qwen3.6 正式发布!阿里云百炼同步开启“AI大模型节省计划”超值优惠</a>
                                                <a class="imdtrap flexRow overflowclass"  href="/wz/368514.html"  >
                                                                                                                                     阿里云发布千问Qwen3.6系列大模型,大模型官网:https://t.aliyun.com/U/JbblVp 实现编程、智能体(Agent)及多模态能力的范式跃迁:代码生成与调试更精准,原生支持LangChain等框架,工具调用更稳定,图文识别与推理全面升级。Qwen3.6-Flash轻量高效,开发体验优化。同步推出百炼「全模型通享」限时特惠,新客首月立减最高500元。
                                                                                                                </a>
                                            </div>
                                        </div>
									
                                        <div class="tjimd-down flexRow">
                                            <div class="imdd-tab flexRow">
                                                <p class="imddt-time flexRow"><b></b><span>2026-04-18</span></p>
                                                
                                            </div>
                                            <a  href="/wz/368514.html"   class="imdd-more flexRow flexcenter"  >立即查看</a>
                                        </div>
                                    </div>
                                </div>
								                                <div class="tj-item ">
                                    <div class="tjitemd">
									
                                        <div class="tjimd-top flexRow">
                                            <a class="imdta flexRow"  href="/wz/368512.html"  >
                                                                                        <img src="https://images.jiaoben.net/uploads/20260418/logo_69e379b7eeae01.png" >
                                                                                        </a>
                                            <div class="imdt-right flexColumn">
                                                <a class="imdtra flexRow overflowclass"  href="/wz/368512.html"  >办公 AI 工具 OpenClaw 部署 Windows 系统一站式教程</a>
                                                <a class="imdtrap flexRow overflowclass"  href="/wz/368512.html"  >
                                                                                                                                     OpenClaw(小龙虾)是开源本地AI智能体,无需编程、不联网、纯本地运行,3分钟一键部署。支持文件整理、表格生成、浏览器自动化等办公任务,兼顾隐私安全与零门槛易用性,专为Windows用户优化。
                                                                                                                </a>
                                            </div>
                                        </div>
									
                                        <div class="tjimd-down flexRow">
                                            <div class="imdd-tab flexRow">
                                                <p class="imddt-time flexRow"><b></b><span>2026-04-18</span></p>
                                                
                                            </div>
                                            <a  href="/wz/368512.html"   class="imdd-more flexRow flexcenter"  >立即查看</a>
                                        </div>
                                    </div>
                                </div>
								                                <div class="tj-item ">
                                    <div class="tjitemd">
									
                                        <div class="tjimd-top flexRow">
                                            <a class="imdta flexRow"  href="/wz/368508.html"  >
                                                                                        <img src="https://images.jiaoben.net/uploads/20260418/logo_69e378709859b1.png" >
                                                                                        </a>
                                            <div class="imdt-right flexColumn">
                                                <a class="imdtra flexRow overflowclass"  href="/wz/368508.html"  >OpenClaw 2.6.4 可视化部署 打造个人 AI 数字员工(包含最新版安装包)</a>
                                                <a class="imdtrap flexRow overflowclass"  href="/wz/368508.html"  >
                                                                                                                                     本教程详解Windows一键部署OpenClaw 2.6.4(本地AI智能体),5分钟完成安装,无需编程与环境配置。支持自然语言操控电脑、自动化办公、文件处理等,数据全本地运行,保障隐私安全。
                                                                                                                </a>
                                            </div>
                                        </div>
									
                                        <div class="tjimd-down flexRow">
                                            <div class="imdd-tab flexRow">
                                                <p class="imddt-time flexRow"><b></b><span>2026-04-18</span></p>
                                                
                                            </div>
                                            <a  href="/wz/368508.html"   class="imdd-more flexRow flexcenter"  >立即查看</a>
                                        </div>
                                    </div>
                                </div>
									
                                
								
                            </div>

                        </div>
                    </div>


                    <div class="cd-right dtlcd-right">
                        <div class="dtl-ht">
                            <div class="jb-titles flexRow">
                                <div class="jbtle-left flexRow"><b></b><p>专题</p></div>
                                
                            </div>
                            <div class="dtlht-list ">
							                                <div class="htl-item flexRow">
                                    <div class="htmitem-left">
                                        <div class="htiteml-top flexRow">
                                            <a href="/wz/zt-69351.html"  >#数据可视化</a>
                                            <span></span>
                                        </div>
                                        <a class="htiteml-down flexRow" href="/wz/zt-69351.html"  >数据可视化(Data Visu</a>
                                    </div>
                                    <p class="htmitem-right flexRow flexcenter gz" data-id="69351"  >+ 收藏</p>
                                </div>
							                                <div class="htl-item flexRow">
                                    <div class="htmitem-left">
                                        <div class="htiteml-top flexRow">
                                            <a href="/wz/zt-69342.html"  >#自然语言处理</a>
                                            <span></span>
                                        </div>
                                        <a class="htiteml-down flexRow" href="/wz/zt-69342.html"  >自然语言处理(Natural</a>
                                    </div>
                                    <p class="htmitem-right flexRow flexcenter gz" data-id="69342"  >+ 收藏</p>
                                </div>
							                                <div class="htl-item flexRow">
                                    <div class="htmitem-left">
                                        <div class="htiteml-top flexRow">
                                            <a href="/wz/zt-68363.html"  >#Excel公式</a>
                                            <span></span>
                                        </div>
                                        <a class="htiteml-down flexRow" href="/wz/zt-68363.html"  >Excel公式就是:用函数 +</a>
                                    </div>
                                    <p class="htmitem-right flexRow flexcenter gz" data-id="68363"  >+ 收藏</p>
                                </div>
							                                <div class="htl-item flexRow">
                                    <div class="htmitem-left">
                                        <div class="htiteml-top flexRow">
                                            <a href="/wz/zt-68355.html"  >#Excel技巧</a>
                                            <span></span>
                                        </div>
                                        <a class="htiteml-down flexRow" href="/wz/zt-68355.html"  >Excel是日常生活中必不可</a>
                                    </div>
                                    <p class="htmitem-right flexRow flexcenter gz" data-id="68355"  >+ 收藏</p>
                                </div>
							                                <div class="htl-item flexRow">
                                    <div class="htmitem-left">
                                        <div class="htiteml-top flexRow">
                                            <a href="/wz/zt-68081.html"  >#蛋仔派对</a>
                                            <span></span>
                                        </div>
                                        <a class="htiteml-down flexRow" href="/wz/zt-68081.html"  >蛋仔派对最新官方活动、关卡速</a>
                                    </div>
                                    <p class="htmitem-right flexRow flexcenter gz" data-id="68081"  >+ 收藏</p>
                                </div>
							                                <div class="htl-item flexRow">
                                    <div class="htmitem-left">
                                        <div class="htiteml-top flexRow">
                                            <a href="/wz/zt-68000.html"  >#人工智能</a>
                                            <span></span>
                                        </div>
                                        <a class="htiteml-down flexRow" href="/wz/zt-68000.html"  >人工智能(AI),简单说,就</a>
                                    </div>
                                    <p class="htmitem-right flexRow flexcenter gz" data-id="68000"  >+ 收藏</p>
                                </div>
								
                                


                            </div>
                        </div>


                        <div class="   dtl-zt">
                            <div class="jb-titles flexRow">
                                <div class="jbtle-left flexRow"><b></b><p>最新数据</p></div>
                               
                            </div>


                            <div class="wkch-downs">
																					                                <div class="weekch-top flexRow">
                                        <a class="wktpa flexRow" href="/wz/332867.html"  >
                                                                                     <img src="/jiaoben/image/noimg.png" >
                                                                                    </a>
                                    <div class="wktpa-right flexColumn">
                                        <a class="wktpara flexRow overflowclass"  href="/wz/332867.html"  >与 Taro 交易:AI 代理知识交换协议 - Openclaw Skills</a>
                                        <a class="wktparp flexRow overflowclass"  href="/wz/332867.html"  >
                                                                                            什么是 与 Taro 交易?
“
                                                                                        
                                        </a>
                                    </div>
                                </div>
								
															
															
															
															
															
															
															
															
															
								
                                <div class="weekch-list">
                                										
																											<div class="weekch-con flexRow">
											<div class="weekch-icon flexRow"><b></b></div>
											<a  href="/wz/332866.html"  class="weekcha flexRow flexcenter overflowclass" >AI 研究员:先进深度分析与综合 - Openclaw Skills</a>
										</div>
										
																											<div class="weekch-con flexRow">
											<div class="weekch-icon flexRow"><b></b></div>
											<a  href="/wz/332865.html"  class="weekcha flexRow flexcenter overflowclass" >LNbits 钱包管理器:闪电网络支付 - Openclaw Skills</a>
										</div>
										
																											<div class="weekch-con flexRow">
											<div class="weekch-icon flexRow"><b></b></div>
											<a  href="/wz/332864.html"  class="weekcha flexRow flexcenter overflowclass" >Nimrobo CLI:AI 语音筛选与职位匹配 - Openclaw Skills</a>
										</div>
										
																											<div class="weekch-con flexRow">
											<div class="weekch-icon flexRow"><b></b></div>
											<a  href="/wz/332863.html"  class="weekcha flexRow flexcenter overflowclass" >PikaBoard:智能体优先的看板与任务管理 - Openclaw Skills</a>
										</div>
										
																											<div class="weekch-con flexRow">
											<div class="weekch-icon flexRow"><b></b></div>
											<a  href="/wz/332859.html"  class="weekcha flexRow flexcenter overflowclass" >余额查询助手:AI API 额度监控 - Openclaw Skills</a>
										</div>
										
																											<div class="weekch-con flexRow">
											<div class="weekch-icon flexRow"><b></b></div>
											<a  href="/wz/332858.html"  class="weekcha flexRow flexcenter overflowclass" >TOON 上下文压缩:节省 40% 的 Token 使用量 - Openclaw Skills</a>
										</div>
										
																											<div class="weekch-con flexRow">
											<div class="weekch-icon flexRow"><b></b></div>
											<a  href="/wz/332857.html"  class="weekcha flexRow flexcenter overflowclass" >DeepthinkLite:本地深度研究工具 - Openclaw Skills</a>
										</div>
										
																											<div class="weekch-con flexRow">
											<div class="weekch-icon flexRow"><b></b></div>
											<a  href="/wz/332856.html"  class="weekcha flexRow flexcenter overflowclass" >Maestro Bitcoin:通过 x402 查询比特币 API - Openclaw Skills</a>
										</div>
										
																											<div class="weekch-con flexRow">
											<div class="weekch-icon flexRow"><b></b></div>
											<a  href="/wz/332855.html"  class="weekcha flexRow flexcenter overflowclass" >Luban CLI: MLOps 管理与命令行界面 - Openclaw Skills</a>
										</div>
										
										
                                    
    
                                </div>
    
                            </div>
                           
                        </div>

                       
                        <div class="  dtl-wz">
                            <div class="jb-titles flexRow">
                                <div class="jbtle-left flexRow"><b></b><p>相关文章</p></div>
                                
                            </div>
                            <div class="blog-list">
							                                <a  href="/wz/368507.html"   class="bloga flexRow over"><p class="overflowclass">阿里云大模型服务平台百炼新人免费额度如何申请?申请与使用免费额度教程及常见问题解答</p><div class="blogtime"><span>04/</span>18</div></a>
							                                <a  href="/wz/368512.html"   class="bloga flexRow over"><p class="overflowclass">办公 AI 工具 OpenClaw 部署 Windows 系统一站式教程</p><div class="blogtime"><span>04/</span>18</div></a>
							                                <a  href="/wz/368514.html"   class="bloga flexRow over"><p class="overflowclass">Qwen3.6 正式发布!阿里云百炼同步开启“AI大模型节省计划”超值优惠</p><div class="blogtime"><span>04/</span>18</div></a>
							                                <a  href="/wz/368515.html"   class="bloga flexRow over"><p class="overflowclass">【新手零难度操作 】OpenClaw 2.6.4 安装误区规避与快速使用指南(包含最新版安装包)</p><div class="blogtime"><span>04/</span>18</div></a>
							                                <a  href="/wz/368508.html"   class="bloga flexRow over"><p class="overflowclass">OpenClaw 2.6.4 可视化部署 打造个人 AI 数字员工(包含最新版安装包)</p><div class="blogtime"><span>04/</span>18</div></a>
							                                <a  href="/wz/368505.html"   class="bloga flexRow over"><p class="overflowclass">【小白友好!】OpenClaw 2.6.4 本地 AI 智能体快速搭建教程(内有安装包)</p><div class="blogtime"><span>04/</span>18</div></a>
							                                <a  href="/wz/368503.html"   class="bloga flexRow over"><p class="overflowclass">零基础部署 OpenClaw v2.6.2,Windows 系统完整教程</p><div class="blogtime"><span>04/</span>18</div></a>
							                                <a  href="/wz/368478.html"   class="bloga flexRow over"><p class="overflowclass">【适合新手的】零基础部署 OpenClaw 自动化工具教程</p><div class="blogtime"><span>04/</span>18</div></a>
							                                <a  href="/wz/368382.html"   class="bloga flexRow over"><p class="overflowclass">开发者们的第一台自主进化的“爱马仕”来了</p><div class="blogtime"><span>04/</span>18</div></a>
							                                <a  href="/wz/368433.html"   class="bloga flexRow over"><p class="overflowclass">极简部署 OpenClaw 2.6.2 本地 AI 智能体快速启用(含最新版安装包)</p><div class="blogtime"><span>04/</span>18</div></a>
								
                                
                            </div>

                        </div>

                        <div class="cdr-ai">
                        <div class="jb-titles flexRow">
                            <div class="jbtle-left flexRow"><b></b><p>AI精选 </p></div>
							<a class="jbtitle-more flexRow" href="/category/list_344_1.html"  title=""><span>更多</span><b></b></a>
                        </div>
						                        <div class="ai-list">
                            <div class="ail-top flexRow">
																                                <a  href="/wz/368511.html"  title="" class="ailta ">
                                                                        <img src="https://images.jiaoben.net/uploads/20260418/logo_69e379a77ddc11.jpg" >
                                                                        <p ><span>电影哥特式火水社论</span></p></a>
																								                                <a  href="/wz/368510.html"  title="" class="ailta ">
                                                                        <img src="https://images.jiaoben.net/uploads/20260418/logo_69e3799e6eb521.jpg" >
                                                                        <p ><span>本能 电影剧照</span></p></a>
																																																																																																																																																                               
                            </div>
                            <div class="ail-down">
																																																						<a class="ali-con flexRow"  href="/wz/368502.html"  title="">
										<div class="alicon-left flexRow"><span>精选</span></div>
										<p class="aliconp overflowclass">夜桥上的电影三联画肖像</p>
									</a>
																																<a class="ali-con flexRow"  href="/wz/368501.html"  title="">
										<div class="alicon-left flexRow"><span>精选</span></div>
										<p class="aliconp overflowclass">黄金时段海岸生活方式照片</p>
									</a>
																																<a class="ali-con flexRow"  href="/wz/368446.html"  title="">
										<div class="alicon-left flexRow"><span>精选</span></div>
										<p class="aliconp overflowclass">高速摄影:亚洲汤品爆裂瞬间</p>
									</a>
																																<a class="ali-con flexRow"  href="/wz/368441.html"  title="">
										<div class="alicon-left flexRow"><span>精选</span></div>
										<p class="aliconp overflowclass">玻璃马雕像变形动画(视频提示)</p>
									</a>
																																<a class="ali-con flexRow"  href="/wz/368440.html"  title="">
										<div class="alicon-left flexRow"><span>精选</span></div>
										<p class="aliconp overflowclass">秋叶超现实主义鹿</p>
									</a>
																																<a class="ali-con flexRow"  href="/wz/368426.html"  title="">
										<div class="alicon-left flexRow"><span>精选</span></div>
										<p class="aliconp overflowclass">90 年代复古闪光摄影肖像</p>
									</a>
																																<a class="ali-con flexRow"  href="/wz/368425.html"  title="">
										<div class="alicon-left flexRow"><span>精选</span></div>
										<p class="aliconp overflowclass">Sydney Sweeney《蜘蛛夫人》首映礼礼服描述</p>
									</a>
																																<a class="ali-con flexRow"  href="/wz/368393.html"  title="">
										<div class="alicon-left flexRow"><span>精选</span></div>
										<p class="aliconp overflowclass">女性在床上听音乐的私密生活照</p>
									</a>
															                               
                            </div>
                        </div>

                    </div>
    
						<div class="cdr-blog">
							<div class="jb-titles flexRow">
								<div class="jbtle-left flexRow"><b></b><p>脚本推荐</p></div>
								
							</div>
							<div class="blog-list">
															<a href="/wz/zt-49225.html" title="" class="bloga flexRow over"><p class="overflowclass">SeeDance 2.0 Video Creator专区</p></a>
															<a href="/wz/zt-49224.html" title="" class="bloga flexRow over"><p class="overflowclass">OpenClaw AI专区</p></a>
															<a href="/wz/zt-49223.html" title="" class="bloga flexRow over"><p class="overflowclass">cowork专区</p></a>
															<a href="/wz/zt-49222.html" title="" class="bloga flexRow over"><p class="overflowclass">claude code skills专区</p></a>
								
					  
							</div>

						</div>

                    </div>
                </div>
            </div>
            
        </div>


    </main>
     <script>
        $(function() {
            // “+ 收藏”按钮点击事件
            $(document).on('click', '.htmitem-right, .ztop-right', function(e) {
                // 仅针对包含 “+ 收藏” 文字的按钮
                if ($(this).text().indexOf('+ 收藏') === -1) return;
                
                e.preventDefault();
                
                const id = $(this).data('id');
                if (!id) {
                    layer.msg('该项暂无有效ID,无法收藏');
                    return;
                }

                // 构造收藏 URL: 当前域名 + /wz/zt- + id + /
                const bookmarkUrl = window.location.origin + '/wz/zt-' + id + '.html';
                
                // 获取收藏标题 (优先从同级元素获取话题名称,否则使用页面标题)
                let bookmarkTitle = $(this).closest('.htl-item, .zttopd').find('a:first, span.overflowclass').text().trim() || document.title;
                if (bookmarkTitle.startsWith('#')) bookmarkTitle = bookmarkTitle.substring(1);

                // 浏览器收藏逻辑 (带 Fallback)
                try {
                    if (window.sidebar && window.sidebar.addPanel) { 
                        // Firefox < 23
                        window.sidebar.addPanel(bookmarkTitle, bookmarkUrl, "");
                    } else if (window.external && ('AddFavorite' in window.external)) { 
                        // IE
                        window.external.AddFavorite(bookmarkUrl, bookmarkTitle);
                    } else {
                        // Chrome, Safari, Firefox 23+, etc.
                        const isMac = /Mac/i.test(navigator.userAgent);
                        const keyStr = isMac ? 'Command + D' : 'Ctrl + D';
                        
                        layer.confirm('由于浏览器安全限制,请使用 <b>' + keyStr + '</b> 手动添加收藏。<br><br>收藏地址:<br><small>' + bookmarkUrl + '</small>', {
                            title: '收藏提示',
                            btn: ['复制链接', '知道了'],
                            yes: function(index) {
                                copyToClipboard(bookmarkUrl).then(() => {
                                    layer.msg('链接已复制,请手动添加到收藏夹');
                                }).catch(() => {
                                    layer.msg('复制失败,请手动选择复制');
                                });
                                layer.close(index);
                            }
                        });
                    }
                } catch (err) {
                    layer.msg('收藏失败,请手动添加');
                }
            });

            // 兼容非 HTTPS 的复制函数
            function copyToClipboard(text) {
                if (navigator.clipboard && window.isSecureContext) {
                    return navigator.clipboard.writeText(text);
                } else {
                    let textArea = document.createElement("textarea");
                    textArea.value = text;
                    textArea.style.position = "fixed";
                    textArea.style.left = "-999999px";
                    textArea.style.top = "-999999px";
                    document.body.appendChild(textArea);
                    textArea.focus();
                    textArea.select();
                    return new Promise((res, rej) => {
                        document.execCommand('copy') ? res() : rej();
                        textArea.remove();
                    });
                }
            }
        });
    </script>
<footer>
        <div class="foot ">
            <div class="foot-top flexRow">
                <div class="foot-left">
                    <div class="ftl-top flexRow"><span class="flexRow flexcenter">脚本</span>在线</div>
                    <p class="ftl-down">
                        智能赋能梦想,脚本构筑现实。我们致力于链接AI智能指令
                        与传统自动化,为您提供一站式、高效率的脚 本资产与生成
                        服务。
                    </p>
                </div>
                <div class="foot-right flexRow">
                    <div class="ftr-list flexColumn">
                        <p>核心板块</p>
                        <span>AI脚本库</span>
                        <span>自动化仓库</span>
                        <span>脚本实验室</span>
                    </div>
                    <div class="ftr-list flexColumn">
                        <p>关于我们</p>
                        <a href="/category/list_229_1.html"   >最新游戏</a>
                        <span>商务合作</span>
                        <span>隐私政策</span>
                    </div>
                    <div class="ftr-list flexColumn">
                        <p>社区支持</p>
                        <span >API文档</span>
                        <a href="/category/list_334_1.html"   >攻略资讯</a>
                        <span>违规举报</span>
                    </div>
                </div>
            </div>
            <div class="foot-down flexColumn">
                <p>© 2026  jiaoben.net | 脚本在线 | 联系:jiaobennet2026@163.com</p>
                <p>备案:<a style="color: #7F7F7F;" href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">湘ICP备18025217号-11</a> </p>
            </div>
        </div>
    </footer>

    <div style="display:none;">
			<script type="text/javascript">
		  var _paq = window._paq = window._paq || [];
		  _paq.push(['trackPageView']);
		  _paq.push(['enableLinkTracking']);

		  (function() {
			var u="//tongji.zhangwan.net/";
			_paq.push(['setTrackerUrl', u+'matomo.php']);
			_paq.push(['setSiteId', '29']);

			// Add this code below within the Matomo JavaScript tracker code
			// Important: the tracker url includes the /matomo.php
			var secondaryTrackerUrl = u+'matomo.php';
			var secondaryWebsiteId = 27;
			// Also send all of the tracking data to this other Matomo server, in website ID 77
			_paq.push(['addTracker', secondaryTrackerUrl, secondaryWebsiteId]);
			// That's it!
			var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
			g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
		  })();
		</script>
	    <script>
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?5d3cfe1f36b1988029fe82a0d475b20d";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
	
</div>  </body>
</html>