Merge branch 'dev' into release

This commit is contained in:
Kuingsmile 2024-10-22 15:28:19 +08:00
commit 606ecd15d6
18 changed files with 860 additions and 741 deletions

View File

@ -1,3 +1,25 @@
## :tada: 2.9.4 (2024-10-22)
### :sparkles: Features
* **custom:** change default short key ([64fba8a](https://github.com/Kuingsmile/piclist/commit/64fba8a))
* **custom:** optimize second uploader ([0565ce3](https://github.com/Kuingsmile/piclist/commit/0565ce3)), closes [#241](https://github.com/Kuingsmile/piclist/issues/241) [#238](https://github.com/Kuingsmile/piclist/issues/238)
* **custom:** remove telegra.ph ([59ed79a](https://github.com/Kuingsmile/piclist/commit/59ed79a))
### :bug: Bug Fixes
* **custom:** fix gallery image delete bug ([d6f48e5](https://github.com/Kuingsmile/piclist/commit/d6f48e5)), closes [#239](https://github.com/Kuingsmile/piclist/issues/239)
* **custom:** fix webdav url bug ([07cf63a](https://github.com/Kuingsmile/piclist/commit/07cf63a)), closes [#243](https://github.com/Kuingsmile/piclist/issues/243)
### :pencil: Documentation
* **custom:** prepare for 2.9.4 ([4b12e42](https://github.com/Kuingsmile/piclist/commit/4b12e42))
## :tada: 2.9.3 (2024-08-22)

331
FAQ.md
View File

@ -1,166 +1,165 @@
# FAQ
该FAQ修改自PicGo的FAQ感谢PicGo的作者Molunerfinn。
## 常见问题
> 常规配置问题请参考 [官方文档](https://piclist.cn)
## 1. PicList和PicGo有什么关系
PicList项目fork自PicGo项目基于PicGo进行了二次开发同时核心功能内核PicGo-Core也进行了二次开发重命名为[PicList-Core](https://github.com/Kuingsmile/PicList-Core)。
PicList所有新功能的添加没有影响到PicGo的原有功能所以你可以在PicList中使用PicGo的大部分插件。同时仍然可以配合typora、obsidian等软件进行使用。
## 2. 使用图床管理功能时,出现无法获取目录等错误
请查看日志文件 `manage.log`此外各平台的API调用基本都有每小时次数限制如果出现错误请稍后再试。
## 3. 支持哪些图床远端同步删除
目前支持的图床有:
- 阿里云 OSS
- 腾讯云 COS
- 七牛云 Kodo
- 又拍云
- SM.MS
- Imgur
- GitHub
- WebDav
- Aws S3
- 本地路径
- 内置SFTP
- 多吉云
- 华为云 OBS
- Alist
- 兰空图床
## 4. 能否支持上传视频文件
可以,通过新添加的图床管理功能,你可以上传任意格式的文件,包括视频文件。同时,在管理界面内上传时,使用分片上传/流式上传等方式相对于PicGo内置的转换为base64的方式上传更快更稳定。
## 5. 能否支持某某某图床
PicList本体支持了如下图床
- `七牛图床`
- `AWS S3 兼容平台`
- `腾讯云 COS`
- `又拍云`
- `GitHub`
- `SM.MS`
- `阿里云 OSS`
- `Imgur`
- `Webdav`
- `本地图床`
- `SFTP`
- `Telegra.ph`
- `兰空图床`
- `PicList(套娃)`
PicList计划整合和优化现有插件内置更多的常用图床。
此外PicList兼容PicGo的插件系统需要其他图床支持可以参考目前已有的PicGo三方 [插件](https://github.com/PicGo/Awesome-PicGo),如果还是没有你所需要的图床欢迎开发一个插件供大家使用。
## 6. Github 图床有时能上传,有时上传失败
GitHub 服务器和国内 GFW 的问题会导致有时上传成功,有时上传失败,无解。
想要稳定请使用付费云存储,如阿里云、腾讯云等,价格也不会贵。
## 7. Mac 上无法打开 PicList 的主窗口界面
要打开主窗口,请右键或者双指点按顶部栏 PicList 图标,选择「打开主窗口」即可打开主窗口。
或者在dock栏中右键PicList图标选择「打开主窗口」。
## 8. 上传失败,或者是服务器出错
1. PicList 自带的图床都经过测试,上传出错一般都不是 PicList 自身的原因。如果你用的是 GitHub 图床请参考上面的第 7 点。
2. 检查 PicList 的日志(报错日志可以在 PicList 设置 -> 设置日志文件 -> 点击打开 后找到),看看 `[PicList Error]` 的报错信息里有什么关键信息
1. 先自行搜索 error 里的报错信息,往往你能百度或者谷歌出问题原因,不必开 issue。
2. 如果有带有 `401` 、`403` 等 `40X` 状态码字样的,不用怀疑,就是你配置写错了,仔细检查配置,看看是否多了空格之类的。
3. 如果带有 `HttpError`、`RequestError` 、 `socket hang up` 等字样的说明这是网络问题我无法帮你解决网络问题请检查你自己的网络是否有代理DNS 设置是否正常等。
3. 通常网络问题引起的上传失败都是因为代理设置不当导致的。如果开启了系统代理,建议同时也在 PicList 的代理设置中设置对应的HTTP代理。
## 10. macOS版本安装完之后没有主界面
请找到PicList在顶部栏的图标然后右键触摸板双指点按或者鼠标右键即可找到「打开主窗口」的菜单。
或者再Docker栏PicList的图标上右键即可找到「打开主窗口」的菜单。
## 11. macOS系统安装完PicList显示「文件已损坏」或者安装完打开没有反应
请升级PicList 1.4.1或以上版本自1.4.1开始PicList已经经过Apple的签名不会再出现这种情况。
## 12. 水印没有正常添加
PicList在添加水印前会先检查字体文件是否存在如果不存在会自动下载字体文件但是由于网络问题可能会导致字体文件下载失败此时会跳过水印添加。
请根据自己的系统检查对应路径下的字体文件是否存在,如果不存在,请手动下载字体文件,然后放到对应的路径下。
Windows: `%APPDATA%\piclist\assets\simhei.ttf`
Linux: `$XDG_CONFIG_HOME/piclist/assets/simhei.ttf` or `~/.config//assets/simhei.ttf`
macOS: `~/Library/Application\ Support/picgo/assets/simhei.ttf`
字体文件下载地址:[https://release.piclist.cn/simhei.ttf](https://release.piclist.cn/simhei.ttf)
## 13. 使用aws-s3插件上传到cloudflare R2时出现上传失败问题
R2的endpoint地址会出现被GFW sni阻断的问题查看piclist.log后将对应的ip地址加入代理列表可解决。
## 14. PicList兼容所有的PicGo插件吗
PicList兼容绝大部分的PicGo插件。然而由于PicList使用了更新的electron版本与旧版本的sharp库不兼容所以部分插件可能无法使用。
已知的无法使用的插件有:
- picgo-plugin-watermark (已经内置)
- picgo-plugin-pic-migrater (该插件会校验PicGo的版本无法使用请换用pic-migrater-piclist插件)
- picgo-plugin-auto-delete (已经内置)
欢迎大家测试其他插件如果有无法使用的插件欢迎开issue反馈。
## 15. 如何通过Docker运行PicList-core?
### docker run
修改 `./piclist`为你自己的路径,修改 `piclist123456`为你自己的密钥。
```bash
docker run -d \
--name piclist \
--restart always \
-p 36677:36677 \
-v "./piclist:/root/.piclist" \
kuingsmile/piclist:latest \
node /usr/local/bin/picgo-server -k piclist123456
```
### docker-compose
下载piclist-core仓库的 `docker-compose.yml`文件,或者复制以下内容到 `docker-compose.yml`文件中:
```yaml
version: '3.3'
services:
node:
image: 'kuingsmile/piclist:latest'
container_name: piclist
restart: always
ports:
- 36677:36677
volumes:
- './piclist:/root/.piclist'
command: node /usr/local/bin/picgo-server -k piclist123456
```
你可以修改 `volumes`为你自己的路径,修改 `command`为你自己的密钥。
然后运行
```bash
docker-compose up -d
```
# FAQ
该FAQ修改自PicGo的FAQ感谢PicGo的作者Molunerfinn。
## 常见问题
> 常规配置问题请参考 [官方文档](https://piclist.cn)
## 1. PicList和PicGo有什么关系
PicList项目fork自PicGo项目基于PicGo进行了二次开发同时核心功能内核PicGo-Core也进行了二次开发重命名为[PicList-Core](https://github.com/Kuingsmile/PicList-Core)。
PicList所有新功能的添加没有影响到PicGo的原有功能所以你可以在PicList中使用PicGo的大部分插件。同时仍然可以配合typora、obsidian等软件进行使用。
## 2. 使用图床管理功能时,出现无法获取目录等错误
请查看日志文件 `manage.log`此外各平台的API调用基本都有每小时次数限制如果出现错误请稍后再试。
## 3. 支持哪些图床远端同步删除
目前支持的图床有:
- 阿里云 OSS
- 腾讯云 COS
- 七牛云 Kodo
- 又拍云
- SM.MS
- Imgur
- GitHub
- WebDav
- Aws S3
- 本地路径
- 内置SFTP
- 多吉云
- 华为云 OBS
- Alist
- 兰空图床
## 4. 能否支持上传视频文件
可以,通过新添加的图床管理功能,你可以上传任意格式的文件,包括视频文件。同时,在管理界面内上传时,使用分片上传/流式上传等方式相对于PicGo内置的转换为base64的方式上传更快更稳定。
## 5. 能否支持某某某图床
PicList本体支持了如下图床
- `七牛图床`
- `AWS S3 兼容平台`
- `腾讯云 COS`
- `又拍云`
- `GitHub`
- `SM.MS`
- `阿里云 OSS`
- `Imgur`
- `Webdav`
- `本地图床`
- `SFTP`
- `兰空图床`
- `PicList(套娃)`
PicList计划整合和优化现有插件内置更多的常用图床。
此外PicList兼容PicGo的插件系统需要其他图床支持可以参考目前已有的PicGo三方 [插件](https://github.com/PicGo/Awesome-PicGo),如果还是没有你所需要的图床欢迎开发一个插件供大家使用。
## 6. Github 图床有时能上传,有时上传失败
GitHub 服务器和国内 GFW 的问题会导致有时上传成功,有时上传失败,无解。
想要稳定请使用付费云存储,如阿里云、腾讯云等,价格也不会贵。
## 7. Mac 上无法打开 PicList 的主窗口界面
要打开主窗口,请右键或者双指点按顶部栏 PicList 图标,选择「打开主窗口」即可打开主窗口。
或者在dock栏中右键PicList图标选择「打开主窗口」。
## 8. 上传失败,或者是服务器出错
1. PicList 自带的图床都经过测试,上传出错一般都不是 PicList 自身的原因。如果你用的是 GitHub 图床请参考上面的第 7 点。
2. 检查 PicList 的日志(报错日志可以在 PicList 设置 -> 设置日志文件 -> 点击打开 后找到),看看 `[PicList Error]` 的报错信息里有什么关键信息
1. 先自行搜索 error 里的报错信息,往往你能百度或者谷歌出问题原因,不必开 issue。
2. 如果有带有 `401` 、`403` 等 `40X` 状态码字样的,不用怀疑,就是你配置写错了,仔细检查配置,看看是否多了空格之类的。
3. 如果带有 `HttpError`、`RequestError` 、 `socket hang up` 等字样的说明这是网络问题我无法帮你解决网络问题请检查你自己的网络是否有代理DNS 设置是否正常等。
3. 通常网络问题引起的上传失败都是因为代理设置不当导致的。如果开启了系统代理,建议同时也在 PicList 的代理设置中设置对应的HTTP代理。
## 10. macOS版本安装完之后没有主界面
请找到PicList在顶部栏的图标然后右键触摸板双指点按或者鼠标右键即可找到「打开主窗口」的菜单。
或者再Docker栏PicList的图标上右键即可找到「打开主窗口」的菜单。
## 11. macOS系统安装完PicList显示「文件已损坏」或者安装完打开没有反应
请升级PicList 1.4.1或以上版本自1.4.1开始PicList已经经过Apple的签名不会再出现这种情况。
## 12. 水印没有正常添加
PicList在添加水印前会先检查字体文件是否存在如果不存在会自动下载字体文件但是由于网络问题可能会导致字体文件下载失败此时会跳过水印添加。
请根据自己的系统检查对应路径下的字体文件是否存在,如果不存在,请手动下载字体文件,然后放到对应的路径下。
Windows: `%APPDATA%\piclist\assets\simhei.ttf`
Linux: `$XDG_CONFIG_HOME/piclist/assets/simhei.ttf` or `~/.config//assets/simhei.ttf`
macOS: `~/Library/Application\ Support/picgo/assets/simhei.ttf`
字体文件下载地址:[https://release.piclist.cn/simhei.ttf](https://release.piclist.cn/simhei.ttf)
## 13. 使用aws-s3插件上传到cloudflare R2时出现上传失败问题
R2的endpoint地址会出现被GFW sni阻断的问题查看piclist.log后将对应的ip地址加入代理列表可解决。
## 14. PicList兼容所有的PicGo插件吗
PicList兼容绝大部分的PicGo插件。然而由于PicList使用了更新的electron版本与旧版本的sharp库不兼容所以部分插件可能无法使用。
已知的无法使用的插件有:
- picgo-plugin-watermark (已经内置)
- picgo-plugin-pic-migrater (该插件会校验PicGo的版本无法使用请换用pic-migrater-piclist插件)
- picgo-plugin-auto-delete (已经内置)
欢迎大家测试其他插件如果有无法使用的插件欢迎开issue反馈。
## 15. 如何通过Docker运行PicList-core?
### docker run
修改 `./piclist`为你自己的路径,修改 `piclist123456`为你自己的密钥。
```bash
docker run -d \
--name piclist \
--restart always \
-p 36677:36677 \
-v "./piclist:/root/.piclist" \
kuingsmile/piclist:latest \
node /usr/local/bin/picgo-server -k piclist123456
```
### docker-compose
下载piclist-core仓库的 `docker-compose.yml`文件,或者复制以下内容到 `docker-compose.yml`文件中:
```yaml
version: '3.3'
services:
node:
image: 'kuingsmile/piclist:latest'
container_name: piclist
restart: always
ports:
- 36677:36677
volumes:
- './piclist:/root/.piclist'
command: node /usr/local/bin/picgo-server -k piclist123456
```
你可以修改 `volumes`为你自己的路径,修改 `command`为你自己的密钥。
然后运行
```bash
docker-compose up -d
```

View File

@ -55,7 +55,6 @@ PicList itself supports the following image hosting platforms:
- Webdav
- Local path
- SFTP
- Telegra.ph
- Lsky Pro
- PicList (nested)

View File

@ -34,7 +34,7 @@ if you want to use PicList-core, please go to [https://github.com/Kuingsmile/Pic
## Features
- Retains all the features of PicGo and is compatible with the vast majority of existing PicGo plugins, including integrations with software like Typora and Obsidian.
- Added multiple built-in image hosting platforms, such as WebDav, Lsky Pro, local image hosting, SFTP and Telegra.ph. The original built-in imgur image host now also supports account login for uploading.
- Added multiple built-in image hosting platforms, such as WebDav, Lsky Pro, local image hosting, SFTP. The original built-in imgur image host now also supports account login for uploading.
- Within the album, you can synchronize the deletion of cloud images. This is supported across all built-in image hosts and multiple plugins.
- The album now offers advanced search and sorting features, as well as batch URL modification.
- Built-in tools for adding watermarks, compressing images, scaling images, rotating images, and converting image formats are now available. Advanced renaming is also supported.
@ -139,7 +139,6 @@ docker-compose up -d
| Built-in SFTP | ✔️ | ✔️ |
| Doge Cloud | ✔️ | ✔️ |
| PicList(Lasso-Doll) | ✔️ | ✔️ |
| Telegra.ph | ✔️ | × |
| Lsky Pro | ✔️ | ✔️ |
| Custom API platform | × | × |

View File

@ -34,7 +34,7 @@ PicList的内核使用的是原版PicGo-Core基础上修改的[PicList-core](htt
## 特色功能
- 保留了PicGo的所有功能兼容绝大部分已有的PicGo插件包括和Typora、Obsidian等软件的搭配
- 新增了多个内置图床如WebDav、兰空图床、本地图床、SFTP和Telegra.ph原内置imgur图床额外支持登录账号上传
- 新增了多个内置图床如WebDav、兰空图床、本地图床、SFTP等原内置imgur图床额外支持登录账号上传
- 相册中可同步删除云端图片,支持所有内置图床和多个插件
- 相册新增了高级搜索和排序批量修改URL等功能
- 内置水印添加、图片压缩、图片缩放、图片旋转和图片格式转换等功能,同时支持高级重命名
@ -141,7 +141,6 @@ docker-compose up -d
| 内置SFTP | ✔️ | ✔️ |
| 多吉云 | ✔️ | ✔️ |
| PicList(套娃) | ✔️ | ✔️ |
| Telegra.ph | ✔️ | x |
| 兰空图床 | ✔️ | ✔️ |
| 自定义图床 | x | x |

View File

@ -1,9 +1,10 @@
### ✨ Features
- 新增第二图床上传支持
- 现在管理页面支持预览avif图片
- 调整了图床配置页面的日期显示格式
- 优化了第二图床的上传逻辑,现在会使用相同文件名和压缩方式
- 移除了telegra.ph图床官方现已关闭匿名上传功能
- 默认上传快捷键修改为`Ctrl+Alt+U`避免与vscode命令面板冲突
### 🐛 Bug Fixes
- 修复了PicList图床对core版的兼容性问题
- 修复了webdav图床链接拼接错误的问题
- 修复了开启云删除时部分第三方图床图片无法批量删除的问题

View File

@ -1,9 +1,10 @@
### ✨ Features
- Added support for the second image bed upload
- Now the management page supports previewing avif images
- Adjusted the date display format on the image bed configuration page
- Optimize the upload logic of the second image bed, now it will use the same file name and compression method
- Removed telegra.ph image bed (officially closed anonymous upload function)
- The default upload shortcut key is changed to `Ctrl+Alt+U` to avoid conflicts with the vscode command panel
### 🐛 Bug Fixes
- Fixed the compatibility issue of PicList image bed with the core version
- Fixed the problem of incorrect splicing of webdav image bed links
- Fixed the problem that some third-party image bed pictures cannot be deleted in batches when cloud deletion is enabled

View File

@ -1,6 +1,6 @@
{
"name": "piclist",
"version": "2.9.3",
"version": "2.9.4",
"author": {
"name": "Kuingsmile",
"email": "pkukuing@gmail.com"
@ -67,7 +67,7 @@
"multer": "^1.4.5-lts.1",
"node-ssh-no-cpu-features": "^2.0.0",
"nodejs-file-downloader": "^4.12.1",
"piclist": "^1.9.3",
"piclist": "^1.9.6",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1",
"proxy-agent": "^5.0.0",

View File

@ -309,8 +309,16 @@ export function createTray(tooltip: string) {
const pasteStyle = db.get(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN
const rawInput = cloneDeep(files)
const trayWindow = windowManager.get(IWindowList.TRAY_WINDOW)!
await handleSecondaryUpload(trayWindow.webContents, files, 'tray')
const imgs = await uploader.setWebContents(trayWindow.webContents).upload(files)
const { needRestore, ctx } = await handleSecondaryUpload(trayWindow.webContents, files, 'tray')
let imgs: ImgInfo[] | false = false
if (needRestore) {
const res = await uploader
.setWebContents(trayWindow.webContents)
.uploadReturnCtx(ctx ? ctx.processedInput : files, true)
imgs = res ? res.output : false
} else {
imgs = await uploader.setWebContents(trayWindow.webContents).upload(files)
}
const deleteLocalFile = db.get(configPaths.settings.deleteLocalFile) || false
if (imgs !== false) {
const pasteText: string[] = []

View File

@ -15,6 +15,7 @@ import pasteTemplate from '~/utils/pasteTemplate'
import { IPasteStyle, IWindowList } from '#/types/enum'
import { configPaths } from '#/utils/configPaths'
import { changeCurrentUploader } from '~/utils/handleUploaderConfig'
import { IPicGo } from 'piclist'
const handleClipboardUploading = async (): Promise<false | ImgInfo[]> => {
const useBuiltinClipboard =
@ -28,9 +29,27 @@ const handleClipboardUploading = async (): Promise<false | ImgInfo[]> => {
return await uploader.setWebContents(win!.webContents).upload()
}
const handleClipboardUploadingReturnCtx = async (img?: IUploadOption, skipProcess = false): Promise<false | IPicGo> => {
const useBuiltinClipboard =
db.get(configPaths.settings.useBuiltinClipboard) === undefined
? true
: !!db.get(configPaths.settings.useBuiltinClipboard)
const win = windowManager.getAvailableWindow()
if (useBuiltinClipboard) {
return await uploader.setWebContents(win!.webContents).uploadWithBuildInClipboardReturnCtx(img, skipProcess)
}
return await uploader.setWebContents(win!.webContents).uploadReturnCtx(img, skipProcess)
}
export const uploadClipboardFiles = async (): Promise<IStringKeyMap> => {
await handleSecondaryUpload(undefined, undefined, 'clipboard')
const img = await handleClipboardUploading()
const { needRestore, ctx } = await handleSecondaryUpload(undefined, undefined, 'clipboard')
let img: ImgInfo[] | false = false
if (needRestore) {
const res = await handleClipboardUploadingReturnCtx(ctx ? ctx.processedInput : undefined, true)
img = res ? res.output : false
} else {
img = await handleClipboardUploading()
}
if (img !== false) {
if (img.length > 0) {
const trayWindow = windowManager.get(IWindowList.TRAY_WINDOW)
@ -86,8 +105,14 @@ export const uploadChoosedFiles = async (
): Promise<IStringKeyMap[]> => {
const input = files.map(item => item.path)
const rawInput = cloneDeep(input)
await handleSecondaryUpload(webContents, input)
const imgs = await uploader.setWebContents(webContents).upload(input)
const { needRestore, ctx } = await handleSecondaryUpload(webContents, input)
let imgs: ImgInfo[] | false = false
if (needRestore) {
const res = await uploader.setWebContents(webContents).uploadReturnCtx(ctx ? ctx.processedInput : input, true)
imgs = res ? res.output : false
} else {
imgs = await uploader.setWebContents(webContents).upload(input)
}
const result = []
if (imgs !== false) {
const pasteStyle = db.get(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN
@ -140,12 +165,13 @@ export const handleSecondaryUpload = async (
webContents?: WebContents,
input?: string[],
uploadType: 'clipboard' | 'file' | 'tray' = 'file'
): Promise<void> => {
): Promise<{ needRestore: boolean; ctx: IPicGo | false }> => {
const enableSecondUploader = db.get(configPaths.settings.enableSecondUploader) || false
let currentPicBedType = ''
let currentPicBedConfig = {} as IStringKeyMap
let currentPicBedConfigId = ''
let needRestore = false
let ctx: IPicGo | false = false
if (enableSecondUploader) {
const secondUploader = db.get(configPaths.picBed.secondUploader)
const secondUploaderConfig = db.get(configPaths.picBed.secondUploaderConfig)
@ -165,10 +191,11 @@ export const handleSecondaryUpload = async (
let secondImgs: ImgInfo[] | false = false
changeCurrentUploader(secondUploader, secondUploaderConfig, secondUploaderId)
if (uploadType === 'clipboard') {
secondImgs = await handleClipboardUploading()
ctx = await handleClipboardUploadingReturnCtx(undefined)
} else {
secondImgs = await uploader.setWebContents(webContents!).upload(input)
ctx = await uploader.setWebContents(webContents!).uploadReturnCtx(input)
}
secondImgs = ctx ? ctx.output : false
if (secondImgs !== false) {
const trayWindow = windowManager.get(IWindowList.TRAY_WINDOW)
if (uploadType === 'clipboard') {
@ -196,4 +223,8 @@ export const handleSecondaryUpload = async (
if (needRestore) {
changeCurrentUploader(currentPicBedType, currentPicBedConfig, currentPicBedConfigId)
}
return {
needRestore,
ctx
}
}

View File

@ -149,6 +149,69 @@ class Uploader {
}
}
async uploadWithBuildInClipboardReturnCtx(img?: IUploadOption, skipProcess = false): Promise<IPicGo | false> {
let filePath = ''
try {
const imgPath = getClipboardFilePath()
if (!imgPath) {
const nativeImage = clipboard.readImage()
if (nativeImage.isEmpty()) {
return false
}
const buffer = nativeImage.toPNG()
const baseDir = picgo.baseDir
const fileName = `${dayjs().format('YYYYMMDDHHmmSSS')}.png`
filePath = path.join(baseDir, CLIPBOARD_IMAGE_FOLDER, fileName)
await writeFile(filePath, buffer)
return await this.uploadReturnCtx(img ?? [filePath], skipProcess)
} else {
return await this.uploadReturnCtx(img ?? [imgPath], skipProcess)
}
} catch (e: any) {
logger.error(e)
return false
} finally {
if (filePath) {
fs.remove(filePath)
}
}
}
async uploadReturnCtx(img?: IUploadOption, skipProcess = false): Promise<IPicGo | false> {
try {
const startTime = Date.now()
const ctx = await picgo.uploadReturnCtx(img, skipProcess)
if (Array.isArray(ctx.output) && ctx.output.some((item: ImgInfo) => item.imgUrl)) {
if (this.webContents) {
handleTalkingData(this.webContents, {
fromClipboard: !img,
type: db.get(configPaths.picBed.uploader) || db.get(configPaths.picBed.current) || 'smms',
count: img ? img.length : 1,
duration: Date.now() - startTime
} as IAnalyticsData)
}
ctx.output.forEach((item: ImgInfo) => {
item.config = JSON.parse(JSON.stringify(db.get(`picBed.${item.type}`)))
})
return ctx
} else {
return false
}
} catch (e: any) {
logger.error(e)
setTimeout(() => {
showNotification({
title: T('UPLOAD_FAILED'),
body: util.format(e.stack),
clickToCopy: true
})
}, 500)
return false
} finally {
ipcMain.removeAllListeners(GET_RENAME_FILE_NAME)
}
}
async upload(img?: IUploadOption): Promise<ImgInfo[] | false> {
try {
const startTime = Date.now()

View File

@ -35,7 +35,7 @@ class ConfigStore {
if (!this.#db.has(configPaths.settings.shortKey._path)) {
this.#db.set(configPaths.settings.shortKey['picgo:upload'], {
enable: true,
key: 'CommandOrControl+Shift+P',
key: 'CommandOrControl+Alt+P',
name: 'upload',
label: T('QUICK_UPLOAD')
})

View File

@ -79,8 +79,14 @@ class GuiApi implements IGuiApi {
this.windowId = await getWindowId()
const webContents = this.getWebcontentsByWindowId(this.windowId)
const rawInput = cloneDeep(input)
await handleSecondaryUpload(webContents!, input)
const imgs = await uploader.setWebContents(webContents!).upload(input)
const { needRestore, ctx } = await handleSecondaryUpload(webContents!, input)
let imgs: ImgInfo[] | false = false
if (needRestore) {
const res = await uploader.setWebContents(webContents!).uploadReturnCtx(ctx ? ctx.processedInput : input, true)
imgs = res ? res.output : false
} else {
imgs = await uploader.setWebContents(webContents!).upload(input)
}
if (imgs !== false) {
const pasteStyle = db.get(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN
const deleteLocalFile = db.get(configPaths.settings.deleteLocalFile) || false

View File

@ -428,9 +428,7 @@ function handleDetectShiftKey(event: KeyboardEvent) {
}
const filterList = computed(() => {
const start = new Date().getTime()
const res = getGallery()
console.log(`filterList: ${new Date().getTime() - start}ms`)
return res
})
@ -487,9 +485,7 @@ function getGallery(): IGalleryItem[] {
}
async function updateGallery() {
const start = new Date().getTime()
images.value = (await $$db.get({ orderBy: 'desc' }))!.data
console.log(`updateGallery: ${new Date().getTime() - start}ms`)
}
watch(
@ -698,6 +694,9 @@ function multiRemove() {
duration: multiRemoveNumber > 5 ? 1000 : 2000
})
}
} else {
files.push(file)
await $$db.removeById(key)
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,6 @@ export interface IConfigStruct {
webdavplist?: IWebdavPlistConfig
local?: ILocalConfig
sftpplist?: ISftpPlistConfig
telegraphplist?: ITelegraphConfig
lskyplist?: ILskyConfig
'aws-s3-plist': IAwsS3PListUserConfig
proxy?: string

View File

@ -47,7 +47,6 @@ export const picBedManualUrlList: IStringKeyMap = {
qiniu: 'https://piclist.cn/configure.html#%E4%B8%83%E7%89%9B%E4%BA%91',
sftpplist: 'https://piclist.cn/configure.html#%E5%86%85%E7%BD%AEsftp',
smms: 'https://piclist.cn/configure.html#sm-ms',
telegraphplist: 'https://piclist.cn/configure.html#telegra-ph',
upyun: 'https://piclist.cn/configure.html#%E5%8F%88%E6%8B%8D%E4%BA%91',
webdavplist: 'https://piclist.cn/configure.html#webdav'
},
@ -68,7 +67,6 @@ export const picBedManualUrlList: IStringKeyMap = {
qiniu: 'https://piclist.cn/en/configure.html#qiniu-cloud',
sftpplist: 'https://piclist.cn/en/configure.html#built-in-sftp',
smms: 'https://piclist.cn/en/configure.html#sm-ms',
telegraphplist: 'https://piclist.cn/en/configure.html#telegra-ph',
upyun: 'https://piclist.cn/en/configure.html#upyun',
webdavplist: 'https://piclist.cn/en/configure.html#webdav'
}

View File

@ -11956,10 +11956,10 @@ performance-now@^2.1.0:
resolved "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==
piclist@^1.9.3:
version "1.9.3"
resolved "https://registry.yarnpkg.com/piclist/-/piclist-1.9.3.tgz#3aa769237935a70fdb786a46f5ed46b762e38dd9"
integrity sha512-nWorUUyBmDJ6ZtHXHVa1dn4PHiKjION9izdj+xcgGkwgQj4xegKWLsivEgdMEV8e+iuulO6e+n1+pQcqOqqasg==
piclist@^1.9.6:
version "1.9.6"
resolved "https://registry.yarnpkg.com/piclist/-/piclist-1.9.6.tgz#010753f7b7cedc076251bd1639f7859e48508386"
integrity sha512-CAUbU43/eibk/Jq+SXPL96TXog1vNjpE1pwbsof+D8A8SEpXRg+K5cLAsRjGXubi/SmLonU+imtbldUNuCoHjA==
dependencies:
"@aws-sdk/client-s3" "3.421.0"
"@aws-sdk/lib-storage" "3.421.0"