Skip to content

Commit b020480

Browse files
author
davis.zheng
committed
优化文档
1 parent a68e7b4 commit b020480

28 files changed

+127
-300
lines changed

_data/variables.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ default:
3939
license: false
4040
pageview: false
4141
search: default
42+
footer: true
4243

4344
sources:
4445
bootcdn:

_includes/author-links.html

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
<div class="author-links">
44
<ul class="menu menu--nowrap menu--inline">
5-
6-
{%- if _author.url -%}
5+
<!-- <li>如有问题,请邮件联系我们:[email protected]</li> -->
6+
<li title=" 如有问题,请邮件联系我们 ">
7+
<a class="button button--circle mail-button" itemprop="email" href="mailto:[email protected]" target="_blank">
8+
<i class="fas fa-envelope"></i>
9+
</a>
10+
<!-- {%- if _author.url -%}
711
<link itemprop="url" href="{{ _author.url }}">
812
{%- endif -%}
913
@@ -19,10 +23,10 @@
1923
{%- assign _locale_string_follow = __return -%}
2024
{%- endif -%}
2125
22-
{%- include snippets/get-locale-string.html key='EMAIL_ME' -%}
26+
{%- include snippets/get-locale-string.html key='EMAIL_ME' -%}
2327
{%- if _author.email -%}
24-
<li title="{{ _locale_string_email }}">
25-
<a class="button button--circle mail-button" itemprop="email" href="mailto:{{ _author.email }}" target="_blank">
28+
<li title=" 如有问题,请邮件联系我们 ">
29+
<a class="button button--circle mail-button" itemprop="email" href="mailto:[email protected]" target="_blank">
2630
<i class="fas fa-envelope"></i>
2731
</a>
2832
{%- endif -%}
@@ -114,7 +118,7 @@
114118
<div class="icon">{%- include svg/icon/social/npm.svg -%}</div>
115119
</a>
116120
</li>
117-
{%- endif -%}
121+
{%- endif -%} -->
118122

119123
</ul>
120124
</div>

_layouts/page.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@
223223
{%- endif -%}
224224
</div>
225225

226-
{%- if _footer != false -%}
226+
<!-- {%- if _footer != false -%} -->
227227
<div class="page__footer d-print-none">{%- include footer.html -%}</div>
228-
{%- endif -%}
228+
<!-- {%- endif -%} -->
229229
</div>
230230
</div> {%- comment -%} end page__main {%- endcomment -%}
231231
{%- if page.sidebar -%}

collections/_c-sdk/快速使用.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,73 +18,85 @@ sidebar:
1818

1919
* 安装 gcc && cmake
2020

21+
22+
<div class="copyable" markdown="1">
2123
```shell
2224
apt-get install -y build-essential
2325
apt-get install cmake
2426
```
27+
</div>
2528

2629
* 安装 libcurl
2730

31+
<div class="copyable" markdown="1">
2832
```shell
2933
apt-get install libcurl4-openssl-dev
3034
```
35+
</div>
3136

3237
### RedHat/Centos
3338

3439
* 安装 gcc && cmake
3540

41+
<div class="copyable" markdown="1">
3642
```shell
3743
yum install cmake
3844
yum install -y gcc gcc-c++
3945
```
40-
46+
</div>
4147
* 安装 libcurl
4248

49+
<div class="copyable" markdown="1">
4350
```shell
4451
yum install libcurl-devel.x86_64 -y
4552
```
46-
53+
</div>
4754
### 其它Linux
4855

