Skip to content

Commit

Permalink
+ image url
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Oct 15, 2021
1 parent 285c73b commit 9f4fcd1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion global/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

// VERSION 版本号
const VERSION = "0.8.4"
const VERSION = "0.8.5"

// DOMAIN 许可域
const DOMAIN = "*.iqka.com"
Expand Down
10 changes: 9 additions & 1 deletion xfs/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
11 changes: 11 additions & 0 deletions xiang/apis/storage.http.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 9f4fcd1

Please sign in to comment.