diff --git a/src/plugins/uploader/tcyun.ts b/src/plugins/uploader/tcyun.ts index 42dff87..619de2a 100644 --- a/src/plugins/uploader/tcyun.ts +++ b/src/plugins/uploader/tcyun.ts @@ -123,21 +123,22 @@ const handle = async (ctx: IPicGo): Promise => { if (body.statusCode === 400) { throw new Error(body.msg || body.message) } + const optionUrl = tcYunOptions.options || '' if (useV4 && body.message === 'SUCCESS') { delete img.base64Image delete img.buffer if (customUrl) { img.imgUrl = `${customUrl}/${path}${img.fileName}` } else { - img.imgUrl = body.data.source_url + img.imgUrl = `${body.data.source_url as string}${optionUrl}` } } else if (!useV4 && body && body.statusCode === 200) { delete img.base64Image delete img.buffer if (customUrl) { - img.imgUrl = `${customUrl}/${path}${img.fileName}` + img.imgUrl = `${customUrl}/${path}${img.fileName}${optionUrl}` } else { - img.imgUrl = `https://${tcYunOptions.bucket}.cos.${tcYunOptions.area}.myqcloud.com/${path}${img.fileName}` + img.imgUrl = `https://${tcYunOptions.bucket}.cos.${tcYunOptions.area}.myqcloud.com/${path}${img.fileName}${optionUrl}` } } else { throw new Error(res.body.msg) @@ -221,6 +222,12 @@ const config = (ctx: IPicGo): IPluginConfig[] => { choices: ['v4', 'v5'], default: 'v5', required: false + }, + { + name: 'options', + type: 'input', + default: userConfig.options || '', + required: false } ] return config diff --git a/src/types/index.ts b/src/types/index.ts index c0c6b2d..a348882 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -241,6 +241,8 @@ export interface ITcyunConfig { customUrl: string /** COS 版本,v4 或者 v5 */ version: 'v5' | 'v4' + /** 针对图片的一些后缀处理参数 PicGo 2.4.0+ PicGo-Core 1.5.0+ */ + options: string } /** GitHub 图床配置项 */ export interface IGithubConfig {