picgo-plugin-cloudflare-imgbed 0.1.0 → 0.3.0
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 +21 -12
- package/dist/index.js +31 -8
- package/package.json +4 -4
- package/doc/set-uploader.png +0 -0
package/README.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Third Party PicGo Uploader For MarSeventh/CloudFlare-ImgBed
|
|
4
4
|
|
|
5
|
+
**🚧 only support picgo-cli, no GUI support now.**
|
|
6
|
+
|
|
5
7
|
## Workflow
|
|
6
8
|
Rename the image in format `yyyyMMddHHmmssSSS` , then upload the image according to your configuration.
|
|
7
9
|
|
|
8
|
-
**Cli only til now.**
|
|
9
|
-
|
|
10
10
|
## Installation
|
|
11
11
|
```bash
|
|
12
12
|
picgo install cloudflare-imgbed
|
|
@@ -16,20 +16,29 @@ picgo install cloudflare-imgbed
|
|
|
16
16
|
```bash
|
|
17
17
|
picgo set uploader
|
|
18
18
|
```
|
|
19
|
-
|
|
20
|
-

|
|
21
|
-
|
|
22
19
|
- **Base URL**: `https://your-imgbed.com`
|
|
23
20
|
- **Auth Code**: you can set in `https://your-imgbed.com/systemConfig#security`, leave empty if not set.
|
|
24
|
-
- **
|
|
25
|
-
- **Upload Name Type**: how the backend
|
|
26
|
-
- origin(default):
|
|
27
|
-
- default
|
|
28
|
-
- short
|
|
29
|
-
- index
|
|
21
|
+
- **Upload Folder**: relative path, leave empty for root(`/`), it's like `https://your-imgbed.com/file/${Upload Folder}/202311251618630.webp` in links.
|
|
22
|
+
- **Upload Name Type**: how the backend renames your image. Since the plugin already renames images with a timestamp, the default is set to `origin` (no further rename by the backend).
|
|
23
|
+
- `origin` (plugin default): keep the uploaded filename as-is, e.g. `yyyyMMddHHmmssSSS.webp`
|
|
24
|
+
- `default`: add an index prefix, e.g. `11110000_yyyyMMddHHmmssSSS.webp`
|
|
25
|
+
- `short`: encode like a short link, e.g. `8P2yDGMl.webp`
|
|
26
|
+
- `index`: index only, e.g. `11110000.webp`
|
|
27
|
+
- **Upload Channel**: storage channel for uploading images (optional, defaults to `server-default` which uses server configuration).
|
|
28
|
+
- `server-default`: use the server's default channel configuration
|
|
29
|
+
- `telegram`: upload to Telegram
|
|
30
|
+
- `cfr2`: upload to Cloudflare R2
|
|
31
|
+
- `s3`: upload to S3-compatible storage
|
|
32
|
+
- `discord`: upload to Discord
|
|
33
|
+
- `huggingface`: upload to Hugging Face
|
|
34
|
+
- **Channel Name**: specific channel name (required when `Upload Channel` is not `server-default`, visit `https://your-imgbed.com/api/channels` for more details).
|
|
35
|
+
|
|
30
36
|
## Update
|
|
31
37
|
```bash
|
|
32
38
|
picgo update cloudflare-imgbed
|
|
33
39
|
```
|
|
34
40
|
|
|
35
|
-
##
|
|
41
|
+
## Parameters Not Implemented
|
|
42
|
+
- **severCompress**: "false" option only can be used in Telegram upload channel, default option is true on server side.
|
|
43
|
+
- **autoRetry**: AutoRetry is enabled by default on server side, so it's not necessary to add this option to the plugin.
|
|
44
|
+
- **returnFormat**: Always return full link, I don't think someone need the /file/xxx format.
|
package/dist/index.js
CHANGED
|
@@ -27,9 +27,14 @@ module.exports = (ctx) => {
|
|
|
27
27
|
const params = new URLSearchParams();
|
|
28
28
|
if (config.authCode)
|
|
29
29
|
params.set('authCode', config.authCode);
|
|
30
|
-
if (config.
|
|
31
|
-
params.set('uploadFolder', config.
|
|
30
|
+
if (config.uploadFolder)
|
|
31
|
+
params.set('uploadFolder', config.uploadFolder);
|
|
32
32
|
params.set('uploadNameType', (_a = config.uploadNameType) !== null && _a !== void 0 ? _a : 'origin');
|
|
33
|
+
if (config.uploadChannel && config.uploadChannel !== 'server-default') {
|
|
34
|
+
params.set('uploadChannel', config.uploadChannel);
|
|
35
|
+
if (config.channelName)
|
|
36
|
+
params.set('channelName', config.channelName);
|
|
37
|
+
}
|
|
33
38
|
const query = params.toString();
|
|
34
39
|
const uploadUrl = `${baseUrl}/upload${query ? '?' + query : ''}`;
|
|
35
40
|
for (const img of ctx.output) {
|
|
@@ -61,7 +66,7 @@ module.exports = (ctx) => {
|
|
|
61
66
|
return ctx;
|
|
62
67
|
},
|
|
63
68
|
config(ctx) {
|
|
64
|
-
var _a, _b, _c, _d, _e;
|
|
69
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
65
70
|
const savedConfig = (_a = ctx.getConfig('picBed.cloudflare-imgbed')) !== null && _a !== void 0 ? _a : {};
|
|
66
71
|
return [
|
|
67
72
|
{
|
|
@@ -81,21 +86,39 @@ module.exports = (ctx) => {
|
|
|
81
86
|
alias: 'Auth Code'
|
|
82
87
|
},
|
|
83
88
|
{
|
|
84
|
-
name: '
|
|
89
|
+
name: 'uploadFolder',
|
|
85
90
|
type: 'input',
|
|
86
|
-
default: (_d = savedConfig.
|
|
91
|
+
default: (_d = savedConfig.uploadFolder) !== null && _d !== void 0 ? _d : '',
|
|
87
92
|
required: false,
|
|
88
|
-
message: '
|
|
89
|
-
alias: 'Upload
|
|
93
|
+
message: 'Upload folder, e.g. images, blog/images (leave empty for root)',
|
|
94
|
+
alias: 'Upload Folder'
|
|
90
95
|
},
|
|
91
96
|
{
|
|
92
97
|
name: 'uploadNameType',
|
|
93
98
|
type: 'list',
|
|
94
99
|
default: (_e = savedConfig.uploadNameType) !== null && _e !== void 0 ? _e : 'origin',
|
|
95
100
|
required: false,
|
|
96
|
-
message: '
|
|
101
|
+
message: 'How backend renames image. origin=keep name (plugin default), default=add index prefix, short=short link, index=index only. Check README in https://github.com/MegaSuite/picgo-plugin-cloudflare-imgbed for more details. ',
|
|
97
102
|
choices: ['origin', 'default', 'index', 'short'],
|
|
98
103
|
alias: 'Upload Name Type'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'uploadChannel',
|
|
107
|
+
type: 'list',
|
|
108
|
+
default: (_f = savedConfig.uploadChannel) !== null && _f !== void 0 ? _f : 'server-default',
|
|
109
|
+
required: false,
|
|
110
|
+
message: 'Upload storage channel (server-default uses server config)',
|
|
111
|
+
choices: ['server-default', 'telegram', 'cfr2', 's3', 'discord', 'huggingface'],
|
|
112
|
+
alias: 'Upload Channel'
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: 'channelName',
|
|
116
|
+
type: 'input',
|
|
117
|
+
default: (_g = savedConfig.channelName) !== null && _g !== void 0 ? _g : '',
|
|
118
|
+
required: false,
|
|
119
|
+
message: 'Specific channel name (used when uploadChannel is not server-default)',
|
|
120
|
+
alias: 'Channel Name',
|
|
121
|
+
when: (answers) => answers.uploadChannel && answers.uploadChannel !== 'server-default'
|
|
99
122
|
}
|
|
100
123
|
];
|
|
101
124
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "picgo-plugin-cloudflare-imgbed",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Third Party PicGo Uploader For MarSeventh/CloudFlare-ImgBed",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"build": "tsc -p .",
|
|
13
13
|
"dev": "tsc -w -p .",
|
|
14
14
|
"lint": "eslint src",
|
|
15
|
-
"patch": "npm version patch && git push origin
|
|
16
|
-
"minor": "npm version minor && git push origin
|
|
17
|
-
"major": "npm version major && git push origin
|
|
15
|
+
"patch": "npm version patch && git push origin main && git push origin --tags",
|
|
16
|
+
"minor": "npm version minor && git push origin main && git push origin --tags",
|
|
17
|
+
"major": "npm version major && git push origin main && git push origin --tags"
|
|
18
18
|
},
|
|
19
19
|
"keywords": [
|
|
20
20
|
"picgo",
|
package/doc/set-uploader.png
DELETED
|
Binary file
|