Skip to content

Commit

Permalink
feat: zh-tw translation (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElliotCHEN37 committed Mar 28, 2024
1 parent 90d43b0 commit 3200998
Show file tree
Hide file tree
Showing 7 changed files with 716 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .vitepress/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,69 @@ export default defineConfig({
},
},
},
zh-TW: {
label: "正體中文",
lang: "zh-TW",
title: "Gopeed 文件",
description: "Gopeed 文件網站",
themeConfig: {
socialLinks: [
{ icon: "github", link: "https://github.com/GopeedLab/gopeed" },
{ icon: "discord", link: "https://discord.gg/ZUJqJrwCGB" },
],
nav: [
{
text: "指南",
link: "/zh-tw/index.md",
},
{
text: "開發",
link: "/zh-tw/dev.md",
},
{
text: "RESTFul API",
link: "https://docs.gopeed.com/site/openapi/index.html",
},
{
text: "SDK Reference",
link: "https://docs.gopeed.com/site/reference/index.html",
},
{
text: "捐贈",
link: "/donate.md",
},
],
sidebar: [
{
text: "指南",
items: [
{
text: "介紹",
link: "/zh-tw/index.md",
},
{
text: "安裝",
link: "/zh-tw/install.md",
},
],
},
{
text: "開發",
items: [
{
text: "API 對接",
link: "/zh-tw/dev-api.md",
},
{
text: "擴充開發",
link: "/zh-tw/dev-extension.md",
},
],
},
],
},
},
},
themeConfig: {
logo: "/images/logo.png",
logoLink: "https://gopeed.com",
Expand Down
46 changes: 46 additions & 0 deletions docs/zh-TW/dev-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# API 對接

Gopeed 對外提供了 HTTP API 接口,可以透過 API 進行下載管理。

## 啟用介面

首先需要設定通訊協定為 TCP,透過**設定 -> 進階 -> 通訊協定**,將通訊協定設定為 TCP,並設定 IP 和端口,如下圖所示:

![](/images/dev/set-port.png)

這樣就可以透過`http://127.0.0.1:6666`存取API 了,但是出於安全考慮,建議設定一個令牌,透過**設定-> 進階-> 介面令牌**,設定一個令牌 ,如下圖所示:

![](/images/dev/set-token.png)

> 註:以上設定需重新啟動後生效。
## 使用 JS SDK

Gopeed 提供了官方的 js 函式庫,首先需要安裝`@gopeed/rest`函式庫:

```
npm install @gopeed/rest
```

然後就可以愉快的使用了,範例:

```js
import { Client } 從 "@gopeed/rest";

(async function () {
// 建立客戶端
const client = new Client();
// 呼叫API建立任務
const res = await client.createTask({
req: {
url: "https://example.com/file.zip",
},
});
})();
```

更多使用方法請參考 [文件](https://docs.gopeed.com/site/reference/classes/_gopeed_rest.Client.html)

## 使用 HTTP 請求

當然也可以直接透過 HTTP 請求來呼叫 API,具體請參考 [介面文件](https://docs.gopeed.com/site/openapi/index.html)
Loading

0 comments on commit 3200998

Please sign in to comment.