picgo-plugin-s3 1.3.1 → 1.3.3

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 CHANGED
@@ -32,6 +32,7 @@ picgo set uploader aws-s3
32
32
  | `pathStyleAccess` | 是否启用 S3 Path style | 默认为 `false`,使用 minio 请设置为 `true` (e.g., https://s3.amazonaws.com/<bucketName>/<key> instead of https://<bucketName>.s3.amazonaws.com/<key>) |
33
33
  | `rejectUnauthorized` | 是否拒绝无效 TLS 证书连接 | 默认为 `true`,如上传失败日志显示证书问题可设置为`false` |
34
34
  | `acl` | 访问控制列表,上传资源的访问策略 | 默认为 `public-read`, AWS 可选 `private"|"public-read"|"public-read-write"|"authenticated-read"|"aws-exec-read"|"bucket-owner-read"|"bucket-owner-full-control` |
35
+ | `disableBucketPrefixToURL` | 开启 `pathStyleAccess` 时,是否要禁用最终生成URL中添加 bucket 前缀 | 默认为 `false` |
35
36
 
36
37
  **上传路径支持 payload:**
37
38
 
package/dist/config.d.ts CHANGED
@@ -10,4 +10,5 @@ export interface IS3UserConfig {
10
10
  pathStyleAccess?: boolean;
11
11
  rejectUnauthorized?: boolean;
12
12
  acl?: string;
13
+ disableBucketPrefixToURL?: boolean;
13
14
  }
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@ module.exports = (ctx) => {
39
39
  type: "input",
40
40
  default: userConfig.bucketName,
41
41
  required: true,
42
- alias: "",
42
+ alias: "桶名",
43
43
  },
44
44
  {
45
45
  name: "uploadPath",
@@ -82,9 +82,9 @@ module.exports = (ctx) => {
82
82
  name: "pathStyleAccess",
83
83
  type: "confirm",
84
84
  default: userConfig.pathStyleAccess || false,
85
- message: "enable path-style-access or not",
85
+ message: "enable s3ForcePathStyle or not",
86
86
  required: false,
87
- alias: "PathStyleAccess",
87
+ alias: "ForcePathStyle",
88
88
  },
89
89
  {
90
90
  name: "rejectUnauthorized",
@@ -92,7 +92,7 @@ module.exports = (ctx) => {
92
92
  default: userConfig.rejectUnauthorized || true,
93
93
  message: "是否拒绝无效TLS证书连接",
94
94
  required: false,
95
- alias: "rejectUnauthorized",
95
+ alias: "拒绝无效TLS证书连接",
96
96
  },
97
97
  {
98
98
  name: "acl",
@@ -102,6 +102,14 @@ module.exports = (ctx) => {
102
102
  required: false,
103
103
  alias: "ACL 访问控制列表",
104
104
  },
105
+ {
106
+ name: "disableBucketPrefixToURL",
107
+ type: "input",
108
+ default: userConfig.disableBucketPrefixToURL || false,
109
+ message: "开启 `pathStyleAccess` 时,是否要禁用最终生成URL中添加 bucket 前缀",
110
+ required: false,
111
+ alias: "Bucket 前缀",
112
+ },
105
113
  ];
106
114
  };
107
115
  const handle = async (ctx) => {
@@ -111,7 +119,7 @@ module.exports = (ctx) => {
111
119
  }
112
120
  if (userConfig.urlPrefix) {
113
121
  userConfig.urlPrefix = userConfig.urlPrefix.replace(/\/?$/, "");
114
- if (userConfig.pathStyleAccess) {
122
+ if (userConfig.pathStyleAccess && !userConfig.disableBucketPrefixToURL) {
115
123
  userConfig.urlPrefix += "/" + userConfig.bucketName;
116
124
  }
117
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "picgo-plugin-s3",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "picgo amazon s3 uploader",
5
5
  "main": "dist/index.js",
6
6
  "publishConfig": {
@@ -12,9 +12,10 @@
12
12
  "build": "tsc -p .",
13
13
  "dev": "tsc -w -p .",
14
14
  "pub": "rm -rf dist/* && npm build && npm publish",
15
- "patch": "npm version patch -m 'bump version into v%s' && git push origin main && git push origin --tags",
16
- "minor": "npm version minor -m 'bump version into v%s' && git push origin main && git push origin --tags",
17
- "major": "npm version major -m 'bump version into v%s' && git push origin main && git push origin --tags"
15
+ "push": "git push origin main && git push origin --tags",
16
+ "patch": "npm version patch -m 'bump version into v%s'",
17
+ "minor": "npm version minor -m 'bump version into v%s'",
18
+ "major": "npm version major -m 'bump version into v%s'"
18
19
  },
19
20
  "keywords": [
20
21
  "amazon-s3",
@@ -34,16 +35,17 @@
34
35
  "eslint": "^8.25.0",
35
36
  "eslint-config-prettier": "^8.5.0",
36
37
  "eslint-plugin-prettier": "^4.2.1",
37
- "picgo": "^1.5.0",
38
38
  "prettier": "^2.7.1",
39
39
  "typescript": "^4.8.4"
40
40
  },
41
41
  "dependencies": {
42
42
  "@aws-sdk/client-s3": "^3.304.0",
43
43
  "@aws-sdk/lib-storage": "^3.304.0",
44
+ "@aws-sdk/node-http-handler": "^3.360.0",
44
45
  "@aws-sdk/s3-request-presigner": "^3.305.0",
45
46
  "file-type": "^16.2.0",
46
47
  "hpagent": "^1.2.0",
47
- "mime": "^2.5.2"
48
+ "mime": "^2.5.2",
49
+ "picgo": "^1.5.3"
48
50
  }
49
51
  }