4956
- 安装[CMake](https://cmake.org/download/?spm=a2c4g.11186623.2.14.44e941caIsHOx9):从链接中下载相应的版本进行安装。常用的安装方式如下:
5057

58+
<div class="copyable" markdown="1">
5159
```shell
5260
./configure
5361
make
5462
make install
5563
```
56-
64+
</div>
5765
**说明** 执行./configure时,默认安装路径为/usr/local/,如果需要指定安装路径,请使用 ./configure --prefix选项。
5866

5967
- 安装[libcurl](https://curl.haxx.se/download.html?spm=a2c4g.11186623.2.15.44e941caS0PuwQ):从链接中下载相应的版本进行安装。常用的安装方式如下:
6068

69+
<div class="copyable" markdown="1">
6170
```shell
6271
./configure
6372
make
6473
make install
6574
```
66-
75+
</div>
6776
## SDK下载安装
6877

6978
- 通过[GitHub](https://github.com/ufilesdk-dev/ufile-csdk)下载
7079

80+
<div class="copyable" markdown="1">
7181
```shell
7282
git clone [email protected]:ufilesdk-dev/ufile-csdk.git
7383
```
74-
84+
</div>
7585
* 编译
7686

87+
<div class="copyable" markdown="1">
7788
```shell
7889
cd ufile-csdk && mkdir -p build && cd build && cmake ../ && make
7990
```
80-
91+
</div>
8192

8293
# 使用示例
8394

8495
## 配置
8596

8697
本SDK使用前需配置ufile_config所需数据,用于ufile_sdk_initialize接口初始化 SDK。ufile_config数据结构如下:
8798

99+
<div class="copyable" markdown="1">
88100
```c
89101
struct ufile_config{
90102
const char *public_key; //API公钥 或者 令牌公钥
@@ -93,24 +105,28 @@ struct ufile_config{
93105
const char *bucket_host; //用于创建和删除 bucket, 请填写为"api.ucloud.cn"
94106
};
95107
```
108+
</div>
96109

97110
> 密钥可以在控制台中 [API 产品 - API 密钥](https://console.ucloud.cn/uapi/apikey),点击显示 API 密钥获取。将 public_key 和 private_key 分别赋值给相关变量后,SDK即可通过此密钥完成鉴权。请妥善保管好 API 密钥,避免泄露。 token(令牌)是针对指定bucket授权的一对公私钥。可通过token进行授权bucket的权限控制和管理。可以在控制台中[对象存储US3-令牌管理](https://console.ucloud.cn/ufile/token),点击创建令牌获取。
98111
>
99112
> file_host 是文件操作请求的接收地址,可以在[控制台](https://console.ucloud.cn/ufile/ufile)的存储空间域名一列获取,例如`test-demo.cn-bj.ufileos.com`,填写`cn-bj.ufileos.com`即可,不需要存储空间名称。
100113
101114
SDK 可使用环境变量的方式加载配置,执行以下命令进行配置
102115

116+
<div class="copyable" markdown="1">
103117
```shell
104118
export UFILE_PUBLIC_KEY=<your pubic key>
105119
export UFILE_PRIVATE_KEY=<your pubic key>
106120
export UFILE_BUCKET_HOST=api.ucloud.cn
107121
export UFILE_FILE_HOST=<your file host>
108122
```
123+
</div>
109124

110125
## 示例代码如下
111126

112127
执行示例前,请将代码中的bucket_name、key_name、ul_file_path、dl_file_path和mime_type更换成有效值
113128

129+
<div class="copyable" markdown="1">
114130
```c
115131
#include "../lib/api.h"
116132
#include <stdio.h>

collections/_c-sdk/快速开始.md

Lines changed: 0 additions & 195 deletions
This file was deleted.

collections/_go-sdk/上传回调.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ SDK 提供了文件上传后进行回调(Callback)的功能。您只需要
2020

2121
> 说明
2222
> * 以上所有分片上传回调实际上都是通过调用 FinishMultipartUploadWithPolicy 完成。
23-
> * 回调参数具体参见[新版本回调服务](https://ushare.ucloudadmin.com/pages/viewpage.action?pageId=14770935)
23+
2424

2525
### 代码示例
2626

@@ -101,7 +101,6 @@ func main() {
101101
| 400 | -15036 | check md5 failed | MD5校验失败 |
102102
| 401 | -148643 | no authorization found | 上传凭证错误 |
103103
| 403 | -148643 | invalid signature | API公私钥错误 |
104-
| 403 | -148643 | invalid signature | API公私钥错误 |
105104
| 400 | -148660 | invalid put policy | 回调参数具体参见[待补充] |
106105
| 599 | 20003 | send request error: Post https://...: dial tcp xx.xxx.xx.xx:xx: getsockopt: connection refused | 用户回调服务不可用 |
107106
| 599 | 20008 | expect json, but received text/plain; charset=utf-8 | 回调字符串需指定 callbackBodyType 为 application/json |

0 commit comments

Comments
 (0)