Merge commit '52990d5fa1c68f446f7be5ad238a973db3686011' into release

This commit is contained in:
Kuingsmile 2023-09-30 21:04:24 +08:00
commit 99bf09120e
11 changed files with 906 additions and 768 deletions

View File

@ -1,3 +1,24 @@
## :tada: 2.6.2 (2023-09-30)
### :sparkles: Features
* optimize filename display in gallery page ([0abfeff](https://github.com/Kuingsmile/piclist/commit/0abfeff))
* update dialog will show change log now ([ef1812a](https://github.com/Kuingsmile/piclist/commit/ef1812a))
### :bug: Bug Fixes
* fix sftp delete error when the user don't have ssh permission ([819dfbb](https://github.com/Kuingsmile/piclist/commit/819dfbb)), closes [#100](https://github.com/Kuingsmile/piclist/issues/100)
* fix type error caused by fast-xml-parser ([0f100e5](https://github.com/Kuingsmile/piclist/commit/0f100e5))
### :pencil: Documentation
* update changelog ([d3ac2c5](https://github.com/Kuingsmile/piclist/commit/d3ac2c5))
## :tada: 2.6.1 (2023-09-13)

11
currentVersion.md Normal file
View File

@ -0,0 +1,11 @@
✨ Features
- 相册页面只显示最后一级文件名,不包含额外的路径
- 现在更新提示窗口会显示更新日志,方便用户查看
🐛 Bug Fixes
- 修复了从Obsidian插件删除图片时webdav图床和SFTP图床无法删除的问题
- 修复了用户无ssh权限时sftp图床无法进行云端删除的问题
- 修复了sftp图床上传时即使出错仍然会判断为上传成功的问题
- 修复了sftp图床上传时会额外创建空文件夹的问题

11
currentVersion_en.md Normal file
View File

@ -0,0 +1,11 @@
✨ Features
- Now the album page only displays the last level file name, without additional path
- Now the update prompt window will display the update log, which is convenient for users to view
🐛 Bug Fixes
- Fixed the problem that webdav and SFTP cannot be deleted when deleting pictures from Obsidian plugin
- Fixed the problem that sftp image bed cannot be deleted in the cloud when the user has no ssh permission
- Fixed the problem that when uploading to sftp image bed, it will still be judged as upload success even if there is an error
- Fixed the problem that when uploading to sftp image bed, an empty folder will be created additionally

View File

@ -1,6 +1,6 @@
{
"name": "piclist",
"version": "2.6.1",
"version": "2.6.2",
"author": {
"name": "Kuingsmile",
"email": "pkukuing@gmail.com"
@ -34,28 +34,27 @@
"lint:dpdm": "dpdm -T --tsconfig ./tsconfig.json --no-tree --no-warning --exit-code circular:1 src/background.ts"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.410.0",
"@aws-sdk/lib-storage": "^3.410.0",
"@aws-sdk/s3-request-presigner": "^3.410.0",
"@aws-sdk/client-s3": "^3.421.0",
"@aws-sdk/lib-storage": "^3.421.0",
"@aws-sdk/s3-request-presigner": "^3.421.0",
"@element-plus/icons-vue": "^2.1.0",
"@highlightjs/vue-plugin": "^2.1.0",
"@nodelib/fs.walk": "^2.0.0",
"@octokit/rest": "^19.0.7",
"@picgo/i18n": "^1.0.0",
"@picgo/store": "^2.1.0",
"@smithy/node-http-handler": "^2.1.3",
"@types/mime-types": "^2.1.1",
"@smithy/node-http-handler": "^2.1.6",
"@videojs-player/vue": "^1.0.0",
"ali-oss": "^6.18.1",
"axios": "^1.5.0",
"axios": "^1.5.1",
"compare-versions": "^4.1.3",
"core-js": "^3.32.2",
"cos-nodejs-sdk-v5": "^2.12.4",
"dexie": "^3.2.4",
"electron-updater": "^6.1.4",
"element-plus": "2.3.12",
"element-plus": "2.3.14",
"epipebomb": "^1.0.0",
"fast-xml-parser": "^4.2.7",
"fast-xml-parser": "^4.3.1",
"form-data": "^4.0.0",
"fs-extra": "^11.1.1",
"got": "^12.6.0",
@ -68,18 +67,19 @@
"mitt": "^3.0.1",
"node-ssh-no-cpu-features": "^1.0.1",
"nodejs-file-downloader": "^4.12.1",
"piclist": "^1.1.1",
"piclist": "^1.1.4",
"pinia": "^2.1.6",
"pinia-plugin-persistedstate": "^3.2.0",
"qiniu": "^7.9.0",
"qrcode.vue": "^3.4.1",
"querystring": "^0.2.1",
"shell-path": "2.1.0",
"ssh2-no-cpu-features": "^1.0.0",
"upyun": "^3.4.6",
"uuid": "^9.0.0",
"video.js": "^8.5.2",
"vue": "^3.3.4",
"vue-router": "^4.2.4",
"vue-router": "^4.2.5",
"vue3-lazyload": "^0.3.8",
"vue3-photo-preview": "^0.3.0",
"webdav": "^5.3.0",
@ -89,36 +89,37 @@
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@electron/notarize": "^2.1.0",
"@picgo/bump-version": "^1.1.2",
"@types/ali-oss": "^6.16.8",
"@types/electron-devtools-installer": "^2.2.2",
"@types/fs-extra": "^11.0.1",
"@types/ali-oss": "^6.16.9",
"@types/electron-devtools-installer": "^2.2.3",
"@types/fs-extra": "^11.0.2",
"@types/inquirer": "^6.5.0",
"@types/js-yaml": "^4.0.5",
"@types/js-yaml": "^4.0.6",
"@types/lowdb": "^1.0.12",
"@types/mime-types": "^2.1.2",
"@types/node": "^16.10.2",
"@types/request-promise-native": "^1.0.18",
"@types/semver": "^7.5.1",
"@types/semver": "^7.5.2",
"@types/tunnel": "^0.0.3",
"@types/upyun": "^3.4.1",
"@types/uuid": "^9.0.3",
"@types/write-file-atomic": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"@vue/cli-plugin-babel": "^5.0.8",
"@vue/cli-plugin-eslint": "^5.0.8",
"@vue/cli-plugin-router": "^5.0.8",
"@vue/cli-plugin-typescript": "^5.0.8",
"@vue/cli-service": "^5.0.8",
"@vue/eslint-config-standard": "^8.0.1",
"@vue/eslint-config-typescript": "^11.0.3",
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/runtime-dom": "^3.3.4",
"conventional-changelog": "^5.1.0",
"cz-customizable": "^7.0.0",
"dotenv": "^16.3.1",
"dpdm": "^3.13.1",
"dpdm": "^3.14.0",
"electron": "^22.0.2",
"electron-devtools-installer": "^3.2.0",
"eslint": "^8.49.0",
"eslint": "^8.50.0",
"eslint-config-standard": ">=16.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-node": "^11.1.0",
@ -126,7 +127,7 @@
"eslint-plugin-vue": "^9.17.0",
"husky": "^3.1.0",
"node-loader": "^2.0.0",
"npm-check-updates": "^16.14.0",
"npm-check-updates": "^16.14.4",
"stylus": "^0.59.0",
"stylus-loader": "^7.1.3",
"typescript": "^4.9.5",

View File

@ -130,13 +130,13 @@ export const uploadChoosedFiles = async (webContents: WebContents, files: IFileW
}
}
async function deleteWebdavFile (config: ISftpPlistConfig, fileName: string) {
async function deleteSFTPFile (config: ISftpPlistConfig, fileName: string) {
try {
const client = SSHClient.instance
await client.connect(config)
const uploadPath = `/${(config.uploadPath || '')}/`.replace(/\/+/g, '/')
const remote = path.join(uploadPath, fileName)
const deleteResult = await client.deleteFile(remote)
const deleteResult = await client.deleteFileSFTP(config, remote)
client.close()
return deleteResult
} catch (err: any) {
@ -161,10 +161,10 @@ export const deleteChoosedFiles = async (list: ImgInfo[]): Promise<boolean[]> =>
})
notification.show()
}
if (item.type === 'webdavplist') {
if (item.type === 'sftpplist') {
const { fileName, config } = item
setTimeout(() => {
deleteWebdavFile(getRawData(config), fileName || '').then(noteFunc)
deleteSFTPFile(getRawData(config), fileName || '').then(noteFunc)
}, 0)
} else {
setTimeout(() => {

View File

@ -174,7 +174,7 @@ export default {
await client.connect(config)
const uploadPath = `/${(config.uploadPath || '')}/`.replace(/\/+/g, '/')
const remote = path.join(uploadPath, fileName)
const deleteResult = await client.deleteFile(remote)
const deleteResult = await client.deleteFileSFTP(config, remote)
client.close()
return deleteResult
} catch (err: any) {

View File

@ -45,6 +45,7 @@ import path from 'path'
import { CLIPBOARD_IMAGE_FOLDER } from '~/universal/utils/static'
import fs from 'fs-extra'
import { startFileServer } from '../fileServer'
import axios from 'axios'
const isDevelopment = process.env.NODE_ENV !== 'production'
const handleStartUpFiles = (argv: string[], cwd: string) => {
@ -71,14 +72,23 @@ autoUpdater.setFeedURL({
autoUpdater.autoDownload = false
autoUpdater.on('update-available', (info: UpdateInfo) => {
autoUpdater.on('update-available', async (info: UpdateInfo) => {
const lang = db.get('settings.language') || 'zh-CN'
let updateLog = ''
try {
const url = lang === 'zh-CN' ? 'https://release.piclist.cn/currentVersion.md' : 'https://release.piclist.cn/currentVersion_en.md'
const res = await axios.get(url)
updateLog = res.data
} catch (e: any) {
logger.error(e)
}
dialog.showMessageBox({
type: 'info',
title: T('FIND_NEW_VERSION'),
buttons: ['Yes', 'No'],
message: T('TIPS_FIND_NEW_VERSION', {
v: info.version
}),
}) + '\n\n' + updateLog,
checkboxLabel: T('NO_MORE_NOTICE'),
checkboxChecked: false
}).then((result) => {

View File

@ -1,6 +1,9 @@
// @ts-nocheck
import { NodeSSH, Config, SSHExecCommandResponse } from 'node-ssh-no-cpu-features'
import path from 'path'
import { ISftpPlistConfig } from 'piclist/dist/types'
import { Client } from 'ssh2-no-cpu-features'
import fs from 'fs-extra'
class SSHClient {
// eslint-disable-next-line no-use-before-define
@ -38,16 +41,35 @@ class SSHClient {
}
}
public async deleteFile (remote: string): Promise<boolean> {
if (!this._isConnected) {
throw new Error('SSH 未连接')
}
public async deleteFileSFTP (config: ISftpPlistConfig, remote: string): Promise<boolean> {
try {
const client = new Client()
const { username, password, privateKey, passphrase } = config
const loginInfo: Config = privateKey
? { username, privateKey: fs.readFileSync(privateKey), passphrase: passphrase || undefined }
: { username, password }
remote = this.changeWinStylePathToUnix(remote)
if (remote === '/' || remote.includes('*')) return false
const script = `rm -f "${remote}"`
return await this.exec(script)
const promise = new Promise((resolve, reject) => {
client.on('ready', () => {
client.sftp((err, sftp) => {
if (err) reject(false)
sftp.unlink(remote, (err) => {
if (err) reject(false)
client.end()
resolve(true)
})
})
}).connect({
host: config.host,
port: Number(config.port) || 22,
...loginInfo
})
}
)
return await promise
} catch (err: any) {
console.log(err)
return false
}
}

View File

@ -944,7 +944,7 @@ export const supportedPicBedList: IStringKeyMap = {
default: '0755'
},
baseDir: {
required: true,
required: false,
description: $T('MANAGE_CONSTANT_SFTP_BASE_DIR_DESC'),
placeholder: $T('MANAGE_CONSTANT_SFTP_BASE_DIR_PLACEHOLDER'),
type: 'string',

View File

@ -262,7 +262,7 @@
class="gallery-list__file-name"
:title="item.fileName"
>
{{ item.fileName }}
{{ formatFileName(item.fileName || '') }}
</div>
<el-row
class="gallery-list__tool-panel"
@ -477,6 +477,7 @@ import ALLApi from '@/apis/allApi'
//
import { customRenameFormatTable, customStrMatch, customStrReplace } from '../manage/utils/common'
import { picBedsCanbeDeleted } from '#/utils/static'
import path from 'path'
const images = ref<ImgInfo[]>([])
const dialogVisible = ref(false)
@ -578,6 +579,10 @@ const isAllSelected = computed(() => {
}
})
function formatFileName (name: string) {
return path.basename(name)
}
function getPicBeds (event: IpcRendererEvent, picBeds: IPicBedType[]) {
picBed.value = picBeds
}

1519
yarn.lock

File diff suppressed because it is too large Load Diff