From f2116e093da4a7bc628717f898cd92bc5ac80ac9 Mon Sep 17 00:00:00 2001 From: sugar Date: Sun, 31 Mar 2024 21:56:19 +0800 Subject: [PATCH] feat: Add support for Upyun cloud service and token generation functionality --- packages/cli/package.json | 1 + packages/client/README.md | 28 ++++++++++++++++--- packages/client/index.html | 2 +- packages/client/src/components/HomeHeader.vue | 2 +- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 8d3d1de..2c181b6 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -9,6 +9,7 @@ "main": "token.js", "scripts": { "generate": "node ./token.js", + "generate:upyun": "node ./upyun-token.js", "generare:copy": "copy=true node ./token.js" }, "dependencies": { diff --git a/packages/client/README.md b/packages/client/README.md index e3182a4..ef2627d 100644 --- a/packages/client/README.md +++ b/packages/client/README.md @@ -1,8 +1,10 @@ -

七牛云OSS图床

+

基于 OSS(对象存储库) 图床

-

基于七牛云对象存储服务搭建的图床应用,前端纯静态,无需后端

+

基于对象存储服务搭建的图床应用,前端纯静态,无需后端

+ +

支持 七牛云 | 又拍云

GitHub Pages Demo | @@ -27,6 +29,7 @@ pnpm preview ``` ### 🚧 Docker启动 +TODO:待构建镜像 ## 配置token ### 生成token @@ -47,16 +50,33 @@ QINIU_SCOPE=default # token有效期,默认一个月,单位秒,你可以自行设置 # QINIU_EXPIRES=2592000 + +# 又拍云相关配置 +UPYUN_OPERATOR=operator +UPYUN_PASSWORD=password +UPYUN_BUCKET=service-name +UPYUN_DOMAIN=http://service-name.test.upcdn.net +UPYUN_PREFIX=image +UPYUN_SCOPE=default +# token有效期,默认一个月,单位秒,你可以自行设置(60*60*24*30) +# UPYUN_EXPIRES=2592000 ``` 最后资源地址为 **`domain/prefix/scope/md5`** -执行生成 token 脚本 +① 七牛云:执行生成 token 脚本 ```sh npm run generate # 或者 node token.js ``` +② 又拍云:执行生成 token 脚本 +```sh +npm run generate:upyun +# 或者 +node upyun-token.js +``` + ![token-snippet](./token.png) ### 配置项目默认 @@ -64,7 +84,7 @@ node token.js 在 [packages/client](./../client/) 下创建`.env.local` ```sh -VITE_APP_QINIU_TOKEN=你的token +VITE_APP_UPLOAD_TOKEN=你的token ``` 启动构建项目即可 diff --git a/packages/client/index.html b/packages/client/index.html index 79240bd..07e802a 100644 --- a/packages/client/index.html +++ b/packages/client/index.html @@ -5,7 +5,7 @@ - 七牛云OSS图床 | 粥里有勺糖 + 纯静态 OSS 图床 | 粥里有勺糖 diff --git a/packages/client/src/components/HomeHeader.vue b/packages/client/src/components/HomeHeader.vue index 4be02c7..d20c27b 100644 --- a/packages/client/src/components/HomeHeader.vue +++ b/packages/client/src/components/HomeHeader.vue @@ -8,7 +8,7 @@ import { ElAlert, ElLink } from 'element-plus';

- 七牛云 OSS 图床 + 纯静态 OSS 图床