Merge branch 'dev' into release

This commit is contained in:
Kuingsmile 2024-05-13 15:36:53 +08:00
commit 65ec580664
8 changed files with 116 additions and 84 deletions

View File

@ -1,3 +1,19 @@
## :tada: 2.8.5 (2024-05-13)
### :sparkles: Features
* **custom:** add support for oss-cn-wuhan ([0153991](https://github.com/Kuingsmile/piclist/commit/0153991))
* **custom:** optimize aws s3 and buildin rename ([9ca0e4b](https://github.com/Kuingsmile/piclist/commit/9ca0e4b))
* **custom:** optimize upload api ([e4c4a6f](https://github.com/Kuingsmile/piclist/commit/e4c4a6f))
### :pencil: Documentation
* **custom:** prepare for v2.8.5 ([3d3b80f](https://github.com/Kuingsmile/piclist/commit/3d3b80f))
## :tada: 2.8.4 (2024-04-28)

View File

@ -1,15 +1,14 @@
### ✨ Features
- 管理功能
- 现在修改自定义域名后会自动强制刷新当前页面
- 现在第一次进入管理页面时默认获取云端最新文件列表
- 现在内置s3图床默认允许自签证书
- 现在高级重命名中的时间戳精确到毫秒
- 现在`upload`接口只传递`picbed`参数时,使用对应图床的默认配置,而不是`Default`配置
- 优化了对smms图床的备用域名的处理逻辑
- 内置aws S3图床现在设置权限时使用下拉选择框同时`disableBucketPrefixToURL`现在修改为布尔类型
- 高级重命名现在支持`{str-number}`格式其中number为任意数字新增`{ms}`(毫秒)的支持
- 管理功能中,上传自定义重命名新增对`{h}`(小时)`{i}`(分钟)`{s}`(秒),,同时`{timestamp}`修改为毫秒,新增对`{str-number}`的支持
- 管理功能中,阿里云图床新增对创建`oss-cn-wuhan(华南1-武汉)`地域存储桶的支持
- 优化了重命名占位符说明页面的排版
- Docker版本PicList-core现在修改时区为东八区
### 🐛 Bug Fixes
- 管理功能
- 修复了强制https对本地图床没有生效的问题
- 修复了不填写区域时minio无法正常删除图片的问题
- 修复了内置s3图床配合minio使用时会额外添加桶名的问题
- 修正了高级重命名中时间戳的说明,由秒修改为毫秒

View File

@ -1,14 +1,14 @@
### ✨ Features
- Manage
- Now, after modifying the custom domain name, the current page will be automatically forced to refresh
- Now, the cloud-side latest file list is obtained by default when entering the management page for the first time
- Now the built-in s3 image bed defaults to allowing self-signed certificates
- Now the timestamp in advanced renaming is accurate to milliseconds
- Now when the `upload` interface only passes the `picbed` parameter, the default configuration of the corresponding image bed is used instead of the `Default` configuration
- Optimized the processing logic of the backup domain name of the smms image bed
- The built-in aws S3 image bed now uses a drop-down box when setting permissions, and `disableBucketPrefixToURL` is now modified to a boolean type
- Advanced renaming now supports the `{str-number}` format, where number is any number, and adds support for `{ms}` (milliseconds)
- In the management function, the upload custom renaming adds support for `{h}` (hour), `{i}` (minute), `{s}` (second), and `{timestamp}` is modified to milliseconds, and adds support for `{str-number}`
- In the management function, the Alibaba Cloud image bed adds support for creating `oss-cn-wuhan (South China 1-Wuhan)` regional storage buckets
- Optimized the layout of the placeholder description page for renaming
- The Docker version of PicList-core now changes the time zone to East Eight District
### 🐛 Bug Fixes
- Manage
- Fixed the problem that forcing https does not take effect on the local image bed
- Fixed the problem that Minio cannot delete images normally when the region is not filled in
- Fixed the problem that the built-in s3 image bed will add an additional bucket name when used with Minio
- Fixed the description of the timestamp in advanced renaming, changed from seconds to milliseconds

View File

@ -1,6 +1,6 @@
{
"name": "piclist",
"version": "2.8.4",
"version": "2.8.5",
"author": {
"name": "Kuingsmile",
"email": "pkukuing@gmail.com"
@ -68,7 +68,7 @@
"multer": "^1.4.5-lts.1",
"node-ssh-no-cpu-features": "^1.0.1",
"nodejs-file-downloader": "^4.12.1",
"piclist": "^1.8.7",
"piclist": "^1.8.8",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.0",
"proxy-agent": "^5.0.0",

View File

@ -3,6 +3,7 @@ const AliyunAreaCodeName : IStringKeyMap = {
'oss-cn-shanghai': '华东2(上海)',
'oss-cn-nanjing': '华东5(南京)',
'oss-cn-fuzhou': '华东6(福州)',
'oss-cn-wuhan': '华中1(武汉)',
'oss-cn-qingdao': '华北1(青岛)',
'oss-cn-beijing': '华北2(北京)',
'oss-cn-zhangjiakou': '华北3(张家口)',

View File

@ -46,6 +46,7 @@ router.post('/upload', async ({
urlparams?: URLSearchParams
}): Promise<void> => {
try {
const picbed = urlparams?.get('picbed')
const passedKey = urlparams?.get('key')
const serverKey = picgo.getConfig<string>(configPaths.settings.serverKey) || ''
if (serverKey && passedKey !== serverKey) {
@ -58,17 +59,16 @@ router.post('/upload', async ({
})
return
}
const picbed = urlparams?.get('picbed')
let currentPicBedType = ''
let currentPicBedConfig = {} as IStringKeyMap
let currentPicBedConfigId = ''
let needRestore = false
if (picbed) {
const configName = urlparams?.get('configName') || 'Default'
const currentPicBed = picgo.getConfig<IStringKeyMap>('picBed') || {} as IStringKeyMap
currentPicBedType = currentPicBed?.current
currentPicBedConfig = currentPicBed?.[currentPicBedType]
currentPicBedConfigId = currentPicBedConfig?._id
currentPicBedType = currentPicBed.current || ''
currentPicBedConfig = currentPicBed[currentPicBedType] || {} as IStringKeyMap
currentPicBedConfigId = currentPicBedConfig._id
const configName = urlparams?.get('configName') || currentPicBed[picbed]?._configName
if (picbed === currentPicBedType && configName === currentPicBedConfig._configName) {
// do nothing
} else {
@ -190,9 +190,9 @@ router.post('/delete', async ({
return
}
try {
const aesHelper = new AESHelper()
const treatList = list.map(item => {
if (!item.isEncrypted) return item
const aesHelper = new AESHelper()
return JSON.parse(aesHelper.decrypt(item.EncryptedData))
})
const result = await deleteChoosedFiles(treatList)

View File

@ -46,21 +46,29 @@ export function renameFileNameWithCustomString (oldName: string, customFormat: s
'{y}': () => year.slice(2),
'{m}': () => renameFormatHelper(date.getMonth() + 1),
'{d}': () => renameFormatHelper(date.getDate()),
'{h}': () => renameFormatHelper(date.getHours()),
'{i}': () => renameFormatHelper(date.getMinutes()),
'{s}': () => renameFormatHelper(date.getSeconds()),
'{ms}': () => date.getMilliseconds().toString().padStart(3, '0'),
'{md5}': () => getMd5(fileBaseName),
'{md5-16}': () => getMd5(fileBaseName).slice(0, 16),
'{str-10}': () => randomStringGenerator(10),
'{str-20}': () => randomStringGenerator(20),
'{filename}': () => affixFileName ? path.basename(affixFileName, path.extname(affixFileName)) : path.basename(oldName, path.extname(oldName)),
'{uuid}': () => uuidv4().replace(/-/g, ''),
'{timestamp}': () => Math.floor(Date.now() / 1000).toString()
'{timestamp}': () => date.getTime().toString()
}
if (customFormat === undefined || !Object.keys(conversionMap).some(item => customFormat.includes(item))) {
if (customFormat === undefined || (!Object.keys(conversionMap).some(item => customFormat.includes(item)) && !customFormat.includes('{str-'))) {
return oldName
}
const ext = path.extname(oldName)
return Object.keys(conversionMap).reduce((acc, cur) => {
let newName = Object.keys(conversionMap).reduce((acc, cur) => {
return acc.replace(new RegExp(cur, 'g'), conversionMap[cur]())
}, customFormat) + ext
const strRegex = /{str-(\d+)}/gi
newName = newName.replace(strRegex, (_, group1) => {
const length = parseInt(group1, 10)
return randomStringGenerator(length)
})
return newName
}
export function renameFile ({ timestampRename, randomStringRename, customRename, customRenameFormat }: IStringKeyMap, oldName = ''): string {
@ -205,43 +213,6 @@ export function customStrReplace (str: string, pattern: string, replacement: str
}
export const customRenameFormatTable = [
{
placeholder: '{Y}',
description: '年份4位数',
placeholderB: '{y}',
descriptionB: '年份2位数'
},
{
placeholder: '{m}',
description: '月份(01-12)',
placeholderB: '{d}',
descriptionB: '日期(01-31)'
},
{
placeholder: '{timestamp}',
description: '时间戳(秒)',
placeholderB: '{uuid}',
descriptionB: 'uuid字符串'
},
{
placeholder: '{md5}',
description: 'md5',
placeholderB: '{md5-16}',
descriptionB: 'md5前16位'
},
{
placeholder: '{str-10}',
description: '10位随机字符串',
placeholderB: '{str-20}',
descriptionB: '20位随机字符串'
},
{
placeholder: '{filename}',
description: '原文件名'
}
]
export const buildInRenameFormatTable = [
{
placeholder: '{Y}',
description: '年份4位数',
@ -263,12 +234,12 @@ export const buildInRenameFormatTable = [
{
placeholder: '{s}',
description: '秒(00-59)',
placeholderB: '{localFolder:<number>}',
descriptionB: '本地文件夹层级'
placeholderB: '{ms}',
descriptionB: '毫秒(000-999)'
},
{
placeholder: '{timestamp}',
description: '时间戳(秒)',
description: '时间戳(秒)',
placeholderB: '{uuid}',
descriptionB: 'uuid字符串'
},
@ -279,13 +250,58 @@ export const buildInRenameFormatTable = [
descriptionB: 'md5前16位'
},
{
placeholder: '{str-10}',
description: '10位随机字符串',
placeholderB: '{str-20}',
descriptionB: '20位随机字符串'
},
{
placeholder: '{filename}',
description: '原文件名'
placeholder: '{str-number}',
description: 'number位随机字符串',
placeholderB: '{filename}',
descriptionB: '原文件名'
}
]
export const buildInRenameFormatTable = [
{
placeholder: '{Y}',
description: '年份4位数',
placeholderB: '{timestamp}',
descriptionB: '时间戳(毫秒)'
},
{
placeholder: '{y}',
description: '年份2位数',
placeholderB: '{md5}',
descriptionB: 'md5'
},
{
placeholder: '{m}',
description: '月份(01-12)',
placeholderB: '{md5-16}',
descriptionB: 'md5前16位'
},
{
placeholder: '{d}',
description: '日期(01-31)',
placeholderB: '{localFolder:<number>}',
descriptionB: '本地文件夹层级'
},
{
placeholder: '{h}',
description: '小时(00-23)',
placeholderB: '{uuid}',
descriptionB: 'uuid字符串'
},
{
placeholder: '{i}',
description: '分钟(00-59)',
placeholderB: '{filename}',
descriptionB: '原文件名'
},
{
placeholder: '{s}',
description: '秒(00-59)',
placeholderB: '{str-number}',
descriptionB: 'number位随机字符串'
},
{
placeholder: '{ms}',
description: '毫秒(000-999)'
}
]

View File

@ -12397,10 +12397,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.8.7:
version "1.8.7"
resolved "https://registry.yarnpkg.com/piclist/-/piclist-1.8.7.tgz#aa40af42762b857ac0c45a097421278a301320cf"
integrity sha512-asSc588Fh1aMpIq/guqqHGhZb0wsLn+wZllKbtznDasbh4zNZvQECNDxRGVtmvsSYJlR+V+yyA2Z85AW/aQqyA==
piclist@^1.8.8:
version "1.8.8"
resolved "https://registry.yarnpkg.com/piclist/-/piclist-1.8.8.tgz#a4b3b4bcdd88f48de5469497e140187ea6e46ab7"
integrity sha512-2sucOVbqVNukb0FZ4ne+DG6bzAJIxZJgm1HlOHKk/NOKYvbcXLsHq0whtEsbfwnsFmkF5T9uJtXHwZPE86JoQA==
dependencies:
"@aws-sdk/client-s3" "3.421.0"
"@aws-sdk/lib-storage" "3.421.0"