picgo-plugin-s3 1.3.6 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -14
- package/dist/config.d.ts +1 -0
- package/dist/index.js +12 -3
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +3 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,20 +19,21 @@ GUI 直接搜索 _S3_ 下载即可,Core 版执行 `picgo add s3` 安装。
|
|
|
19
19
|
picgo set uploader aws-s3
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
| Key
|
|
23
|
-
|
|
24
|
-
| `accessKeyID`
|
|
25
|
-
| `secretAccessKey`
|
|
26
|
-
| `bucketName`
|
|
27
|
-
| `uploadPath`
|
|
28
|
-
| `urlPrefix`
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
22
|
+
| Key | 说明 | 例子 |
|
|
23
|
+
|----------------------------|--------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
|
|
24
|
+
| `accessKeyID` | AWS 凭证 ID | |
|
|
25
|
+
| `secretAccessKey` | AWS 凭证密钥 | |
|
|
26
|
+
| `bucketName` | S3 桶名称 | `gallery` |
|
|
27
|
+
| `uploadPath` | 上传路径 | `{year}/{month}/{fullName}` |
|
|
28
|
+
| `urlPrefix` | 最终生成图片 URL 的自定义前缀 | `https://img.example.com/my-blog/` |
|
|
29
|
+
| `urlSuffix` | 最终生成图片 URL 的自定义后缀 | `?oxx=xxx` |
|
|
30
|
+
| `endpoint` | 指定自定义终端节点 | `s3.us-west-2.amazonaws.com` |
|
|
31
|
+
| `proxy` | 代理地址 | 支持http代理,例如 `http://127.0.0.1:1080` |
|
|
32
|
+
| `region` | 指定执行服务请求的区域 | `us-west-1` |
|
|
33
|
+
| `pathStyleAccess` | 是否启用 S3 Path style | 默认为 `false`,使用 minio 请设置为 `true` (e.g., https://s3.amazonaws.com/<bucketName>/<key> instead of https://<bucketName>.s3.amazonaws.com/<key>) |
|
|
34
|
+
| `rejectUnauthorized` | 是否拒绝无效 TLS 证书连接 | 默认为 `true`,如上传失败日志显示证书问题可设置为`false` |
|
|
35
|
+
| `acl` | 访问控制列表,上传资源的访问策略 | 默认为 `public-read`, AWS 可选 `private" |"public-read"|"public-read-write"|"authenticated-read"|"aws-exec-read"|"bucket-owner-read"|"bucket-owner-full-control` |
|
|
36
|
+
| `disableBucketPrefixToURL` | 开启 `pathStyleAccess` 时,是否要禁用最终生成URL中添加 bucket 前缀 | 默认为 `false` |
|
|
36
37
|
|
|
37
38
|
**上传路径支持 payload:**
|
|
38
39
|
|
package/dist/config.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ module.exports = (ctx) => {
|
|
|
14
14
|
pathStyleAccess: false,
|
|
15
15
|
rejectUnauthorized: true,
|
|
16
16
|
acl: "public-read",
|
|
17
|
+
urlSuffix: "",
|
|
17
18
|
};
|
|
18
19
|
let userConfig = ctx.getConfig("picBed.aws-s3");
|
|
19
20
|
userConfig = Object.assign(Object.assign({}, defaultConfig), (userConfig || {}));
|
|
@@ -78,6 +79,14 @@ module.exports = (ctx) => {
|
|
|
78
79
|
required: false,
|
|
79
80
|
alias: "自定义域名",
|
|
80
81
|
},
|
|
82
|
+
{
|
|
83
|
+
name: "urlSuffix",
|
|
84
|
+
type: "input",
|
|
85
|
+
default: userConfig.urlSuffix || "",
|
|
86
|
+
message: "例如?x-oss-process=xxx",
|
|
87
|
+
required: false,
|
|
88
|
+
alias: "设定网址后缀",
|
|
89
|
+
},
|
|
81
90
|
{
|
|
82
91
|
name: "pathStyleAccess",
|
|
83
92
|
type: "confirm",
|
|
@@ -104,7 +113,7 @@ module.exports = (ctx) => {
|
|
|
104
113
|
},
|
|
105
114
|
{
|
|
106
115
|
name: "disableBucketPrefixToURL",
|
|
107
|
-
type: "
|
|
116
|
+
type: "confirm",
|
|
108
117
|
default: userConfig.disableBucketPrefixToURL || false,
|
|
109
118
|
message: "开启 `pathStyleAccess` 时,是否要禁用最终生成URL中添加 bucket 前缀",
|
|
110
119
|
required: false,
|
|
@@ -153,8 +162,8 @@ module.exports = (ctx) => {
|
|
|
153
162
|
const { index, url, imgURL } = result;
|
|
154
163
|
delete output[index].buffer;
|
|
155
164
|
delete output[index].base64Image;
|
|
156
|
-
output[index].imgUrl = imgURL
|
|
157
|
-
output[index].url = url
|
|
165
|
+
output[index].imgUrl = `${imgURL}${(userConfig === null || userConfig === void 0 ? void 0 : userConfig.urlSuffix) || ''}`;
|
|
166
|
+
output[index].url = `${url}${(userConfig === null || userConfig === void 0 ? void 0 : userConfig.urlSuffix) || ''}`;
|
|
158
167
|
}
|
|
159
168
|
return ctx;
|
|
160
169
|
};
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.formatPath = formatPath;
|
|
7
|
+
exports.extractInfo = extractInfo;
|
|
8
|
+
exports.getProxyAgent = getProxyAgent;
|
|
7
9
|
const crypto_1 = __importDefault(require("crypto"));
|
|
8
10
|
const file_type_1 = require("file-type");
|
|
9
11
|
const mime_1 = __importDefault(require("mime"));
|
|
@@ -99,7 +101,6 @@ function formatPath(info, format) {
|
|
|
99
101
|
}
|
|
100
102
|
return formatPath;
|
|
101
103
|
}
|
|
102
|
-
exports.formatPath = formatPath;
|
|
103
104
|
async function extractInfo(info) {
|
|
104
105
|
var _a;
|
|
105
106
|
const result = {};
|
|
@@ -122,7 +123,6 @@ async function extractInfo(info) {
|
|
|
122
123
|
}
|
|
123
124
|
return result;
|
|
124
125
|
}
|
|
125
|
-
exports.extractInfo = extractInfo;
|
|
126
126
|
function formatHttpProxyURL(url = "") {
|
|
127
127
|
if (!url)
|
|
128
128
|
return "";
|
|
@@ -153,4 +153,3 @@ function getProxyAgent(proxy, sslEnabled, rejectUnauthorized) {
|
|
|
153
153
|
};
|
|
154
154
|
return new Agent(options);
|
|
155
155
|
}
|
|
156
|
-
exports.getProxyAgent = getProxyAgent;
|