一键重装系统工具 | U盘启动盘制作工具 | 误删文件恢复软件 | 硬盘数据抢救专家 | 电脑蓝屏修复助手 | C盘空间清理神器 | 电脑驱动离线安装工具 | 微信聊天记录恢复工具 | 照片误格式化恢复 | 电脑密码破解清除工具 | 系统崩溃紧急救援盘 | 电脑加速优化大师 | 电脑开不了机怎么重装系统 | 回收站清空了怎么恢复 | 硬盘分区丢失数据恢复 | 电脑卡顿重装系统有用吗 | U盘插入提示格式化数据恢复 | 电脑中毒文件被隐藏恢复 | 忘记电脑开机密码怎么办 | 新硬盘分区对齐工具 | 旧电脑装Win10流畅工具 | SD卡照片删除恢复免费版 | 移动硬盘打不开提示损坏修复 | 电脑无故重启系统修复工具 | 电脑小白一键重装神器 | 程序员电脑环境配置助手 | 设计师电脑字体/素材恢复工具 | 网吧网管系统维护工具箱 | 财务人员电脑发票备份恢复 | 学生党免费电脑系统安装包 | 电脑维修师傅必备工具盘 | 游戏玩家电脑性能优化助手 | 办公白领误删文档恢复软件 | 自媒体视频素材恢复工具 | 网课录制视频损坏修复工具 | 最好的U盘PE系统排名 | 数据恢复软件哪个最强 | 免费电脑助手与收费版区别 | 国产装机工具哪款无广告 | 离线版驱动助手推荐 | 轻量级电脑优化工具对比 | 支持NVMe驱动的PE工具 | 带网络功能的应急启动盘 | 2026最新版万能装机工具 | 支持Win11 24H2的PE工具 | 最新免激活系统重装工具 | 2026数据恢复软件破解版合集 | 纯净无捆绑装机助手V3.0 | 支持苹果M芯片的电脑助手 | 秋季更新版系统维护工具箱 | 电脑系统崩了怎么用U盘把重要资料拷贝出来 | 重装系统前哪些文件夹必须备份 | 固态硬盘误格式化还能恢复数据吗 | 如何制作一个既带PE又能存数据的双分区U盘 | 电脑总是弹窗广告用什么助手彻底拦截 后台管理
📢 欢迎访问系统之家!所有资源均经过安全检测。

Extension Development

