From 9f4fcd131dbff6b7121f76c343bf184a8515e497 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 15 Oct 2021 18:04:58 +0800 Subject: [PATCH] + image url --- global/vars.go | 2 +- xfs/process.go | 10 +++++++++- xiang/apis/storage.http.json | 11 +++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/global/vars.go b/global/vars.go index 34a659b6..d8314b2f 100644 --- a/global/vars.go +++ b/global/vars.go @@ -9,7 +9,7 @@ import ( ) // VERSION 版本号 -const VERSION = "0.8.4" +const VERSION = "0.8.5" // DOMAIN 许可域 const DOMAIN = "*.iqka.com" diff --git a/xfs/process.go b/xfs/process.go index 5949e291..9a6bad59 100644 --- a/xfs/process.go +++ b/xfs/process.go @@ -119,5 +119,13 @@ func processGetToken(process *gou.Process) interface{} { // processGetURL 返回文件CDN地址 func processGetURL(process *gou.Process) interface{} { - return nil + process.ValidateArgNums(1) + filename := process.ArgsString(0) + // typ := process.ArgsString(1) + // stats, err := Stor.Stat(filename) + // if err != nil { + // exception.New("读取文件信息失败 %s", 500, err.Error()).Throw() + // } + body := Stor.MustReadFile(filename) + return string(body) } diff --git a/xiang/apis/storage.http.json b/xiang/apis/storage.http.json index c1eea7eb..dbfa49ef 100644 --- a/xiang/apis/storage.http.json +++ b/xiang/apis/storage.http.json @@ -27,6 +27,17 @@ "type": "application/json" } }, + { + "path": "/url", + "method": "GET", + "guard": "-", + "process": "xiang.fs.GetURL", + "in": ["$query.name", "$query.type"], + "out": { + "status": 200, + "type": "image/png" + } + }, { "path": "/token", "method": "GET",