mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Feat: auth for remote callback / Modify: use map to store hooks in filesystem
This commit is contained in:
26
service/callback/upload.go
Normal file
26
service/callback/upload.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package callback
|
||||
|
||||
import (
|
||||
"github.com/HFO4/cloudreve/pkg/filesystem"
|
||||
"github.com/HFO4/cloudreve/pkg/serializer"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// RemoteUploadCallbackService 远程存储上传回调请求服务
|
||||
type RemoteUploadCallbackService struct {
|
||||
Data serializer.RemoteUploadCallback `json:"data" binding:"required"`
|
||||
}
|
||||
|
||||
// Process 处理远程策略上传结果回调
|
||||
func (service *RemoteUploadCallbackService) Process(c *gin.Context) serializer.Response {
|
||||
// 创建文件系统
|
||||
fs, err := filesystem.NewFileSystemFromContext(c)
|
||||
if err != nil {
|
||||
return serializer.Err(serializer.CodePolicyNotAllowed, err.Error(), err)
|
||||
}
|
||||
defer fs.Recycle()
|
||||
|
||||
return serializer.Response{
|
||||
Code: 0,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user