mirror of
https://gitee.com/sjqzhang/go-fastdfs.git
synced 2024-12-01 18:57:58 +08:00
change tusd import path
This commit is contained in:
parent
98c04ba8a5
commit
9c3d468bbe
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,4 +3,5 @@ vendor/*
|
||||
data/*
|
||||
files/*
|
||||
conf/*
|
||||
build/*
|
||||
build/*
|
||||
log/*
|
@ -82,8 +82,8 @@ import (
|
||||
"github.com/deckarep/golang-set"
|
||||
"github.com/json-iterator/go"
|
||||
log "github.com/sjqzhang/seelog"
|
||||
"github.com/sjqzhang/tusd"
|
||||
"github.com/sjqzhang/tusd/filestore"
|
||||
"github.com/tus/tusd"
|
||||
"github.com/tus/tusd/filestore"
|
||||
"github.com/syndtr/goleveldb/leveldb"
|
||||
_ "github.com/eventials/go-tus"
|
||||
"io"
|
||||
|
2
go.mod
2
go.mod
@ -5,6 +5,7 @@ go 1.16
|
||||
require (
|
||||
github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 // indirect
|
||||
github.com/astaxie/beego v1.12.3
|
||||
github.com/busyfree/tusd v1.6.1
|
||||
github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 // indirect
|
||||
github.com/deckarep/golang-set v1.7.1
|
||||
github.com/eventials/go-tus v0.0.0-20200718001131-45c7ec8f5d59
|
||||
@ -16,7 +17,6 @@ require (
|
||||
github.com/sjqzhang/googleAuthenticator v0.0.0-20160926062737-f198f070e0b1
|
||||
github.com/sjqzhang/goutil v0.0.0-20200618044433-2319148e0a46
|
||||
github.com/sjqzhang/seelog v0.0.0-20180104061743-556439109558
|
||||
github.com/sjqzhang/tusd v0.0.0-20190220031306-a6a9d78ef54a
|
||||
github.com/spf13/cobra v1.1.3
|
||||
github.com/syndtr/goleveldb v1.0.0
|
||||
go.uber.org/automaxprocs v1.4.0
|
||||
|
26
go.sum
26
go.sum
@ -40,6 +40,8 @@ github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJm
|
||||
github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40 h1:y4B3+GPxKlrigF1ha5FFErxK+sr6sWxQovRMzwMhejo=
|
||||
github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c=
|
||||
github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60=
|
||||
github.com/busyfree/tusd v1.6.1 h1:qtnNohJliPt+YQUE9l3lBFAhPNsZPbh4A/50PUAWjSg=
|
||||
github.com/busyfree/tusd v1.6.1/go.mod h1:ZGmCauEOXuMt8no1T4qUhOJrDbrrm3yDoUODJvoPcaI=
|
||||
github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||
@ -48,6 +50,7 @@ github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 h1:kHaBemcxl8o/pQ5VM1
|
||||
github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575/go.mod h1:9d6lWj8KzO/fd/NrVaLscBKmPigpZpn5YawRPw+e3Yo=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
|
||||
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
@ -59,6 +62,7 @@ github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFl
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ=
|
||||
github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ=
|
||||
@ -68,6 +72,7 @@ github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt
|
||||
github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI=
|
||||
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/eventials/go-tus v0.0.0-20200718001131-45c7ec8f5d59 h1:t2+zxJPT/jq/YOx/JRsoByAZI/GHOxYJ7MKeillEX4U=
|
||||
github.com/eventials/go-tus v0.0.0-20200718001131-45c7ec8f5d59/go.mod h1:XYuK1S5+kS6FGhlIUFuZFPvWiSrOIoLk6+ro33Xce3Y=
|
||||
@ -91,10 +96,13 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU
|
||||
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s=
|
||||
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
@ -146,6 +154,7 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO
|
||||
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
|
||||
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
|
||||
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
@ -164,6 +173,7 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ=
|
||||
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
@ -191,12 +201,15 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW
|
||||
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU=
|
||||
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
@ -206,6 +219,7 @@ github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHu
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
@ -248,8 +262,6 @@ github.com/sjqzhang/goutil v0.0.0-20200618044433-2319148e0a46 h1:7rauZIvQ9NfSyME
|
||||
github.com/sjqzhang/goutil v0.0.0-20200618044433-2319148e0a46/go.mod h1:CL/oZ05rD741LFJm3VooVjCq7SAbVnSuFI0fksqXPbA=
|
||||
github.com/sjqzhang/seelog v0.0.0-20180104061743-556439109558 h1:oE5F3kOhYrM1AU+cjACP5x3DPSuJP2FPm1L+gXyal5U=
|
||||
github.com/sjqzhang/seelog v0.0.0-20180104061743-556439109558/go.mod h1:3nknfvbQruunNuiPtbvtiSHbth0cQvsgLT8sz/O7Kec=
|
||||
github.com/sjqzhang/tusd v0.0.0-20190220031306-a6a9d78ef54a h1:4F8rVrPqtfnFpfpvwMnp5BNnqtgtSUNn5caEx2lXmdY=
|
||||
github.com/sjqzhang/tusd v0.0.0-20190220031306-a6a9d78ef54a/go.mod h1:5ijY0siiVs/FlzH0VQegsYWs1el3AFBrCQb4TSdUQRU=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||
@ -269,6 +281,7 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||
github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
|
||||
@ -276,6 +289,7 @@ github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2K
|
||||
github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
|
||||
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/tus/tusd v1.1.0 h1:y2oBFGeOyqlGgyqD0CloH8FuBrjDk0Tq1IQWvAZnyG8=
|
||||
github.com/tus/tusd v1.1.0/go.mod h1:3DWPOdeCnjBwKtv98y5dSws3itPqfce5TVa0s59LRiA=
|
||||
github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
|
||||
github.com/vimeo/go-util v1.2.0/go.mod h1:s13SMDTSO7AjH1nbgp707mfN5JFIWUFDU5MDDuRRtKs=
|
||||
@ -329,6 +343,7 @@ golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn
|
||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
@ -361,6 +376,7 @@ golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 h1:ogLJMz+qpzav7lGMh10LMvAkM
|
||||
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
@ -409,32 +425,34 @@ google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiq
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
gopkg.in/Acconut/lockfile.v1 v1.1.0 h1:c5AMZOxgM1y+Zl8eSbaCENzVYp/LCaWosbQSXzb3FVI=
|
||||
gopkg.in/Acconut/lockfile.v1 v1.1.0/go.mod h1:6UCz3wJ8tSFUsPR6uP/j8uegEtDuEEqFxlpi0JI4Umw=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/h2non/gock.v1 v1.0.14/go.mod h1:sX4zAkdYX1TRGJ2JY156cFspQn4yRWn6p9EMdODlynE=
|
||||
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
|
||||
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
|
@ -1,15 +0,0 @@
|
||||
2021-05-15 15:40:55 [INF] [fileserver.go:4365] [main.HttpHandler.ServeHTTP.func1] [Access] 2021/05/15 - 15:40:55 | 14.551974ms | 127.0.0.1 | GET | 200 |/
|
||||
2021-05-15 15:40:56 [INF] [fileserver.go:4365] [main.HttpHandler.ServeHTTP.func1] [Access] 2021/05/15 - 15:40:56 | 82.779µs | 127.0.0.1 | GET | 200 |/static/uppy.min.css
|
||||
2021-05-15 15:40:56 [INF] [fileserver.go:4365] [main.HttpHandler.ServeHTTP.func1] [Access] 2021/05/15 - 15:40:56 | 26.99µs | 127.0.0.1 | GET | 200 |/static/uppy.min.js
|
||||
2021-05-15 15:40:56 [INF] [fileserver.go:4365] [main.HttpHandler.ServeHTTP.func1] [Access] 2021/05/15 - 15:40:56 | 36.222µs | 127.0.0.1 | GET | 200 |/favicon.ico
|
||||
2021-05-15 15:41:07 [INF] [fileserver.go:4365] [main.HttpHandler.ServeHTTP.func1] [Access] 2021/05/15 - 15:41:07 | 1.985171ms | 127.0.0.1 | POST | 200 |/group1/upload
|
||||
2021-05-17 12:09:16 [INF] [handler.go:27] [github.com/sjqzhang/go-fastdfs/server.HttpHandler.ServeHTTP.func1] [Access] 2021/05/17 - 12:09:16 | 60.025236ms | [ | GET | 200 |/
|
||||
2021-05-17 12:09:16 [INF] [handler.go:27] [github.com/sjqzhang/go-fastdfs/server.HttpHandler.ServeHTTP.func1] [Access] 2021/05/17 - 12:09:16 | 96.676µs | [ | GET | 200 |/static/uppy.min.css
|
||||
2021-05-17 12:09:16 [INF] [handler.go:27] [github.com/sjqzhang/go-fastdfs/server.HttpHandler.ServeHTTP.func1] [Access] 2021/05/17 - 12:09:16 | 15.657µs | [ | GET | 200 |/static/uppy.min.js
|
||||
2021-05-17 12:09:16 [INF] [handler.go:27] [github.com/sjqzhang/go-fastdfs/server.HttpHandler.ServeHTTP.func1] [Access] 2021/05/17 - 12:09:16 | 37.742µs | [ | GET | 200 |/favicon.ico
|
||||
2021-05-17 12:09:18 [INF] [handler.go:27] [github.com/sjqzhang/go-fastdfs/server.HttpHandler.ServeHTTP.func1] [Access] 2021/05/17 - 12:09:18 | 178.309µs | [ | GET | 200 |/
|
||||
2021-05-17 12:09:18 [INF] [handler.go:27] [github.com/sjqzhang/go-fastdfs/server.HttpHandler.ServeHTTP.func1] [Access] 2021/05/17 - 12:09:18 | 24.71µs | [ | GET | 200 |/static/uppy.min.js
|
||||
2021-05-17 12:09:18 [INF] [handler.go:27] [github.com/sjqzhang/go-fastdfs/server.HttpHandler.ServeHTTP.func1] [Access] 2021/05/17 - 12:09:18 | 11.541µs | [ | GET | 200 |/static/uppy.min.css
|
||||
2021-05-17 12:09:18 [INF] [handler.go:27] [github.com/sjqzhang/go-fastdfs/server.HttpHandler.ServeHTTP.func1] [Access] 2021/05/17 - 12:09:18 | 224.844µs | [ | GET | 200 |/
|
||||
2021-05-17 12:09:18 [INF] [handler.go:27] [github.com/sjqzhang/go-fastdfs/server.HttpHandler.ServeHTTP.func1] [Access] 2021/05/17 - 12:09:18 | 25.581µs | [ | GET | 200 |/static/uppy.min.css
|
||||
2021-05-17 12:09:18 [INF] [handler.go:27] [github.com/sjqzhang/go-fastdfs/server.HttpHandler.ServeHTTP.func1] [Access] 2021/05/17 - 12:09:18 | 20.227µs | [ | GET | 200 |/static/uppy.min.js
|
@ -1,13 +0,0 @@
|
||||
2021-05-15 15:40:40 [INF] [fileserver.go:3884] [main.init.0] succes init log access
|
||||
2021-05-15 15:40:40 [INF] [fileserver.go:431] [main.ParseConfig] {:8080 [http://10.0.0.20:8080] false group1 false true [] 1800 true true [] [] default {abc@163.com abc smtp.163.com:25} false 600 0 true http://10.0.0.20:8080 md5 4 true [127.0.0.1] false false true false true false false true true 0 false false false 0 0 0 0 0 0 0 0 0 0 2000 1000}
|
||||
2021-05-15 15:40:40 [INF] [fileserver.go:433] [main.ParseConfig] config parse success
|
||||
2021-05-15 15:41:07 [INF] [file.go:320] [os.Create] upload: files/default/20210515/15/41/4/basicprofile.jpeg
|
||||
2021-05-17 12:09:05 [INF] [server.go:114] [github.com/sjqzhang/go-fastdfs/server.InitServer] succes init log access
|
||||
2021-05-17 12:09:05 [INF] [config.go:250] [github.com/sjqzhang/go-fastdfs/server.ParseConfig] {:8080 [http://10.0.0.20:8080] false group1 false true [] 1800 true true [] [] default {abc@163.com abc smtp.163.com:25} false 600 0 true http://10.0.0.20:8080 md5 4 true [127.0.0.1] false false true false true false false true true 0 false false false 0 0 0 0 0 0 0 0 0 0 2000 1000}
|
||||
2021-05-17 12:09:05 [INF] [config.go:252] [github.com/sjqzhang/go-fastdfs/server.ParseConfig] config parse success
|
||||
2021-05-17 12:55:58 [INF] [server.go:107] [github.com/sjqzhang/go-fastdfs/server.InitServer] succes init log access
|
||||
2021-05-17 12:55:58 [INF] [config.go:250] [github.com/sjqzhang/go-fastdfs/server.ParseConfig] {:8080 [http://10.0.0.20:8080] false group1 false true [] 1800 true true [] [] default {abc@163.com abc smtp.163.com:25} false 600 0 true http://10.0.0.20:8080 md5 4 true [127.0.0.1] false false true false true false false true true 0 false false false 0 0 0 0 0 0 0 0 0 0 2000 1000}
|
||||
2021-05-17 12:55:58 [INF] [config.go:252] [github.com/sjqzhang/go-fastdfs/server.ParseConfig] config parse success
|
||||
2021-05-17 12:59:06 [INF] [server.go:103] [github.com/sjqzhang/go-fastdfs/server.InitServer] succes init log access
|
||||
2021-05-17 12:59:06 [INF] [config.go:250] [github.com/sjqzhang/go-fastdfs/server.ParseConfig] {:8080 [http://10.0.0.20:8080] false group1 false true [] 1800 true true [] [] default {abc@163.com abc smtp.163.com:25} false 600 0 true http://10.0.0.20:8080 md5 4 true [127.0.0.1] false false true false true false false true true 0 false false false 0 0 0 0 0 0 0 0 0 0 2000 1000}
|
||||
2021-05-17 12:59:06 [INF] [config.go:252] [github.com/sjqzhang/go-fastdfs/server.ParseConfig] config parse success
|
@ -2,14 +2,15 @@ package server
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/astaxie/beego/httplib"
|
||||
log "github.com/sjqzhang/seelog"
|
||||
"github.com/syndtr/goleveldb/leveldb/util"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/httplib"
|
||||
log "github.com/sjqzhang/seelog"
|
||||
"github.com/syndtr/goleveldb/leveldb/util"
|
||||
)
|
||||
|
||||
func (c *Server) RemoveDownloading() {
|
||||
|
@ -16,9 +16,9 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/httplib"
|
||||
"github.com/busyfree/tusd/pkg/filestore"
|
||||
"github.com/busyfree/tusd/pkg/handler"
|
||||
log "github.com/sjqzhang/seelog"
|
||||
"github.com/sjqzhang/tusd"
|
||||
"github.com/sjqzhang/tusd/filestore"
|
||||
)
|
||||
|
||||
func (c *Server) initTus() {
|
||||
@ -58,7 +58,7 @@ func (c *Server) initTus() {
|
||||
if Config().SupportGroupManage {
|
||||
bigDir = fmt.Sprintf("/%s%s", Config().Group, CONST_BIG_UPLOAD_PATH_SUFFIX)
|
||||
}
|
||||
composer := tusd.NewStoreComposer()
|
||||
composer := handler.NewStoreComposer()
|
||||
// support raw tus upload and download
|
||||
store.GetReaderExt = func(id string) (io.Reader, error) {
|
||||
var (
|
||||
@ -111,24 +111,24 @@ func (c *Server) initTus() {
|
||||
}
|
||||
}
|
||||
store.UseIn(composer)
|
||||
SetupPreHooks := func(composer *tusd.StoreComposer) {
|
||||
SetupPreHooks := func(composer *handler.StoreComposer) {
|
||||
composer.UseCore(hookDataStore{
|
||||
DataStore: composer.Core,
|
||||
})
|
||||
}
|
||||
SetupPreHooks(composer)
|
||||
handler, err := tusd.NewHandler(tusd.Config{
|
||||
h, err := handler.NewHandler(handler.Config{
|
||||
Logger: l,
|
||||
BasePath: bigDir,
|
||||
StoreComposer: composer,
|
||||
NotifyCompleteUploads: true,
|
||||
RespectForwardedHeaders: true,
|
||||
})
|
||||
notify := func(handler *tusd.Handler) {
|
||||
notify := func(h *handler.Handler) {
|
||||
for {
|
||||
select {
|
||||
case info := <-handler.CompleteUploads:
|
||||
callBack := func(info tusd.FileInfo, fileInfo *FileInfo) {
|
||||
case info := <-h.CompleteUploads:
|
||||
callBack := func(info handler.FileInfo, fileInfo *FileInfo) {
|
||||
if callback_url, ok := info.MetaData["callback_url"]; ok {
|
||||
req := httplib.Post(callback_url)
|
||||
req.SetTimeout(time.Second*10, time.Second*10)
|
||||
@ -143,19 +143,19 @@ func (c *Server) initTus() {
|
||||
name := ""
|
||||
pathCustom := ""
|
||||
scene := Config().DefaultScene
|
||||
if v, ok := info.MetaData["filename"]; ok {
|
||||
if v, ok := info.Upload.MetaData["filename"]; ok {
|
||||
name = v
|
||||
}
|
||||
if v, ok := info.MetaData["scene"]; ok {
|
||||
if v, ok := info.Upload.MetaData["scene"]; ok {
|
||||
scene = v
|
||||
}
|
||||
if v, ok := info.MetaData["path"]; ok {
|
||||
if v, ok := info.Upload.MetaData["path"]; ok {
|
||||
pathCustom = v
|
||||
}
|
||||
var err error
|
||||
md5sum := ""
|
||||
oldFullPath := BIG_DIR + "/" + info.ID + ".bin"
|
||||
infoFullPath := BIG_DIR + "/" + info.ID + ".info"
|
||||
oldFullPath := BIG_DIR + "/" + info.Upload.ID + ".bin"
|
||||
infoFullPath := BIG_DIR + "/" + info.Upload.ID + ".info"
|
||||
if md5sum, err = c.util.GetFileSumByName(oldFullPath, Config().FileSumArithmetic); err != nil {
|
||||
log.Error(err)
|
||||
continue
|
||||
@ -184,7 +184,7 @@ func (c *Server) initTus() {
|
||||
if fi.Md5 != "" && c.util.FileExists(tpath) {
|
||||
var err error
|
||||
var fileInfo *FileInfo
|
||||
if fileInfo, err = c.SaveFileInfoToLevelDB(info.ID, fi, c.ldb); err != nil {
|
||||
if fileInfo, err = c.SaveFileInfoToLevelDB(info.Upload.ID, fi, c.ldb); err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
log.Info(fmt.Sprintf("file is found md5:%s", fi.Md5))
|
||||
@ -192,7 +192,7 @@ func (c *Server) initTus() {
|
||||
log.Info("remove file:", infoFullPath)
|
||||
os.Remove(oldFullPath)
|
||||
os.Remove(infoFullPath)
|
||||
go callBack(info, fileInfo)
|
||||
go callBack(info.Upload, fileInfo)
|
||||
continue
|
||||
}
|
||||
}
|
||||
@ -208,7 +208,7 @@ func (c *Server) initTus() {
|
||||
Name: name,
|
||||
Path: fpath2,
|
||||
ReName: filename,
|
||||
Size: info.Size,
|
||||
Size: info.Upload.Size,
|
||||
TimeStamp: timeStamp,
|
||||
Md5: md5sum,
|
||||
Peers: []string{c.host},
|
||||
@ -220,22 +220,22 @@ func (c *Server) initTus() {
|
||||
}
|
||||
log.Info(fileInfo)
|
||||
os.Remove(infoFullPath)
|
||||
if _, err = c.SaveFileInfoToLevelDB(info.ID, fileInfo, c.ldb); err != nil {
|
||||
if _, err = c.SaveFileInfoToLevelDB(info.Upload.ID, fileInfo, c.ldb); err != nil {
|
||||
//assosiate file id
|
||||
log.Error(err)
|
||||
}
|
||||
c.SaveFileMd5Log(fileInfo, CONST_FILE_Md5_FILE_NAME)
|
||||
go c.postFileToPeer(fileInfo)
|
||||
|
||||
go callBack(info, fileInfo)
|
||||
go callBack(info.Upload, fileInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
go notify(handler)
|
||||
go notify(h)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
http.Handle(bigDir, http.StripPrefix(bigDir, handler))
|
||||
http.Handle(bigDir, http.StripPrefix(bigDir, h))
|
||||
}
|
||||
|
||||
func (c *Server) initComponent(isReload bool) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
@ -8,14 +9,14 @@ import (
|
||||
|
||||
"github.com/astaxie/beego/httplib"
|
||||
log "github.com/sjqzhang/seelog"
|
||||
"github.com/sjqzhang/tusd"
|
||||
"github.com/busyfree/tusd/pkg/handler"
|
||||
)
|
||||
|
||||
type hookDataStore struct {
|
||||
tusd.DataStore
|
||||
handler.DataStore
|
||||
}
|
||||
|
||||
func (store hookDataStore) NewUpload(info tusd.FileInfo) (id string, err error) {
|
||||
func (store hookDataStore) NewUpload(ctx context.Context, info handler.FileInfo) (upload handler.Upload, err error) {
|
||||
var (
|
||||
jsonResult JsonResult
|
||||
)
|
||||
@ -24,7 +25,7 @@ func (store hookDataStore) NewUpload(info tusd.FileInfo) (id string, err error)
|
||||
msg := "token auth fail,auth_token is not in http header Upload-Metadata," +
|
||||
"in uppy uppy.setMeta({ auth_token: '9ee60e59-cb0f-4578-aaba-29b9fc2919ca' })"
|
||||
log.Error(msg, fmt.Sprintf("current header:%v", info.MetaData))
|
||||
return "", httpError{error: errors.New(msg), statusCode: 401}
|
||||
return nil, httpError{error: errors.New(msg), statusCode: 401}
|
||||
} else {
|
||||
req := httplib.Post(Config().AuthUrl)
|
||||
req.Param("auth_token", auth_token)
|
||||
@ -34,21 +35,60 @@ func (store hookDataStore) NewUpload(info tusd.FileInfo) (id string, err error)
|
||||
if strings.HasPrefix(content, "{") && strings.HasSuffix(content, "}") {
|
||||
if err = json.Unmarshal([]byte(content), &jsonResult); err != nil {
|
||||
log.Error(err)
|
||||
return "", httpError{error: errors.New(err.Error() + content), statusCode: 401}
|
||||
return nil, httpError{error: errors.New(err.Error() + content), statusCode: 401}
|
||||
}
|
||||
if jsonResult.Data != "ok" {
|
||||
return "", httpError{error: errors.New(content), statusCode: 401}
|
||||
return nil, httpError{error: errors.New(content), statusCode: 401}
|
||||
}
|
||||
} else {
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return "", err
|
||||
return nil, err
|
||||
}
|
||||
if strings.TrimSpace(content) != "ok" {
|
||||
return "", httpError{error: errors.New(content), statusCode: 401}
|
||||
return nil, httpError{error: errors.New(content), statusCode: 401}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return store.DataStore.NewUpload(info)
|
||||
return store.DataStore.NewUpload(ctx, info)
|
||||
}
|
||||
|
||||
//
|
||||
//func (store hookDataStore) NewUpload(info tusd.FileInfo) (id string, err error) {
|
||||
// var (
|
||||
// jsonResult JsonResult
|
||||
// )
|
||||
// if Config().AuthUrl != "" {
|
||||
// if auth_token, ok := info.MetaData["auth_token"]; !ok {
|
||||
// msg := "token auth fail,auth_token is not in http header Upload-Metadata," +
|
||||
// "in uppy uppy.setMeta({ auth_token: '9ee60e59-cb0f-4578-aaba-29b9fc2919ca' })"
|
||||
// log.Error(msg, fmt.Sprintf("current header:%v", info.MetaData))
|
||||
// return "", httpError{error: errors.New(msg), statusCode: 401}
|
||||
// } else {
|
||||
// req := httplib.Post(Config().AuthUrl)
|
||||
// req.Param("auth_token", auth_token)
|
||||
// req.SetTimeout(time.Second*5, time.Second*10)
|
||||
// content, err := req.String()
|
||||
// content = strings.TrimSpace(content)
|
||||
// if strings.HasPrefix(content, "{") && strings.HasSuffix(content, "}") {
|
||||
// if err = json.Unmarshal([]byte(content), &jsonResult); err != nil {
|
||||
// log.Error(err)
|
||||
// return "", httpError{error: errors.New(err.Error() + content), statusCode: 401}
|
||||
// }
|
||||
// if jsonResult.Data != "ok" {
|
||||
// return "", httpError{error: errors.New(content), statusCode: 401}
|
||||
// }
|
||||
// } else {
|
||||
// if err != nil {
|
||||
// log.Error(err)
|
||||
// return "", err
|
||||
// }
|
||||
// if strings.TrimSpace(content) != "ok" {
|
||||
// return "", httpError{error: errors.New(content), statusCode: 401}
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return store.DataStore.NewUpload(info)
|
||||
//}
|
||||
|
Loading…
Reference in New Issue
Block a user