Skip to content

Commit

Permalink
doc: update
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyWie committed Apr 24, 2024
1 parent c9e1673 commit ed322b6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 3 deletions.
1 change: 0 additions & 1 deletion docs/dev-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ Next, let's introduce the meaning of each field one by one:
- `ctx`: Event context, which contains some information about the current event. In the `onResolve` event, `ctx` contains the following fields:
- `req`: Request information, including the url and headers of the resource.
- `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 it.
- `settings`: Extension settings, including user-defined settings.

In short, it is necessary to parse the list of files that need to be downloaded based on the request information in `ctx.req` in the `onResolve` callback function and assign it to `ctx.res`. The script above is easy to understand. It parses an `index.html` file and its corresponding download address, and then assigns it to `ctx.res`.

Expand Down
1 change: 0 additions & 1 deletion docs/zh-TW/dev-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ gopeed.events.onResolve((ctx) => {
- `ctx`:事件上下文,包含了當前事件的一些信息,在`onResolve`事件中,`ctx`包含了以下字段:
- `req`:請求訊息,包含了資源的 url、headers 等等。
- `res`:回應訊息,腳本需要將解析出的檔案清單賦值給`ctx.res`,Gopeed 會根據裡面傳回的檔案清單進行下載。
- `settings`:擴充設定項,包含了使用者自訂的設定項。

簡而言之就是需要在`onResolve`回調函數中,根據`ctx.req`裡的請求信息,解析出需要下載的文件列表賦值給`ctx.res`即可,那麼上面的腳本就很好理解 了,就是解析出一個`index.html`檔案和對應的下載位址,然後賦值給`ctx.res`

Expand Down
1 change: 0 additions & 1 deletion docs/zh/dev-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ gopeed.events.onResolve((ctx) => {
- `ctx`:事件上下文,包含了当前事件的一些信息,在`onResolve`事件中,`ctx`包含了以下字段:
- `req`:请求信息,包含了资源的 url、headers 等等。
- `res`:响应信息,脚本需要将解析出的文件列表赋值给`ctx.res`,Gopeed 会根据里面返回的文件列表进行下载。
- `settings`:扩展设置项,包含了用户自定义的设置项。

简而言之就是需要在`onResolve`回调函数中,根据`ctx.req`里的请求信息,解析出需要下载的文件列表赋值给`ctx.res`即可,那么上面的脚本就很好理解了,就是解析出一个`index.html`文件和对应的下载地址,然后赋值给`ctx.res`

Expand Down

0 comments on commit ed322b6

Please sign in to comment.