piclist 2.0.4 → 2.1.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/.github/workflows/docker.yml +12 -2
- package/.prettierrc +1 -1
- package/CHANGELOG.md +22 -0
- package/README.md +32 -24
- package/README_en.md +33 -24
- package/bin/picgo-server +33 -33
- package/dist/core/PicGo.d.ts +2 -0
- package/dist/i18n/index.d.ts +1 -3
- package/dist/index.js +2 -2
- package/dist/plugins/commander/configManager.d.ts +5 -0
- package/dist/plugins/uploader/utils.d.ts +1 -1
- package/dist/types/index.d.ts +44 -78
- package/dist/utils/configManager.d.ts +15 -0
- package/dist/utils/db.d.ts +4 -1
- package/eslint.config.js +71 -42
- package/package.json +21 -21
- package/renovate.json +4 -0
- package/rollup.config.js +10 -10
|
@@ -5,13 +5,23 @@ on:
|
|
|
5
5
|
tags:
|
|
6
6
|
- '*'
|
|
7
7
|
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
enable_push:
|
|
10
|
+
description: 'Enable push to Docker Hub'
|
|
11
|
+
required: true
|
|
12
|
+
type: choice
|
|
13
|
+
options:
|
|
14
|
+
- 'true'
|
|
15
|
+
- 'false'
|
|
16
|
+
default: 'false'
|
|
17
|
+
|
|
8
18
|
|
|
9
19
|
jobs:
|
|
10
20
|
build-and-push:
|
|
11
21
|
runs-on: ubuntu-latest
|
|
12
22
|
steps:
|
|
13
23
|
- name: Checkout Repository
|
|
14
|
-
uses: actions/checkout@
|
|
24
|
+
uses: actions/checkout@v6
|
|
15
25
|
|
|
16
26
|
- name: Set up Docker Buildx
|
|
17
27
|
uses: docker/setup-buildx-action@v3
|
|
@@ -27,7 +37,7 @@ jobs:
|
|
|
27
37
|
with:
|
|
28
38
|
context: .
|
|
29
39
|
file: ./Dockerfile
|
|
30
|
-
push: true
|
|
40
|
+
push: ${{ github.event.inputs.enable_push == 'true' }}
|
|
31
41
|
tags: kuingsmile/piclist:latest
|
|
32
42
|
platforms: linux/amd64,linux/arm64
|
|
33
43
|
|
package/.prettierrc
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## (2026-01-09)
|
|
2
|
+
|
|
3
|
+
* :arrow_up: Upgrade(custom): upgrade to piclist/store 3.0.1 c4aecc8
|
|
4
|
+
* :pencil: Docs(custom): update readme 587d588
|
|
5
|
+
* :sparkles: Feature(custom): db now support multiple config get 47314cc
|
|
6
|
+
* :sparkles: Feature(custom): support multiple uploader config with the same config in PicList desktop 1f145ed
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## (2026-01-06)
|
|
11
|
+
|
|
12
|
+
* :arrow_up: Upgrade(custom): upgrade deps 95477a4
|
|
13
|
+
* :arrow_up: Upgrade(custom): upgrade deps 58be712
|
|
14
|
+
* :bug: Fix(custom): fix an issue where eslint not worked as expected 364ce95
|
|
15
|
+
* :package: Chore(custom): enable conditional push to Docker Hub based on workflow input 0212769
|
|
16
|
+
* :package: Chore(custom): update gitignore file fcb0674
|
|
17
|
+
* :pencil: Docs(custom): update docs b971986
|
|
18
|
+
* Add renovate.json (#22) 484bc1a, closes #22
|
|
19
|
+
* Update dependency @smithy/node-http-handler to v4.4.7 (#23) eb0e239, closes #23
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
1
23
|
## (2025-11-14)
|
|
2
24
|
|
|
3
25
|
* :arrow_up: Upgrade(custom): upgrade deps dcb971f
|
package/README.md
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|

|
|
7
|
-

|
|
8
7
|
|
|
9
8
|

|
|
10
9
|
|
|
@@ -16,6 +15,14 @@ PicList-Core 是一个功能强大的图片上传工具,提供 CLI 和 API 两
|
|
|
16
15
|
|
|
17
16
|
## 增强功能
|
|
18
17
|
|
|
18
|
+
- **多配置支持**:
|
|
19
|
+
- 每个图床支持多个配置,兼容桌面版PicList配置文件
|
|
20
|
+
- 通过 `picgo config-list <uploader>` 列出所有配置
|
|
21
|
+
- 通过 `picgo config-use <uploader> <configName>` 切换默认配置
|
|
22
|
+
- 通过 `picgo config-remove <uploader> <configName>` 删除配置
|
|
23
|
+
- 通过 `picgo config-rename <uploader> <oldName> <newName>` 重命名配置
|
|
24
|
+
- 通过 `picgo config-show <uploader> [configName]` 查看配置详情
|
|
25
|
+
|
|
19
26
|
- **图像处理能力**:
|
|
20
27
|
- 添加水印、压缩图片和转换格式
|
|
21
28
|
- 通过 `picgo set buildin watermark` 和 `picgo set buildin compress` CLI 命令进行配置
|
|
@@ -183,25 +190,30 @@ $ picgo-server -h
|
|
|
183
190
|
```bash
|
|
184
191
|
$ picgo -h
|
|
185
192
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
193
|
+
Usage: picgo [options] [command]
|
|
194
|
+
|
|
195
|
+
Options:
|
|
196
|
+
-v, --version output the version number
|
|
197
|
+
-d, --debug debug mode
|
|
198
|
+
-s, --silent silent mode
|
|
199
|
+
-c, --config <path> set config path
|
|
200
|
+
-p, --proxy <url> set proxy for uploading
|
|
201
|
+
-h, --help display help for command
|
|
202
|
+
|
|
203
|
+
Commands:
|
|
204
|
+
install|add [options] <plugins...> install picgo plugin
|
|
205
|
+
uninstall|rm <plugins...> uninstall picgo plugin
|
|
206
|
+
update|up [options] <plugins...> update picgo plugin
|
|
207
|
+
config-list <uploader> list all configs names for an uploader
|
|
208
|
+
config-use <uploader> <configName> set a config as default for an uploader
|
|
209
|
+
config-remove <uploader> <configName> remove a config for an uploader
|
|
210
|
+
config-rename <uploader> <oldName> <newName> rename a config for an uploader
|
|
211
|
+
config-show <uploader> [configName] show details of a config
|
|
212
|
+
set|config <module> [name] [configName] configure config of picgo modules, uploader|transformer|plugin|buildin. For uploader, configName is optional (defaults to "Default").
|
|
213
|
+
upload|u [input...] upload, go go go
|
|
214
|
+
use [module] use modules of picgo
|
|
215
|
+
i18n [lang] change language, zh-CN, zh-TW, en
|
|
216
|
+
help [command] display help for command
|
|
205
217
|
```
|
|
206
218
|
|
|
207
219
|
#### 从路径上传图片
|
|
@@ -243,7 +255,3 @@ picgo.upload(['/xxx/xxx.jpg'])
|
|
|
243
255
|
// 从剪贴板上传图片
|
|
244
256
|
picgo.upload()
|
|
245
257
|
```
|
|
246
|
-
|
|
247
|
-
## 文档
|
|
248
|
-
|
|
249
|
-
获取更多详细信息,请查看[PicGo-Core文档](https://picgo.github.io/PicGo-Core-Doc/)。
|
package/README_en.md
CHANGED
|
@@ -16,6 +16,14 @@ You can refer to the [DeepWiki of PiclList-Core](https://deepwiki.com/Kuingsmile
|
|
|
16
16
|
|
|
17
17
|
## Enhanced Features
|
|
18
18
|
|
|
19
|
+
- **Multi-configuration support**:
|
|
20
|
+
- Each uploader supports multiple configurations, compatible with PicList-Desktop config files
|
|
21
|
+
- List all configurations via `picgo config-list <uploader>`
|
|
22
|
+
- Switch default configuration via `picgo config-use <uploader> <configName>`
|
|
23
|
+
- Remove configuration via `picgo config-remove <uploader> <configName>`
|
|
24
|
+
- Rename configuration via `picgo config-rename <uploader> <oldName> <newName>`
|
|
25
|
+
- View configuration details via `picgo config-show <uploader> [configName]`
|
|
26
|
+
|
|
19
27
|
- **Image processing capabilities**:
|
|
20
28
|
- Add watermarks, compress images, and convert formats
|
|
21
29
|
- Configure via `picgo set buildin watermark` and `picgo set buildin compress` CLI commands
|
|
@@ -183,25 +191,30 @@ Show help:
|
|
|
183
191
|
```bash
|
|
184
192
|
$ picgo -h
|
|
185
193
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
194
|
+
Usage: picgo [options] [command]
|
|
195
|
+
|
|
196
|
+
Options:
|
|
197
|
+
-v, --version output the version number
|
|
198
|
+
-d, --debug debug mode
|
|
199
|
+
-s, --silent silent mode
|
|
200
|
+
-c, --config <path> set config path
|
|
201
|
+
-p, --proxy <url> set proxy for uploading
|
|
202
|
+
-h, --help display help for command
|
|
203
|
+
|
|
204
|
+
Commands:
|
|
205
|
+
install|add [options] <plugins...> install picgo plugin
|
|
206
|
+
uninstall|rm <plugins...> uninstall picgo plugin
|
|
207
|
+
update|up [options] <plugins...> update picgo plugin
|
|
208
|
+
config-list <uploader> list all configs names for an uploader
|
|
209
|
+
config-use <uploader> <configName> set a config as default for an uploader
|
|
210
|
+
config-remove <uploader> <configName> remove a config for an uploader
|
|
211
|
+
config-rename <uploader> <oldName> <newName> rename a config for an uploader
|
|
212
|
+
config-show <uploader> [configName] show details of a config
|
|
213
|
+
set|config <module> [name] [configName] configure config of picgo modules, uploader|transformer|plugin|buildin. For uploader, configName is optional (defaults to "Default").
|
|
214
|
+
upload|u [input...] upload, go go go
|
|
215
|
+
use [module] use modules of picgo
|
|
216
|
+
i18n [lang] change language, zh-CN, zh-TW, en
|
|
217
|
+
help [command] display help for command
|
|
205
218
|
```
|
|
206
219
|
|
|
207
220
|
#### Upload a picture from path
|
|
@@ -242,8 +255,4 @@ picgo.upload(['/xxx/xxx.jpg'])
|
|
|
242
255
|
|
|
243
256
|
// upload a picture from clipboard
|
|
244
257
|
picgo.upload()
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
## Documentation
|
|
248
|
-
|
|
249
|
-
For more details, you can checkout [documentation of PicGo-Core](https://picgo.github.io/PicGo-Core-Doc/).
|
|
258
|
+
```
|
package/bin/picgo-server
CHANGED
|
@@ -81,11 +81,11 @@ const handleResponse = ({
|
|
|
81
81
|
'Content-Type': 'application/json',
|
|
82
82
|
'access-control-allow-headers': '*',
|
|
83
83
|
'access-control-allow-methods': 'POST, GET, OPTIONS',
|
|
84
|
-
'access-control-allow-origin': '*'
|
|
84
|
+
'access-control-allow-origin': '*',
|
|
85
85
|
},
|
|
86
86
|
body = {
|
|
87
|
-
success: false
|
|
88
|
-
}
|
|
87
|
+
success: false,
|
|
88
|
+
},
|
|
89
89
|
}) => {
|
|
90
90
|
if (body && body.success === false) {
|
|
91
91
|
console.log('[PicList Server] upload failed, see log for more detail ↑')
|
|
@@ -148,28 +148,28 @@ const multerStorage = multer.diskStorage({
|
|
|
148
148
|
file.originalname = Buffer.from(file.originalname, 'latin1').toString('utf8')
|
|
149
149
|
}
|
|
150
150
|
cb(null, file.originalname)
|
|
151
|
-
}
|
|
151
|
+
},
|
|
152
152
|
})
|
|
153
153
|
|
|
154
154
|
const uploadMulter = multer({
|
|
155
|
-
storage: multerStorage
|
|
155
|
+
storage: multerStorage,
|
|
156
156
|
})
|
|
157
157
|
|
|
158
158
|
const changeCurrentUploader = (type, config, id) => {
|
|
159
159
|
if (!type) return
|
|
160
160
|
if (id) {
|
|
161
161
|
picgo.saveConfig({
|
|
162
|
-
[`uploader.${type}.defaultId`]: id
|
|
162
|
+
[`uploader.${type}.defaultId`]: id,
|
|
163
163
|
})
|
|
164
164
|
}
|
|
165
165
|
if (config) {
|
|
166
166
|
picgo.saveConfig({
|
|
167
|
-
[`picBed.${type}`]: config
|
|
167
|
+
[`picBed.${type}`]: config,
|
|
168
168
|
})
|
|
169
169
|
}
|
|
170
170
|
picgo.saveConfig({
|
|
171
171
|
'picBed.current': type,
|
|
172
|
-
'picBed.uploader': type
|
|
172
|
+
'picBed.uploader': type,
|
|
173
173
|
})
|
|
174
174
|
}
|
|
175
175
|
|
|
@@ -186,8 +186,8 @@ router.post('/upload', async ({ response, list = [], urlparams }) => {
|
|
|
186
186
|
response,
|
|
187
187
|
body: {
|
|
188
188
|
success: false,
|
|
189
|
-
message: 'Unauthorized access'
|
|
190
|
-
}
|
|
189
|
+
message: 'Unauthorized access',
|
|
190
|
+
},
|
|
191
191
|
})
|
|
192
192
|
}
|
|
193
193
|
|
|
@@ -209,7 +209,7 @@ router.post('/upload', async ({ response, list = [], urlparams }) => {
|
|
|
209
209
|
needRestore = true
|
|
210
210
|
picgo.saveConfig({
|
|
211
211
|
'picBed.current': picbed,
|
|
212
|
-
'picBed.uploader': picbed
|
|
212
|
+
'picBed.uploader': picbed,
|
|
213
213
|
})
|
|
214
214
|
}
|
|
215
215
|
if (currentPicBed[picbed]?._configName) {
|
|
@@ -234,16 +234,16 @@ router.post('/upload', async ({ response, list = [], urlparams }) => {
|
|
|
234
234
|
response,
|
|
235
235
|
body: {
|
|
236
236
|
success: true,
|
|
237
|
-
result: [res]
|
|
238
|
-
}
|
|
237
|
+
result: [res],
|
|
238
|
+
},
|
|
239
239
|
})
|
|
240
240
|
} else {
|
|
241
241
|
handleResponse({
|
|
242
242
|
response,
|
|
243
243
|
body: {
|
|
244
244
|
success: false,
|
|
245
|
-
message: errorMessage
|
|
246
|
-
}
|
|
245
|
+
message: errorMessage,
|
|
246
|
+
},
|
|
247
247
|
})
|
|
248
248
|
}
|
|
249
249
|
} else {
|
|
@@ -259,16 +259,16 @@ router.post('/upload', async ({ response, list = [], urlparams }) => {
|
|
|
259
259
|
response,
|
|
260
260
|
body: {
|
|
261
261
|
success: true,
|
|
262
|
-
result: res
|
|
263
|
-
}
|
|
262
|
+
result: res,
|
|
263
|
+
},
|
|
264
264
|
})
|
|
265
265
|
} else {
|
|
266
266
|
handleResponse({
|
|
267
267
|
response,
|
|
268
268
|
body: {
|
|
269
269
|
success: false,
|
|
270
|
-
message: errorMessage
|
|
271
|
-
}
|
|
270
|
+
message: errorMessage,
|
|
271
|
+
},
|
|
272
272
|
})
|
|
273
273
|
}
|
|
274
274
|
}
|
|
@@ -276,7 +276,7 @@ router.post('/upload', async ({ response, list = [], urlparams }) => {
|
|
|
276
276
|
if (needRestore) {
|
|
277
277
|
picgo.saveConfig({
|
|
278
278
|
'picBed.current': currentPicBedType,
|
|
279
|
-
'picBed.uploader': currentPicBedType
|
|
279
|
+
'picBed.uploader': currentPicBedType,
|
|
280
280
|
})
|
|
281
281
|
if (currentPicBed[picbed]?._configName) {
|
|
282
282
|
changeCurrentUploader(currentPicBedType, currentPicBedConfig, currentPicBedConfigId)
|
|
@@ -288,8 +288,8 @@ router.post('/upload', async ({ response, list = [], urlparams }) => {
|
|
|
288
288
|
response,
|
|
289
289
|
body: {
|
|
290
290
|
success: false,
|
|
291
|
-
message: errorMessage
|
|
292
|
-
}
|
|
291
|
+
message: errorMessage,
|
|
292
|
+
},
|
|
293
293
|
})
|
|
294
294
|
}
|
|
295
295
|
})
|
|
@@ -299,8 +299,8 @@ router.any('/heartbeat', async ({ response }) => {
|
|
|
299
299
|
response,
|
|
300
300
|
body: {
|
|
301
301
|
success: true,
|
|
302
|
-
result: 'alive'
|
|
303
|
-
}
|
|
302
|
+
result: 'alive',
|
|
303
|
+
},
|
|
304
304
|
})
|
|
305
305
|
})
|
|
306
306
|
|
|
@@ -389,7 +389,7 @@ class Server {
|
|
|
389
389
|
handleResponse({
|
|
390
390
|
response,
|
|
391
391
|
statusCode: method === 'POST' ? 404 : 404,
|
|
392
|
-
body: { success: false }
|
|
392
|
+
body: { success: false },
|
|
393
393
|
})
|
|
394
394
|
} else {
|
|
395
395
|
response.statusCode = 405
|
|
@@ -419,8 +419,8 @@ class Server {
|
|
|
419
419
|
response,
|
|
420
420
|
body: {
|
|
421
421
|
success: false,
|
|
422
|
-
message: 'Error processing formData'
|
|
423
|
-
}
|
|
422
|
+
message: 'Error processing formData',
|
|
423
|
+
},
|
|
424
424
|
})
|
|
425
425
|
}
|
|
426
426
|
const list = request.files.map(file => file.path)
|
|
@@ -428,7 +428,7 @@ class Server {
|
|
|
428
428
|
handlerEntry.handler({
|
|
429
429
|
list,
|
|
430
430
|
response,
|
|
431
|
-
urlparams: urlSP
|
|
431
|
+
urlparams: urlSP,
|
|
432
432
|
})
|
|
433
433
|
}
|
|
434
434
|
})
|
|
@@ -446,7 +446,7 @@ class Server {
|
|
|
446
446
|
handlerEntry.handler({
|
|
447
447
|
...postObj,
|
|
448
448
|
response,
|
|
449
|
-
urlparams: urlSP
|
|
449
|
+
urlparams: urlSP,
|
|
450
450
|
})
|
|
451
451
|
}
|
|
452
452
|
} catch (err) {
|
|
@@ -455,8 +455,8 @@ class Server {
|
|
|
455
455
|
response,
|
|
456
456
|
body: {
|
|
457
457
|
success: false,
|
|
458
|
-
message: 'Not sending data in JSON format'
|
|
459
|
-
}
|
|
458
|
+
message: 'Not sending data in JSON format',
|
|
459
|
+
},
|
|
460
460
|
})
|
|
461
461
|
}
|
|
462
462
|
})
|
|
@@ -468,7 +468,7 @@ class Server {
|
|
|
468
468
|
if (handlerEntry.handler) {
|
|
469
469
|
handlerEntry.handler({
|
|
470
470
|
response,
|
|
471
|
-
urlparams: query ? new URLSearchParams(query) : undefined
|
|
471
|
+
urlparams: query ? new URLSearchParams(query) : undefined,
|
|
472
472
|
})
|
|
473
473
|
}
|
|
474
474
|
|
|
@@ -493,7 +493,7 @@ class Server {
|
|
|
493
493
|
await axios.post(ensureHTTPLink(`${probeHost}:${port}/heartbeat`))
|
|
494
494
|
console.log(`[PicList Server] server is already running at ${port}, no need to start again`)
|
|
495
495
|
this.shutdown(true)
|
|
496
|
-
} catch (
|
|
496
|
+
} catch (_e) {
|
|
497
497
|
console.log(`[PicList Server] ${port} is busy, trying with port ${port + 1}`)
|
|
498
498
|
this.listen(port + 1)
|
|
499
499
|
}
|
package/dist/core/PicGo.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Logger } from '../lib/Logger';
|
|
|
4
4
|
import { PluginHandler } from '../lib/PluginHandler';
|
|
5
5
|
import { Request } from '../lib/Request';
|
|
6
6
|
import { IHelper, II18nManager, IImgInfo, IPicGo, IPicGoPlugin, IPicGoPluginInterface, IPluginLoader, IRequest, IStringKeyMap } from '../types';
|
|
7
|
+
import { ConfigManager } from '../utils/configManager';
|
|
7
8
|
export declare class PicGo extends EventEmitter implements IPicGo {
|
|
8
9
|
private _config;
|
|
9
10
|
private lifecycle;
|
|
@@ -19,6 +20,7 @@ export declare class PicGo extends EventEmitter implements IPicGo {
|
|
|
19
20
|
rawInput: any[];
|
|
20
21
|
processedInput: any[];
|
|
21
22
|
pluginHandler: PluginHandler;
|
|
23
|
+
configManager: ConfigManager;
|
|
22
24
|
/**
|
|
23
25
|
* @deprecated will be removed in v1.5.0+
|
|
24
26
|
*
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { II18nManager, IPicGo, IStringKeyMap } from '../types';
|
|
2
2
|
import { ILocalesKey } from './zh-CN';
|
|
3
|
-
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
}
|
|
3
|
+
type ILocale = Record<string, any>;
|
|
6
4
|
declare class I18nManager implements II18nManager {
|
|
7
5
|
private readonly i18n;
|
|
8
6
|
private readonly objectAdapter;
|