发布时间:2026-09-15 | 浏览:2
📥 下载地址(文章开头)
一键制作系统U盘
Build Gopeed JavaScript extensions, debug them locally, and understand the extension manifest and runtime. Gopeed supports extension development using JavaScript . Extensions can enhance Gopeed's functionality, such as downloading videos or music from a website. You can quickly learn more about it through the official examples . Gopeed extensions are based on git to achieve decentralized extension management. As long as the extension source code is hosted in a remote git repository, it can be installed and updated through Gopeed. Therefore, whether it is github , gitee , gitlab , or other git hosting platforms, they can all be used as extension repositories. Using scaffolding Gopeed provides a scaffolding to help you quickly create an extension development project template: In the creation process, you will see the following prompts: If you are not familiar with the node.js peripheral tools, you can also manually create a project, the file structure is as follows: Local debugging After the project is built, you need to do local debugging. You can install the local extension project into Gopeed for debugging. The specific steps are as follows: Enable the Gopeed developer mode, click the install button 5 times in a row on the extension page to enable the developer mode. Click the button to select the extension directory in the directory selector to install. Click the button to select the extension directory in the directory selector to install. If you use the webpack mode in the scaffolding, you can start automatic compilation through npm run dev . If you use the webpack mode in the scaffolding, you can start automatic compilation through npm run dev . Create a task to see the extension take effect. Create a task to see the extension take effect. It can be seen that the example extension created through the scaffolding can parse an example/index.html file when creating a task using the https://github.com/hello link. Note: Developer mode is only valid on the desktop platform. Development explanation In the previous section, we were able to create a basic extension and debug it locally, but what is happening under the hood? First, let's take a look at the manifest.json file, which is the manifest file of the extension. It describes the information of the extension. Each extension project must contain a manifest.json file in the root directory. The sample file in this section is as follows: Next, let's introduce the meaning of each field one by one: name and author : Gopeed will use <author>@<name> as the ID of the extension. After filling in the author , it can ensure that it is not easy to be overwritten and installed with other extensions, so it is strongly recommended to fill in the author field. name and author : Gopeed will use <author>@<name> as the ID of the extension. After filling in the author , it can ensure that it is not easy to be overwritten and installed with other extensions, so it is strongly recommended to fill in the author field. title and description : The title and description of the extension. title and description : The title and description of the extension. icon : Extension icon, fill in the relative path, for example: icon.png . icon : Extension icon, fill in the relative path, for example: icon.png . version : Extension version, using semver specification, when the extension is updated, it is compared based on this field, so please make sure that the version number is in compliance with the specification. version : Extension version, using semver specification, when the extension is updated, it is compared based on this field, so please make sure that the version number is in compliance with the specification. homepage : Extension homepage, for example: https://gopeed.com . homepage : Extension homepage, for example: https://gopeed.com . repository : The git repository address to which the extension belongs. Gopeed extensions rely on git to achieve decentralized extension management. Therefore, if your extension needs to be installed and updated by users, you must host the extension source code in a remote git repository and configure this field. For example: { "url" : "https://github.com/gopeed/gopeed-extension-demo" } If a git repository contains multiple extension projects, you can specify a subdirectory through the directory attribute, for example: { "url" : "https://github.com/GopeedLab/gopeed-extension-samples" , "directory" : "github-contributor-avatars-sample" } In Gopeed installation, you need to use # to separate, e.g. https://github.com/GopeedLab/gopeed-extension-samples#github-contributor-avatars-sample . repository : The git repository address to which the extension belongs. Gopeed extensions rely on git to achieve decentralized extension management. Therefore, if your extension needs to be installed and updated by users, you must host the extension source code in a remote git repository and configure this field. If a git repository contains multiple extension projects, you can specify a subdirectory through the directory attribute, for example: In Gopeed installation, you need to use # to separate, e.g. https://github.com/GopeedLab/gopeed-extension-samples#github-contributor-avatars-sample . scripts : Pay attention! This is the configuration of the Gopeed extension activation event. The onResolve event configured in the sample project will be triggered when parsing tasks. The match.urls field is used to match the URL created by the task. If the match is successful, the script file specified in the entry field will be executed. The matching rules are consistent with the matching rules of Chrome extensions, which can be referred to here scripts : Pay attention! This is the configuration of the Gopeed extension activation event. The onResolve event configured in the sample project will be triggered when parsing tasks. The match.urls field is used to match the URL created by the task. If the match is successful, the script file specified in the entry field will be executed. The matching rules are consistent with the matching rules of Chrome extensions, which can be referred to here settings : Extension settings, through the configuration declaration, the corresponding settings page can be generated in Gopeed to provide user-defined settings, such as custom Cookie , custom User-Agent , etc., for example: [ { "name" : "cookie" , "title" : "Website Cookie" , "description" : "Cookie can be obtained through browser developer tools" , "type" : "string" }, { "name" : "quality" , "title" : "Default Quality" , "type" : "number" , "value" : "1080" , "options" : [ { "label" : "1080P" , "value" : "1080" }, { "label" : "720P" , "value" : "720" }, { "label" : "480P" , "value" : "480" } ] } ] name : Setting item name, required. title : Setting item title, required. description : Setting item description, optional. type : Setting item type, optional values: string , number , boolean . value : Setting item default value, optional. settings : Extension settings, through the configuration declaration, the corresponding settings page can be generated in Gopeed to provide user-defined settings, such as custom Cookie , custom User-Agent , etc., for example: name : Setting item name, required. title : Setting item title, required.
📥 下载地址(文章中间)
一键制作系统U盘
description : Setting item description, optional. type : Setting item type, optional values: string , number , boolean . value : Setting item default value, optional. In the previous section, we have learned how to configure the manifest, and now let's introduce how to write the extension script. Runtime environment Gopeed extension script engine is implemented by goja which is a JavaScript interpreter written in pure Go. However, since goja is only a pure js runtime, the APIs of browser and node.js are not supported. Currently, Gopeed implements XMLHttpRequest and fetch APIs, which means you can use these two APIs or third-party libraries based on them to implement network requests, such as axios , superagent , etc. Another thing to note is that goja natively supports most of the es6+ syntax, but a few syntaxes are not supported, such as async generator , but it doesn't matter, the project created by the scaffolding has been configured with babel , you can use the latest es syntax happily, and the script will eventually be compiled into es5 syntax. Demo script explanation When an event is triggered, the script file specified in the entry field will be executed. The script file in the sample project is as follows: Let's explain the script content: gopeed.events.onResolve : This registers the onResolve event handler, where the extension logic lives. ctx : The event context, containing information about the current event. In the onResolve event, ctx contains: req : Request information, including the resource URL, headers, etc. res : Response information, the script needs to assign the parsed file list to ctx.res , and Gopeed will download according to the file list returned. req : Request information, including the resource URL, headers, etc. res : Response information, the script needs to assign the parsed file list to ctx.res , and Gopeed will download according to the file list returned. In short, in the onResolve callback function, you need to parse the file list to download based on the request information in ctx.req and assign it to ctx.res . For detailed extension typings and related source code, please refer to the official Gopeed JS repository . Extension Storage Gopeed provides a storage API to support persistent extension data, such as login tokens . Example: Note: For detailed API information, please refer to the documentation . Extension Debugging You can use the gopeed.logger object in scripts to output logs. It supports debug , info , warn , and error levels. Example: Log files are stored in the logs directory under the Gopeed installation path, with the file name extension.log . You can use tail -f extension.log to watch logs in real time. Note: debug level logs only take effect for extensions installed in developer mode. Extension Release After extension development is complete, if it was created with the scaffolding webpack project, you need to build it first: Then create a remote repository . For example, if you create a repository named https://github.com/xxx/gopeed-extension-demo on github , update the repository field in manifest.json accordingly: Correctly configuring repository enables remote updates for the extension. If the extension is a subdirectory under a git repository, you can use the directory attribute to specify the subdirectory, for example: Remember to set the extension's author and name fields properly to reduce the risk of name collisions with other extensions. Then push the project to the remote repository to complete the release. To make it easier for users to find Gopeed extensions on github , it is recommended to use the gopeed-extension- prefix for project names, such as gopeed-extension-demo , and to tag the project with gopeed-extension on github . Extension Installation After publishing to a remote repository, you can install it in Gopeed. Open the extension page, enter the extension's git clone address using the HTTP protocol (you can omit the trailing .git ), and click the Install button. Note: If the extension lives in a subdirectory, append # to the address followed by the subdirectory name, for example https://github.com/xxx/gopeed-extension-demo#path . Official Examples Gopeed provides two representative sample extensions for reference: github-contributor-avatars-sample This extension depends on node.js and is suitable for complex development needs. It uses the cheerio library to parse page DOM and collect the files to download. github-contributor-avatars-sample This extension depends on node.js and is suitable for complex development needs. It uses the cheerio library to parse page DOM and collect the files to download. github-release-sample This extension is a pure JS project with no dependencies. It is suitable for simple development needs and uses fetch to make network requests and collect the files to download. github-release-sample This extension is a pure JS project with no dependencies. It is suitable for simple development needs and uses fetch to make network requests and collect the files to download. API Integration Use the Gopeed HTTP API and official SDKs to create and manage download tasks. Configure webhooks to automatically push notifications to a specified URL when downloads complete or fail.
📥 下载地址(文章结尾)
一键制作系统U盘