From 3102d7b1ea02226c8e2de95db79e66cb5bf388d6 Mon Sep 17 00:00:00 2001 From: PiEgg Date: Sun, 17 Jul 2022 11:51:46 +0800 Subject: [PATCH] :pencil: Docs: update cos links --- README.md | 2 +- scripts/cos-link.js | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 scripts/cos-link.js diff --git a/README.md b/README.md index c017694..779c5a2 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ PicGo 本体支持如下图床: ## 下载安装 -点击此处下载 [应用](https://github.com/Molunerfinn/PicGo/releases)。 +点击此处下载 [应用](https://github.com/Molunerfinn/PicGo/releases)。从 2.3.1-beta.4 版本开始,在下载页提供 [腾讯云COS](https://cloud.tencent.com/product/cos) 下载链接,供国内用户快速下载使用。感谢 [腾讯云COS](https://cloud.tencent.com/product/cos) 提供的赞助支持! 还可以通过山东大学镜像站提供的镜像地址下载 [应用](https://mirrors.sdu.edu.cn/github-release/Molunerfinn_PicGo)。感谢山东大学镜像站提供的镜像服务! diff --git a/scripts/cos-link.js b/scripts/cos-link.js new file mode 100644 index 0000000..0046765 --- /dev/null +++ b/scripts/cos-link.js @@ -0,0 +1,23 @@ +const pkg = require('../package.json') +const version = pkg.version +// TODO: use the same name format +const generateURL = (platform, ext, prefix = 'PicGo-') => { + return `https://picgo-1251750343.cos.ap-chengdu.myqcloud.com/${prefix}${version}${platform}${ext}` +} + +const platformExtList = [ + ['-arm64', '.dmg', 'PicGo-'], + ['-x64', '.dmg', 'PicGo-'], + ['', '.AppImage', 'PicGo-'], + ['-ia32', '.exe', 'PicGo-Setup-'], + ['-x64', '.exe', 'PicGo-Setup-'], + ['', '.exe', 'PicGo-Setup-'], + ['_amd64', '.snap', 'picgo_'] +] + +const links = platformExtList.map(([arch, ext, prefix]) => { + const markdownLink = `[${prefix}${version}${arch}${ext}](${generateURL(arch, ext, prefix)})` + return markdownLink +}) + +console.log(links.join('\n'))