mirror of
				https://github.com/cloudreve/cloudreve.git
				synced 2025-10-31 16:49:03 +08:00 
			
		
		
		
	Refactor: factory method for OSS client
Fix: use HTTPS schema by default in OSS client Feat: new handler for Qiniu policy
This commit is contained in:
		
							
								
								
									
										8
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								go.mod
									
									
									
									
									
								
							| @ -4,7 +4,7 @@ go 1.13 | |||||||
|  |  | ||||||
| require ( | require ( | ||||||
| 	github.com/DATA-DOG/go-sqlmock v1.3.3 | 	github.com/DATA-DOG/go-sqlmock v1.3.3 | ||||||
| 	github.com/HFO4/aliyun-oss-go-sdk v2.2.2+incompatible | 	github.com/HFO4/aliyun-oss-go-sdk v2.2.3+incompatible | ||||||
| 	github.com/aws/aws-sdk-go v1.31.5 | 	github.com/aws/aws-sdk-go v1.31.5 | ||||||
| 	github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect | 	github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect | ||||||
| 	github.com/duo-labs/webauthn v0.0.0-20191119193225-4bf9a0f776d4 | 	github.com/duo-labs/webauthn v0.0.0-20191119193225-4bf9a0f776d4 | ||||||
| @ -27,18 +27,18 @@ require ( | |||||||
| 	github.com/mojocn/base64Captcha v0.0.0-20190801020520-752b1cd608b2 | 	github.com/mojocn/base64Captcha v0.0.0-20190801020520-752b1cd608b2 | ||||||
| 	github.com/pkg/errors v0.9.1 | 	github.com/pkg/errors v0.9.1 | ||||||
| 	github.com/pquerna/otp v1.2.0 | 	github.com/pquerna/otp v1.2.0 | ||||||
| 	github.com/qiniu/api.v7/v7 v7.4.0 | 	github.com/qiniu/go-sdk/v7 v7.11.1 | ||||||
| 	github.com/rafaeljusto/redigomock v0.0.0-20191117212112-00b2509252a1 | 	github.com/rafaeljusto/redigomock v0.0.0-20191117212112-00b2509252a1 | ||||||
| 	github.com/rakyll/statik v0.1.7 | 	github.com/rakyll/statik v0.1.7 | ||||||
| 	github.com/robfig/cron/v3 v3.0.1 | 	github.com/robfig/cron/v3 v3.0.1 | ||||||
| 	github.com/smartystreets/goconvey v1.6.4 // indirect | 	github.com/smartystreets/goconvey v1.6.4 // indirect | ||||||
| 	github.com/speps/go-hashids v2.0.0+incompatible | 	github.com/speps/go-hashids v2.0.0+incompatible | ||||||
| 	github.com/stretchr/testify v1.5.1 | 	github.com/stretchr/testify v1.6.1 | ||||||
| 	github.com/tencentcloud/tencentcloud-sdk-go v3.0.125+incompatible | 	github.com/tencentcloud/tencentcloud-sdk-go v3.0.125+incompatible | ||||||
| 	github.com/tencentyun/cos-go-sdk-v5 v0.0.0-20200120023323-87ff3bc489ac | 	github.com/tencentyun/cos-go-sdk-v5 v0.0.0-20200120023323-87ff3bc489ac | ||||||
| 	github.com/upyun/go-sdk v2.1.0+incompatible | 	github.com/upyun/go-sdk v2.1.0+incompatible | ||||||
| 	golang.org/x/image v0.0.0-20211028202545-6944b10bf410 | 	golang.org/x/image v0.0.0-20211028202545-6944b10bf410 | ||||||
| 	golang.org/x/text v0.3.6 | 	golang.org/x/text v0.3.7 | ||||||
| 	gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect | 	gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect | ||||||
| 	gopkg.in/go-playground/validator.v9 v9.29.1 | 	gopkg.in/go-playground/validator.v9 v9.29.1 | ||||||
| 	gopkg.in/ini.v1 v1.51.0 // indirect | 	gopkg.in/ini.v1 v1.51.0 // indirect | ||||||
|  | |||||||
							
								
								
									
										65
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										65
									
								
								go.sum
									
									
									
									
									
								
							| @ -5,8 +5,8 @@ cloud.google.com/go v0.37.4/go.mod h1:NHPJ89PdicEuT9hdPXMROBD91xc5uRDxsMtSB16k7h | |||||||
| github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= | ||||||
| github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08= | github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08= | ||||||
| github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= | github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= | ||||||
| github.com/HFO4/aliyun-oss-go-sdk v2.2.2+incompatible h1:cWidHgoT2ye1YwzP5sz7xkqOK6I84mqrayJSU23oOUo= | github.com/HFO4/aliyun-oss-go-sdk v2.2.3+incompatible h1:aX/+gJM2dAMDDy3JqWS0DJn3JfOUchf4k37P5TbBKU8= | ||||||
| github.com/HFO4/aliyun-oss-go-sdk v2.2.2+incompatible/go.mod h1:8KDiKVrHK/UbXAhj+iQGp1m40rQa+UAvzBi7m22KywI= | github.com/HFO4/aliyun-oss-go-sdk v2.2.3+incompatible/go.mod h1:8KDiKVrHK/UbXAhj+iQGp1m40rQa+UAvzBi7m22KywI= | ||||||
| github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM= | github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM= | ||||||
| github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= | github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= | ||||||
| github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= | github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= | ||||||
| @ -30,6 +30,7 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk | |||||||
| github.com/cloudflare/cfssl v0.0.0-20190726000631-633726f6bcb7 h1:Puu1hUwfps3+1CUzYdAZXijuvLuRMirgiXdf3zsM2Ig= | github.com/cloudflare/cfssl v0.0.0-20190726000631-633726f6bcb7 h1:Puu1hUwfps3+1CUzYdAZXijuvLuRMirgiXdf3zsM2Ig= | ||||||
| github.com/cloudflare/cfssl v0.0.0-20190726000631-633726f6bcb7/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA= | github.com/cloudflare/cfssl v0.0.0-20190726000631-633726f6bcb7/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA= | ||||||
| github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= | github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= | ||||||
|  | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= | ||||||
| github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | 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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||||||
| github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||||||
| @ -69,10 +70,16 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 | |||||||
| github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= | github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= | ||||||
| github.com/go-mail/mail v2.3.1+incompatible h1:UzNOn0k5lpfVtO31cK3hn6I4VEVGhe3lX8AJBAxXExM= | github.com/go-mail/mail v2.3.1+incompatible h1:UzNOn0k5lpfVtO31cK3hn6I4VEVGhe3lX8AJBAxXExM= | ||||||
| github.com/go-mail/mail v2.3.1+incompatible/go.mod h1:VPWjmmNyRsWXQZHVHT3g0YbIINUkSmuKOiLIDkWbL6M= | github.com/go-mail/mail v2.3.1+incompatible/go.mod h1:VPWjmmNyRsWXQZHVHT3g0YbIINUkSmuKOiLIDkWbL6M= | ||||||
| github.com/go-playground/locales v0.12.1 h1:2FITxuFt/xuCNP1Acdhv62OzaCiviiE4kotfhkmOqEc= | github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= | ||||||
| github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= | github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= | ||||||
| github.com/go-playground/universal-translator v0.16.0 h1:X++omBR/4cE2MNg91AoC3rmGrCjJ8eAeUP/K/EKx4DM= | github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= | ||||||
|  | github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= | ||||||
|  | github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= | ||||||
| github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= | github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= | ||||||
|  | github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= | ||||||
|  | github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= | ||||||
|  | github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= | ||||||
|  | github.com/go-playground/validator/v10 v10.8.0/go.mod h1:9JhgTzTaE31GZDpH/HSvHiRJrJ3iKAgqqH0Bl/Ocjdk= | ||||||
| github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= | github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= | ||||||
| github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= | github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= | ||||||
| github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= | github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= | ||||||
| @ -145,14 +152,18 @@ github.com/kidstuff/mongostore v0.0.0-20181113001930-e650cd85ee4b/go.mod h1:g2nV | |||||||
| github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= | ||||||
| github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= | ||||||
| github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= | github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= | ||||||
| github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= |  | ||||||
| github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= | ||||||
|  | github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= | ||||||
|  | github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= | ||||||
|  | github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= | ||||||
| github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= | ||||||
| github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= | github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= | ||||||
| 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/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= | ||||||
| github.com/leodido/go-urn v1.1.0 h1:Sm1gr51B1kKyfD2BlRcLSiEkffoG96g6TPv6eRoEiB8= | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= | ||||||
|  | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= | ||||||
| github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= | github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= | ||||||
|  | github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= | ||||||
|  | github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= | ||||||
| github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4= | github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4= | ||||||
| github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= | github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= | ||||||
| github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= | github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= | ||||||
| @ -183,6 +194,7 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W | |||||||
| github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= | github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= | ||||||
| github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= | github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= | ||||||
| github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= | github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= | ||||||
|  | github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= | ||||||
| github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | ||||||
| github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= | ||||||
| github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | ||||||
| @ -197,8 +209,10 @@ github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1: | |||||||
| github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= | github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= | ||||||
| github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||||
| github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||||
| github.com/qiniu/api.v7/v7 v7.4.0 h1:9dZMVQifh31QGFLVaHls6akCaS2rlj3du8MnEFd7XjQ= | github.com/qiniu/dyn v1.3.0/go.mod h1:E8oERcm8TtwJiZvkQPbcAh0RL8jO1G0VXJMW3FAWdkk= | ||||||
| github.com/qiniu/api.v7/v7 v7.4.0/go.mod h1:VE5oC5rkE1xul0u1S2N0b2Uxq9/6hZzhyqjgK25XDcM= | github.com/qiniu/go-sdk/v7 v7.11.1 h1:/LZ9rvFS4p6SnszhGv11FNB1+n4OZvBCwFg7opH5Ovs= | ||||||
|  | github.com/qiniu/go-sdk/v7 v7.11.1/go.mod h1:btsaOc8CA3hdVloULfFdDgDc+g4f3TDZEFsDY0BLE+w= | ||||||
|  | github.com/qiniu/x v1.10.5/go.mod h1:03Ni9tj+N2h2aKnAz+6N0Xfl8FwMEDRC2PAlxekASDs= | ||||||
| github.com/quasoft/memstore v0.0.0-20180925164028-84a050167438 h1:jnz/4VenymvySjE+Ez511s0pqVzkUOmr1fwCVytNNWk= | github.com/quasoft/memstore v0.0.0-20180925164028-84a050167438 h1:jnz/4VenymvySjE+Ez511s0pqVzkUOmr1fwCVytNNWk= | ||||||
| github.com/quasoft/memstore v0.0.0-20180925164028-84a050167438/go.mod h1:wTPjTepVu7uJBYgZ0SdWHQlIas582j6cn2jgk4DDdlg= | github.com/quasoft/memstore v0.0.0-20180925164028-84a050167438/go.mod h1:wTPjTepVu7uJBYgZ0SdWHQlIas582j6cn2jgk4DDdlg= | ||||||
| github.com/rafaeljusto/redigomock v0.0.0-20191117212112-00b2509252a1 h1:leEwA4MD1ew0lNgzz6Q4G76G3AEfeci+TMggN6WuFRs= | github.com/rafaeljusto/redigomock v0.0.0-20191117212112-00b2509252a1 h1:leEwA4MD1ew0lNgzz6Q4G76G3AEfeci+TMggN6WuFRs= | ||||||
| @ -208,6 +222,9 @@ github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Ung | |||||||
| github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= | github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= | ||||||
| github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= | github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= | ||||||
| github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= | github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= | ||||||
|  | github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= | ||||||
|  | github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= | ||||||
|  | github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= | ||||||
| github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= | github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= | ||||||
| github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= | github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= | ||||||
| github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= | github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= | ||||||
| @ -224,8 +241,9 @@ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoH | |||||||
| github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= | 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.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= | ||||||
| github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= | 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/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= | ||||||
|  | github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= | ||||||
|  | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||||||
| github.com/tencentcloud/tencentcloud-sdk-go v3.0.125+incompatible h1:dqpmYaez7VBT7PCRBcBxkzlDOiTk7Td8ATiia1b1GuE= | github.com/tencentcloud/tencentcloud-sdk-go v3.0.125+incompatible h1:dqpmYaez7VBT7PCRBcBxkzlDOiTk7Td8ATiia1b1GuE= | ||||||
| github.com/tencentcloud/tencentcloud-sdk-go v3.0.125+incompatible/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4= | github.com/tencentcloud/tencentcloud-sdk-go v3.0.125+incompatible/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4= | ||||||
| github.com/tencentyun/cos-go-sdk-v5 v0.0.0-20200120023323-87ff3bc489ac h1:PSBhZblOjdwH7SIVgcue+7OlnLHkM45KuScLZ+PiVbQ= | github.com/tencentyun/cos-go-sdk-v5 v0.0.0-20200120023323-87ff3bc489ac h1:PSBhZblOjdwH7SIVgcue+7OlnLHkM45KuScLZ+PiVbQ= | ||||||
| @ -241,8 +259,10 @@ go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= | |||||||
| golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= | golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= | ||||||
| golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | ||||||
| golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | ||||||
| golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= |  | ||||||
| golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | ||||||
|  | golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= | ||||||
|  | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= | ||||||
|  | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= | ||||||
| golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= | ||||||
| golang.org/x/image v0.0.0-20190501045829-6d32002ffd75/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= | golang.org/x/image v0.0.0-20190501045829-6d32002ffd75/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= | ||||||
| golang.org/x/image v0.0.0-20211028202545-6944b10bf410 h1:hTftEOvwiOq2+O8k2D5/Q7COC7k5Qcrgc2TFURJYnvQ= | golang.org/x/image v0.0.0-20211028202545-6944b10bf410 h1:hTftEOvwiOq2+O8k2D5/Q7COC7k5Qcrgc2TFURJYnvQ= | ||||||
| @ -262,8 +282,9 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn | |||||||
| golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | ||||||
| golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | ||||||
| golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | ||||||
| golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI= |  | ||||||
| golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | ||||||
|  | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw= | ||||||
|  | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= | ||||||
| golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= | 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= | golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= | ||||||
| golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
| @ -271,6 +292,8 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ | |||||||
| golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
| golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
| golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
|  | golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs= | ||||||
|  | golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
| golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||||||
| golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||||||
| golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||||||
| @ -281,13 +304,20 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h | |||||||
| golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
| golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
| golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
| golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= |  | ||||||
| golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
|  | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
|  | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.0.0-20211020174200-9d6173849985 h1:LOlKVhfDyahgmqa97awczplwkjzNaELFg3zRIJ13RYo= | ||||||
|  | golang.org/x/sys v0.0.0-20211020174200-9d6173849985/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= | ||||||
| golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | 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.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | ||||||
| golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= | golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= | ||||||
| golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= | ||||||
| golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= | ||||||
|  | golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= | ||||||
|  | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= | ||||||
| golang.org/x/time v0.0.0-20181108054448-85acf8d2951c h1:fqgJT0MGcGpPgpWU7VRdRjuArfcOvC4AoJmILihzhDg= | golang.org/x/time v0.0.0-20181108054448-85acf8d2951c h1:fqgJT0MGcGpPgpWU7VRdRjuArfcOvC4AoJmILihzhDg= | ||||||
| golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= | golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= | ||||||
| golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | ||||||
| @ -309,8 +339,10 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks | |||||||
| gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk= | gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk= | ||||||
| gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= | gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= | ||||||
| gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||||
| gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= |  | ||||||
| gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/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-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= | ||||||
|  | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= | ||||||
|  | gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= | ||||||
| gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= | gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= | ||||||
| gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= | gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= | ||||||
| gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= | gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= | ||||||
| @ -325,6 +357,9 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD | |||||||
| gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | ||||||
| gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= | gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= | ||||||
| gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | ||||||
|  | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||||||
|  | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= | ||||||
|  | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||||||
| honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | ||||||
| honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | ||||||
| honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | ||||||
|  | |||||||
| @ -5,6 +5,7 @@ import ( | |||||||
| 	"github.com/cloudreve/Cloudreve/v3/pkg/filesystem/driver/oss" | 	"github.com/cloudreve/Cloudreve/v3/pkg/filesystem/driver/oss" | ||||||
| 	"github.com/cloudreve/Cloudreve/v3/pkg/mq" | 	"github.com/cloudreve/Cloudreve/v3/pkg/mq" | ||||||
| 	"github.com/cloudreve/Cloudreve/v3/pkg/util" | 	"github.com/cloudreve/Cloudreve/v3/pkg/util" | ||||||
|  | 	"github.com/qiniu/go-sdk/v7/auth/qbox" | ||||||
| 	"net/http" | 	"net/http" | ||||||
|  |  | ||||||
| 	model "github.com/cloudreve/Cloudreve/v3/models" | 	model "github.com/cloudreve/Cloudreve/v3/models" | ||||||
| @ -181,28 +182,22 @@ func RemoteCallbackAuth() gin.HandlerFunc { | |||||||
| // QiniuCallbackAuth 七牛回调签名验证 | // QiniuCallbackAuth 七牛回调签名验证 | ||||||
| func QiniuCallbackAuth() gin.HandlerFunc { | func QiniuCallbackAuth() gin.HandlerFunc { | ||||||
| 	return func(c *gin.Context) { | 	return func(c *gin.Context) { | ||||||
| 		//// 验证key并查找用户 | 		session := c.MustGet(filesystem.UploadSessionCtx).(*serializer.UploadSession) | ||||||
| 		//resp, user := uploadCallbackCheck(c) |  | ||||||
| 		//if resp.Code != 0 { | 		// 验证回调是否来自qiniu | ||||||
| 		//	c.JSON(401, serializer.GeneralUploadCallbackFailed{Error: resp.Msg}) | 		mac := qbox.NewMac(session.Policy.AccessKey, session.Policy.SecretKey) | ||||||
| 		//	c.Abort() | 		ok, err := mac.VerifyCallback(c.Request) | ||||||
| 		//	return | 		if err != nil { | ||||||
| 		//} | 			util.Log().Debug("无法验证回调请求,%s", err) | ||||||
| 		// | 			c.JSON(401, serializer.GeneralUploadCallbackFailed{Error: "无法验证回调请求"}) | ||||||
| 		//// 验证回调是否来自qiniu | 			c.Abort() | ||||||
| 		//mac := qbox.NewMac(user.Policy.AccessKey, user.Policy.SecretKey) | 			return | ||||||
| 		//ok, err := mac.VerifyCallback(c.Request) | 		} | ||||||
| 		//if err != nil { | 		if !ok { | ||||||
| 		//	util.Log().Debug("无法验证回调请求,%s", err) | 			c.JSON(401, serializer.GeneralUploadCallbackFailed{Error: "回调签名无效"}) | ||||||
| 		//	c.JSON(401, serializer.GeneralUploadCallbackFailed{Error: "无法验证回调请求"}) | 			c.Abort() | ||||||
| 		//	c.Abort() | 			return | ||||||
| 		//	return | 		} | ||||||
| 		//} |  | ||||||
| 		//if !ok { |  | ||||||
| 		//	c.JSON(401, serializer.GeneralUploadCallbackFailed{Error: "回调签名无效"}) |  | ||||||
| 		//	c.Abort() |  | ||||||
| 		//	return |  | ||||||
| 		//} |  | ||||||
|  |  | ||||||
| 		c.Next() | 		c.Next() | ||||||
| 	} | 	} | ||||||
| @ -289,7 +284,6 @@ func OneDriveCallbackAuth() gin.HandlerFunc { | |||||||
| } | } | ||||||
|  |  | ||||||
| // COSCallbackAuth 腾讯云COS回调签名验证 | // COSCallbackAuth 腾讯云COS回调签名验证 | ||||||
| // TODO 解耦 测试 |  | ||||||
| func COSCallbackAuth() gin.HandlerFunc { | func COSCallbackAuth() gin.HandlerFunc { | ||||||
| 	return func(c *gin.Context) { | 	return func(c *gin.Context) { | ||||||
| 		//// 验证key并查找用户 | 		//// 验证key并查找用户 | ||||||
|  | |||||||
| @ -17,7 +17,7 @@ import ( | |||||||
| 	"github.com/cloudreve/Cloudreve/v3/pkg/util" | 	"github.com/cloudreve/Cloudreve/v3/pkg/util" | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"github.com/jinzhu/gorm" | 	"github.com/jinzhu/gorm" | ||||||
| 	"github.com/qiniu/api.v7/v7/auth/qbox" | 	"github.com/qiniu/go-sdk/v7/auth/qbox" | ||||||
| 	"github.com/stretchr/testify/assert" | 	"github.com/stretchr/testify/assert" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | |||||||
| @ -152,7 +152,7 @@ func (policy *Policy) GeneratePath(uid uint, origin string) string { | |||||||
| func (policy *Policy) GenerateFileName(uid uint, origin string) string { | func (policy *Policy) GenerateFileName(uid uint, origin string) string { | ||||||
| 	// 未开启自动重命名时,直接返回原始文件名 | 	// 未开启自动重命名时,直接返回原始文件名 | ||||||
| 	if !policy.AutoRename { | 	if !policy.AutoRename { | ||||||
| 		return policy.getOriginNameRule(origin) | 		return origin | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	fileRule := policy.FileNameRule | 	fileRule := policy.FileNameRule | ||||||
| @ -171,10 +171,9 @@ func (policy *Policy) GenerateFileName(uid uint, origin string) string { | |||||||
| 		"{hour}":           time.Now().Format("15"), | 		"{hour}":           time.Now().Format("15"), | ||||||
| 		"{minute}":         time.Now().Format("04"), | 		"{minute}":         time.Now().Format("04"), | ||||||
| 		"{second}":         time.Now().Format("05"), | 		"{second}":         time.Now().Format("05"), | ||||||
|  | 		"{originname}":     origin, | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	replaceTable["{originname}"] = policy.getOriginNameRule(origin) |  | ||||||
|  |  | ||||||
| 	fileRule = util.Replace(replaceTable, fileRule) | 	fileRule = util.Replace(replaceTable, fileRule) | ||||||
| 	return fileRule | 	return fileRule | ||||||
| } | } | ||||||
| @ -232,7 +231,7 @@ func (policy *Policy) IsUploadPlaceholderWithSize() bool { | |||||||
| 		return true | 		return true | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if policy.Type == "onedrive" || policy.Type == "oss" { | 	if util.ContainsString([]string{"onedrive", "oss", "qiniu"}, policy.Type) { | ||||||
| 		return policy.OptionsSerialized.PlaceholderWithSize | 		return policy.OptionsSerialized.PlaceholderWithSize | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | |||||||
| @ -234,7 +234,7 @@ func (handler Driver) Token(ctx context.Context, ttl int64, uploadSession *seria | |||||||
| 	// 监控回调及上传 | 	// 监控回调及上传 | ||||||
| 	go handler.Client.MonitorUpload(uploadURL, uploadSession.Key, fileInfo.SavePath, fileInfo.Size, ttl) | 	go handler.Client.MonitorUpload(uploadURL, uploadSession.Key, fileInfo.SavePath, fileInfo.Size, ttl) | ||||||
|  |  | ||||||
| 	uploadSession.OneDriveUploadURL = uploadURL | 	uploadSession.UploadURL = uploadURL | ||||||
| 	return &serializer.UploadCredential{ | 	return &serializer.UploadCredential{ | ||||||
| 		SessionID:  uploadSession.Key, | 		SessionID:  uploadSession.Key, | ||||||
| 		ChunkSize:  handler.Policy.OptionsSerialized.ChunkSize, | 		ChunkSize:  handler.Policy.OptionsSerialized.ChunkSize, | ||||||
| @ -244,5 +244,5 @@ func (handler Driver) Token(ctx context.Context, ttl int64, uploadSession *seria | |||||||
|  |  | ||||||
| // 取消上传凭证 | // 取消上传凭证 | ||||||
| func (handler Driver) CancelToken(ctx context.Context, uploadSession *serializer.UploadSession) error { | func (handler Driver) CancelToken(ctx context.Context, uploadSession *serializer.UploadSession) error { | ||||||
| 	return handler.Client.DeleteUploadSession(ctx, uploadSession.OneDriveUploadURL) | 	return handler.Client.DeleteUploadSession(ctx, uploadSession.UploadURL) | ||||||
| } | } | ||||||
|  | |||||||
| @ -56,13 +56,17 @@ const ( | |||||||
| 	VersionID key = iota | 	VersionID key = iota | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // CORS 创建跨域策略 | func NewDriver(policy *model.Policy) (*Driver, error) { | ||||||
| func (handler *Driver) CORS() error { | 	driver := &Driver{ | ||||||
| 	// 初始化客户端 | 		Policy:     policy, | ||||||
| 	if err := handler.InitOSSClient(false); err != nil { | 		HTTPClient: request.NewClient(), | ||||||
| 		return err |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	return driver, driver.InitOSSClient(false) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // CORS 创建跨域策略 | ||||||
|  | func (handler *Driver) CORS() error { | ||||||
| 	return handler.client.SetBucketCORS(handler.Policy.BucketName, []oss.CORSRule{ | 	return handler.client.SetBucketCORS(handler.Policy.BucketName, []oss.CORSRule{ | ||||||
| 		{ | 		{ | ||||||
| 			AllowedOrigin: []string{"*"}, | 			AllowedOrigin: []string{"*"}, | ||||||
| @ -86,7 +90,6 @@ func (handler *Driver) InitOSSClient(forceUsePublicEndpoint bool) error { | |||||||
| 		return errors.New("存储策略为空") | 		return errors.New("存储策略为空") | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if handler.client == nil { |  | ||||||
| 	// 决定是否使用内网 Endpoint | 	// 决定是否使用内网 Endpoint | ||||||
| 	endpoint := handler.Policy.Server | 	endpoint := handler.Policy.Server | ||||||
| 	if handler.Policy.OptionsSerialized.ServerSideEndpoint != "" && !forceUsePublicEndpoint { | 	if handler.Policy.OptionsSerialized.ServerSideEndpoint != "" && !forceUsePublicEndpoint { | ||||||
| @ -107,18 +110,11 @@ func (handler *Driver) InitOSSClient(forceUsePublicEndpoint bool) error { | |||||||
| 	} | 	} | ||||||
| 	handler.bucket = bucket | 	handler.bucket = bucket | ||||||
|  |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
| // List 列出OSS上的文件 | // List 列出OSS上的文件 | ||||||
| func (handler Driver) List(ctx context.Context, base string, recursive bool) ([]response.Object, error) { | func (handler *Driver) List(ctx context.Context, base string, recursive bool) ([]response.Object, error) { | ||||||
| 	// 初始化客户端 |  | ||||||
| 	if err := handler.InitOSSClient(false); err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	// 列取文件 | 	// 列取文件 | ||||||
| 	base = strings.TrimPrefix(base, "/") | 	base = strings.TrimPrefix(base, "/") | ||||||
| 	if base != "" { | 	if base != "" { | ||||||
| @ -185,7 +181,7 @@ func (handler Driver) List(ctx context.Context, base string, recursive bool) ([] | |||||||
| } | } | ||||||
|  |  | ||||||
| // Get 获取文件 | // Get 获取文件 | ||||||
| func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser, error) { | func (handler *Driver) Get(ctx context.Context, path string) (response.RSCloser, error) { | ||||||
| 	// 通过VersionID禁止缓存 | 	// 通过VersionID禁止缓存 | ||||||
| 	ctx = context.WithValue(ctx, VersionID, time.Now().UnixNano()) | 	ctx = context.WithValue(ctx, VersionID, time.Now().UnixNano()) | ||||||
|  |  | ||||||
| @ -228,15 +224,10 @@ func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser, | |||||||
| } | } | ||||||
|  |  | ||||||
| // Put 将文件流保存到指定目录 | // Put 将文件流保存到指定目录 | ||||||
| func (handler Driver) Put(ctx context.Context, file fsctx.FileHeader) error { | func (handler *Driver) Put(ctx context.Context, file fsctx.FileHeader) error { | ||||||
| 	defer file.Close() | 	defer file.Close() | ||||||
| 	fileInfo := file.Info() | 	fileInfo := file.Info() | ||||||
|  |  | ||||||
| 	// 初始化客户端 |  | ||||||
| 	if err := handler.InitOSSClient(false); err != nil { |  | ||||||
| 		return err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	// 凭证有效期 | 	// 凭证有效期 | ||||||
| 	credentialTTL := model.GetIntSetting("upload_credential_timeout", 3600) | 	credentialTTL := model.GetIntSetting("upload_credential_timeout", 3600) | ||||||
|  |  | ||||||
| @ -247,12 +238,12 @@ func (handler Driver) Put(ctx context.Context, file fsctx.FileHeader) error { | |||||||
| 		oss.ForbidOverWrite(!overwrite), | 		oss.ForbidOverWrite(!overwrite), | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// 上传文件 | 	// 小文件直接上传 | ||||||
| 	//err := handler.bucket.PutObject(fileInfo.SavePath, file, options...) | 	if fileInfo.Size < MultiPartUploadThreshold { | ||||||
| 	//if err != nil { | 		return handler.bucket.PutObject(fileInfo.SavePath, file, options...) | ||||||
| 	//	return err | 	} | ||||||
| 	//} |  | ||||||
|  |  | ||||||
|  | 	// 超过阈值时使用分片上传 | ||||||
| 	imur, err := handler.bucket.InitiateMultipartUpload(fileInfo.SavePath, options...) | 	imur, err := handler.bucket.InitiateMultipartUpload(fileInfo.SavePath, options...) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return fmt.Errorf("failed to initiate multipart upload: %w", err) | 		return fmt.Errorf("failed to initiate multipart upload: %w", err) | ||||||
| @ -280,12 +271,7 @@ func (handler Driver) Put(ctx context.Context, file fsctx.FileHeader) error { | |||||||
|  |  | ||||||
| // Delete 删除一个或多个文件, | // Delete 删除一个或多个文件, | ||||||
| // 返回未删除的文件 | // 返回未删除的文件 | ||||||
| func (handler Driver) Delete(ctx context.Context, files []string) ([]string, error) { | func (handler *Driver) Delete(ctx context.Context, files []string) ([]string, error) { | ||||||
| 	// 初始化客户端 |  | ||||||
| 	if err := handler.InitOSSClient(false); err != nil { |  | ||||||
| 		return files, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	// 删除文件 | 	// 删除文件 | ||||||
| 	delRes, err := handler.bucket.DeleteObjects(files) | 	delRes, err := handler.bucket.DeleteObjects(files) | ||||||
|  |  | ||||||
| @ -303,7 +289,7 @@ func (handler Driver) Delete(ctx context.Context, files []string) ([]string, err | |||||||
| } | } | ||||||
|  |  | ||||||
| // Thumb 获取文件缩略图 | // Thumb 获取文件缩略图 | ||||||
| func (handler Driver) Thumb(ctx context.Context, path string) (*response.ContentResponse, error) { | func (handler *Driver) Thumb(ctx context.Context, path string) (*response.ContentResponse, error) { | ||||||
| 	// 初始化客户端 | 	// 初始化客户端 | ||||||
| 	if err := handler.InitOSSClient(true); err != nil { | 	if err := handler.InitOSSClient(true); err != nil { | ||||||
| 		return nil, err | 		return nil, err | ||||||
| @ -337,7 +323,7 @@ func (handler Driver) Thumb(ctx context.Context, path string) (*response.Content | |||||||
| } | } | ||||||
|  |  | ||||||
| // Source 获取外链URL | // Source 获取外链URL | ||||||
| func (handler Driver) Source( | func (handler *Driver) Source( | ||||||
| 	ctx context.Context, | 	ctx context.Context, | ||||||
| 	path string, | 	path string, | ||||||
| 	baseURL url.URL, | 	baseURL url.URL, | ||||||
| @ -382,7 +368,7 @@ func (handler Driver) Source( | |||||||
| 	return handler.signSourceURL(ctx, path, ttl, signOptions) | 	return handler.signSourceURL(ctx, path, ttl, signOptions) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (handler Driver) signSourceURL(ctx context.Context, path string, ttl int64, options []oss.Option) (string, error) { | func (handler *Driver) signSourceURL(ctx context.Context, path string, ttl int64, options []oss.Option) (string, error) { | ||||||
| 	signedURL, err := handler.bucket.SignURL(path, oss.HTTPGet, ttl, options...) | 	signedURL, err := handler.bucket.SignURL(path, oss.HTTPGet, ttl, options...) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return "", err | 		return "", err | ||||||
| @ -394,9 +380,6 @@ func (handler Driver) signSourceURL(ctx context.Context, path string, ttl int64, | |||||||
| 		return "", err | 		return "", err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// 优先使用https |  | ||||||
| 	finalURL.Scheme = "https" |  | ||||||
|  |  | ||||||
| 	// 公有空间替换掉Key及不支持的头 | 	// 公有空间替换掉Key及不支持的头 | ||||||
| 	if !handler.Policy.IsPrivate { | 	if !handler.Policy.IsPrivate { | ||||||
| 		query := finalURL.Query() | 		query := finalURL.Query() | ||||||
| @ -420,10 +403,7 @@ func (handler Driver) signSourceURL(ctx context.Context, path string, ttl int64, | |||||||
| } | } | ||||||
|  |  | ||||||
| // Token 获取上传策略和认证Token | // Token 获取上传策略和认证Token | ||||||
| func (handler Driver) Token(ctx context.Context, ttl int64, uploadSession *serializer.UploadSession, file fsctx.FileHeader) (*serializer.UploadCredential, error) { | func (handler *Driver) Token(ctx context.Context, ttl int64, uploadSession *serializer.UploadSession, file fsctx.FileHeader) (*serializer.UploadCredential, error) { | ||||||
| 	if err := handler.InitOSSClient(false); err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	// 生成回调地址 | 	// 生成回调地址 | ||||||
| 	siteURL := model.GetSiteURL() | 	siteURL := model.GetSiteURL() | ||||||
| @ -452,7 +432,7 @@ func (handler Driver) Token(ctx context.Context, ttl int64, uploadSession *seria | |||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, fmt.Errorf("failed to initialize multipart upload: %w", err) | 		return nil, fmt.Errorf("failed to initialize multipart upload: %w", err) | ||||||
| 	} | 	} | ||||||
| 	uploadSession.OSSUploadID = imur.UploadID | 	uploadSession.UploadID = imur.UploadID | ||||||
|  |  | ||||||
| 	// 为每个分片签名上传 URL | 	// 为每个分片签名上传 URL | ||||||
| 	chunks := chunk.NewChunkGroup(file, handler.Policy.OptionsSerialized.ChunkSize, &backoff.ConstantBackoff{}) | 	chunks := chunk.NewChunkGroup(file, handler.Policy.OptionsSerialized.ChunkSize, &backoff.ConstantBackoff{}) | ||||||
| @ -496,9 +476,6 @@ func (handler Driver) Token(ctx context.Context, ttl int64, uploadSession *seria | |||||||
| } | } | ||||||
|  |  | ||||||
| // 取消上传凭证 | // 取消上传凭证 | ||||||
| func (handler Driver) CancelToken(ctx context.Context, uploadSession *serializer.UploadSession) error { | func (handler *Driver) CancelToken(ctx context.Context, uploadSession *serializer.UploadSession) error { | ||||||
| 	if err := handler.InitOSSClient(false); err != nil { | 	return handler.bucket.AbortMultipartUpload(oss.InitiateMultipartUploadResult{UploadID: uploadSession.UploadID, Key: uploadSession.SavePath}, nil) | ||||||
| 		return err |  | ||||||
| 	} |  | ||||||
| 	return handler.bucket.AbortMultipartUpload(oss.InitiateMultipartUploadResult{UploadID: uploadSession.OSSUploadID, Key: uploadSession.SavePath}, nil) |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -2,6 +2,7 @@ package qiniu | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
|  | 	"encoding/base64" | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| @ -16,17 +17,31 @@ import ( | |||||||
| 	"github.com/cloudreve/Cloudreve/v3/pkg/filesystem/response" | 	"github.com/cloudreve/Cloudreve/v3/pkg/filesystem/response" | ||||||
| 	"github.com/cloudreve/Cloudreve/v3/pkg/request" | 	"github.com/cloudreve/Cloudreve/v3/pkg/request" | ||||||
| 	"github.com/cloudreve/Cloudreve/v3/pkg/serializer" | 	"github.com/cloudreve/Cloudreve/v3/pkg/serializer" | ||||||
| 	"github.com/qiniu/api.v7/v7/auth/qbox" | 	"github.com/qiniu/go-sdk/v7/auth/qbox" | ||||||
| 	"github.com/qiniu/api.v7/v7/storage" | 	"github.com/qiniu/go-sdk/v7/storage" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // Driver 本地策略适配器 | // Driver 本地策略适配器 | ||||||
| type Driver struct { | type Driver struct { | ||||||
| 	Policy *model.Policy | 	Policy *model.Policy | ||||||
|  | 	mac    *qbox.Mac | ||||||
|  | 	cfg    *storage.Config | ||||||
|  | 	bucket *storage.BucketManager | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func NewDriver(policy *model.Policy) *Driver { | ||||||
|  | 	mac := qbox.NewMac(policy.AccessKey, policy.SecretKey) | ||||||
|  | 	cfg := &storage.Config{UseHTTPS: true} | ||||||
|  | 	return &Driver{ | ||||||
|  | 		Policy: policy, | ||||||
|  | 		mac:    mac, | ||||||
|  | 		cfg:    cfg, | ||||||
|  | 		bucket: storage.NewBucketManager(mac, cfg), | ||||||
|  | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| // List 列出给定路径下的文件 | // List 列出给定路径下的文件 | ||||||
| func (handler Driver) List(ctx context.Context, base string, recursive bool) ([]response.Object, error) { | func (handler *Driver) List(ctx context.Context, base string, recursive bool) ([]response.Object, error) { | ||||||
| 	base = strings.TrimPrefix(base, "/") | 	base = strings.TrimPrefix(base, "/") | ||||||
| 	if base != "" { | 	if base != "" { | ||||||
| 		base += "/" | 		base += "/" | ||||||
| @ -42,14 +57,8 @@ func (handler Driver) List(ctx context.Context, base string, recursive bool) ([] | |||||||
| 		delimiter = "/" | 		delimiter = "/" | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	mac := qbox.NewMac(handler.Policy.AccessKey, handler.Policy.SecretKey) |  | ||||||
| 	cfg := storage.Config{ |  | ||||||
| 		UseHTTPS: true, |  | ||||||
| 	} |  | ||||||
| 	bucketManager := storage.NewBucketManager(mac, &cfg) |  | ||||||
|  |  | ||||||
| 	for { | 	for { | ||||||
| 		entries, folders, nextMarker, hashNext, err := bucketManager.ListFiles( | 		entries, folders, nextMarker, hashNext, err := handler.bucket.ListFiles( | ||||||
| 			handler.Policy.BucketName, | 			handler.Policy.BucketName, | ||||||
| 			base, delimiter, marker, 1000) | 			base, delimiter, marker, 1000) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| @ -99,7 +108,7 @@ func (handler Driver) List(ctx context.Context, base string, recursive bool) ([] | |||||||
| } | } | ||||||
|  |  | ||||||
| // Get 获取文件 | // Get 获取文件 | ||||||
| func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser, error) { | func (handler *Driver) Get(ctx context.Context, path string) (response.RSCloser, error) { | ||||||
| 	// 给文件名加上随机参数以强制拉取 | 	// 给文件名加上随机参数以强制拉取 | ||||||
| 	path = fmt.Sprintf("%s?v=%d", path, time.Now().UnixNano()) | 	path = fmt.Sprintf("%s?v=%d", path, time.Now().UnixNano()) | ||||||
|  |  | ||||||
| @ -143,7 +152,7 @@ func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser, | |||||||
| } | } | ||||||
|  |  | ||||||
| // Put 将文件流保存到指定目录 | // Put 将文件流保存到指定目录 | ||||||
| func (handler Driver) Put(ctx context.Context, file fsctx.FileHeader) error { | func (handler *Driver) Put(ctx context.Context, file fsctx.FileHeader) error { | ||||||
| 	defer file.Close() | 	defer file.Close() | ||||||
|  |  | ||||||
| 	// 凭证有效期 | 	// 凭证有效期 | ||||||
| @ -151,9 +160,14 @@ func (handler Driver) Put(ctx context.Context, file fsctx.FileHeader) error { | |||||||
|  |  | ||||||
| 	// 生成上传策略 | 	// 生成上传策略 | ||||||
| 	fileInfo := file.Info() | 	fileInfo := file.Info() | ||||||
|  | 	scope := handler.Policy.BucketName | ||||||
|  | 	if fileInfo.Mode&fsctx.Overwrite == fsctx.Overwrite { | ||||||
|  | 		scope = fmt.Sprintf("%s:%s", handler.Policy.BucketName, fileInfo.SavePath) | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	putPolicy := storage.PutPolicy{ | 	putPolicy := storage.PutPolicy{ | ||||||
| 		// 指定为覆盖策略 | 		// 指定为覆盖策略 | ||||||
| 		Scope:        fmt.Sprintf("%s:%s", handler.Policy.BucketName, fileInfo.SavePath), | 		Scope:        scope, | ||||||
| 		SaveKey:      fileInfo.SavePath, | 		SaveKey:      fileInfo.SavePath, | ||||||
| 		ForceSaveKey: true, | 		ForceSaveKey: true, | ||||||
| 		FsizeLimit:   int64(fileInfo.Size), | 		FsizeLimit:   int64(fileInfo.Size), | ||||||
| @ -164,7 +178,7 @@ func (handler Driver) Put(ctx context.Context, file fsctx.FileHeader) error { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// 生成上传凭证 | 	// 生成上传凭证 | ||||||
| 	token, err := handler.getUploadCredential(ctx, putPolicy, int64(credentialTTL)) | 	token, err := handler.getUploadCredential(ctx, putPolicy, fileInfo, int64(credentialTTL), false) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
| @ -178,7 +192,7 @@ func (handler Driver) Put(ctx context.Context, file fsctx.FileHeader) error { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// 开始上传 | 	// 开始上传 | ||||||
| 	err = formUploader.Put(ctx, &ret, token.Token, fileInfo.SavePath, file, int64(fileInfo.Size), &putExtra) | 	err = formUploader.Put(ctx, &ret, token.Credential, fileInfo.SavePath, file, int64(fileInfo.Size), &putExtra) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
| @ -188,19 +202,14 @@ func (handler Driver) Put(ctx context.Context, file fsctx.FileHeader) error { | |||||||
|  |  | ||||||
| // Delete 删除一个或多个文件, | // Delete 删除一个或多个文件, | ||||||
| // 返回未删除的文件 | // 返回未删除的文件 | ||||||
| func (handler Driver) Delete(ctx context.Context, files []string) ([]string, error) { | func (handler *Driver) Delete(ctx context.Context, files []string) ([]string, error) { | ||||||
| 	// TODO 大于一千个文件需要分批发送 | 	// TODO 大于一千个文件需要分批发送 | ||||||
| 	deleteOps := make([]string, 0, len(files)) | 	deleteOps := make([]string, 0, len(files)) | ||||||
| 	for _, key := range files { | 	for _, key := range files { | ||||||
| 		deleteOps = append(deleteOps, storage.URIDelete(handler.Policy.BucketName, key)) | 		deleteOps = append(deleteOps, storage.URIDelete(handler.Policy.BucketName, key)) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	mac := qbox.NewMac(handler.Policy.AccessKey, handler.Policy.SecretKey) | 	rets, err := handler.bucket.Batch(deleteOps) | ||||||
| 	cfg := storage.Config{ |  | ||||||
| 		UseHTTPS: true, |  | ||||||
| 	} |  | ||||||
| 	bucketManager := storage.NewBucketManager(mac, &cfg) |  | ||||||
| 	rets, err := bucketManager.Batch(deleteOps) |  | ||||||
|  |  | ||||||
| 	// 处理删除结果 | 	// 处理删除结果 | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| @ -217,7 +226,7 @@ func (handler Driver) Delete(ctx context.Context, files []string) ([]string, err | |||||||
| } | } | ||||||
|  |  | ||||||
| // Thumb 获取文件缩略图 | // Thumb 获取文件缩略图 | ||||||
| func (handler Driver) Thumb(ctx context.Context, path string) (*response.ContentResponse, error) { | func (handler *Driver) Thumb(ctx context.Context, path string) (*response.ContentResponse, error) { | ||||||
| 	var ( | 	var ( | ||||||
| 		thumbSize = [2]uint{400, 300} | 		thumbSize = [2]uint{400, 300} | ||||||
| 		ok        = false | 		ok        = false | ||||||
| @ -238,7 +247,7 @@ func (handler Driver) Thumb(ctx context.Context, path string) (*response.Content | |||||||
| } | } | ||||||
|  |  | ||||||
| // Source 获取外链URL | // Source 获取外链URL | ||||||
| func (handler Driver) Source( | func (handler *Driver) Source( | ||||||
| 	ctx context.Context, | 	ctx context.Context, | ||||||
| 	path string, | 	path string, | ||||||
| 	baseURL url.URL, | 	baseURL url.URL, | ||||||
| @ -261,12 +270,11 @@ func (handler Driver) Source( | |||||||
| 	return handler.signSourceURL(ctx, path, ttl), nil | 	return handler.signSourceURL(ctx, path, ttl), nil | ||||||
| } | } | ||||||
|  |  | ||||||
| func (handler Driver) signSourceURL(ctx context.Context, path string, ttl int64) string { | func (handler *Driver) signSourceURL(ctx context.Context, path string, ttl int64) string { | ||||||
| 	var sourceURL string | 	var sourceURL string | ||||||
| 	if handler.Policy.IsPrivate { | 	if handler.Policy.IsPrivate { | ||||||
| 		mac := qbox.NewMac(handler.Policy.AccessKey, handler.Policy.SecretKey) |  | ||||||
| 		deadline := time.Now().Add(time.Second * time.Duration(ttl)).Unix() | 		deadline := time.Now().Add(time.Second * time.Duration(ttl)).Unix() | ||||||
| 		sourceURL = storage.MakePrivateURL(mac, handler.Policy.BaseURL, path, deadline) | 		sourceURL = storage.MakePrivateURL(handler.mac, handler.Policy.BaseURL, path, deadline) | ||||||
| 	} else { | 	} else { | ||||||
| 		sourceURL = storage.MakePublicURL(handler.Policy.BaseURL, path) | 		sourceURL = storage.MakePublicURL(handler.Policy.BaseURL, path) | ||||||
| 	} | 	} | ||||||
| @ -274,19 +282,20 @@ func (handler Driver) signSourceURL(ctx context.Context, path string, ttl int64) | |||||||
| } | } | ||||||
|  |  | ||||||
| // Token 获取上传策略和认证Token | // Token 获取上传策略和认证Token | ||||||
| func (handler Driver) Token(ctx context.Context, ttl int64, uploadSession *serializer.UploadSession, file fsctx.FileHeader) (*serializer.UploadCredential, error) { | func (handler *Driver) Token(ctx context.Context, ttl int64, uploadSession *serializer.UploadSession, file fsctx.FileHeader) (*serializer.UploadCredential, error) { | ||||||
| 	// 生成回调地址 | 	// 生成回调地址 | ||||||
| 	siteURL := model.GetSiteURL() | 	siteURL := model.GetSiteURL() | ||||||
| 	apiBaseURI, _ := url.Parse("/api/v3/callback/qiniu/" + uploadSession.Key) | 	apiBaseURI, _ := url.Parse("/api/v3/callback/qiniu/" + uploadSession.Key) | ||||||
| 	apiURL := siteURL.ResolveReference(apiBaseURI) | 	apiURL := siteURL.ResolveReference(apiBaseURI) | ||||||
|  |  | ||||||
| 	// 创建上传策略 | 	// 创建上传策略 | ||||||
|  | 	fileInfo := file.Info() | ||||||
| 	putPolicy := storage.PutPolicy{ | 	putPolicy := storage.PutPolicy{ | ||||||
| 		Scope:            handler.Policy.BucketName, | 		Scope:            handler.Policy.BucketName, | ||||||
| 		CallbackURL:      apiURL.String(), | 		CallbackURL:      apiURL.String(), | ||||||
| 		CallbackBody:     `{"name":"$(fname)","source_name":"$(key)","size":$(fsize),"pic_info":"$(imageInfo.width),$(imageInfo.height)"}`, | 		CallbackBody:     `{"size":$(fsize),"pic_info":"$(imageInfo.width),$(imageInfo.height)"}`, | ||||||
| 		CallbackBodyType: "application/json", | 		CallbackBodyType: "application/json", | ||||||
| 		SaveKey:          file.Info().SavePath, | 		SaveKey:          fileInfo.SavePath, | ||||||
| 		ForceSaveKey:     true, | 		ForceSaveKey:     true, | ||||||
| 		FsizeLimit:       int64(handler.Policy.MaxSize), | 		FsizeLimit:       int64(handler.Policy.MaxSize), | ||||||
| 	} | 	} | ||||||
| @ -295,21 +304,46 @@ func (handler Driver) Token(ctx context.Context, ttl int64, uploadSession *seria | |||||||
| 		putPolicy.MimeLimit = handler.Policy.OptionsSerialized.MimeType | 		putPolicy.MimeLimit = handler.Policy.OptionsSerialized.MimeType | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return handler.getUploadCredential(ctx, putPolicy, ttl) | 	credential, err := handler.getUploadCredential(ctx, putPolicy, fileInfo, ttl, true) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, fmt.Errorf("failed to init parts: %w", err) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| // getUploadCredential 签名上传策略 | 	credential.SessionID = uploadSession.Key | ||||||
| func (handler Driver) getUploadCredential(ctx context.Context, policy storage.PutPolicy, TTL int64) (*serializer.UploadCredential, error) { | 	credential.ChunkSize = handler.Policy.OptionsSerialized.ChunkSize | ||||||
|  |  | ||||||
|  | 	uploadSession.UploadURL = credential.UploadURLs[0] | ||||||
|  | 	uploadSession.Credential = credential.Credential | ||||||
|  |  | ||||||
|  | 	return credential, nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // getUploadCredential 签名上传策略并创建上传会话 | ||||||
|  | func (handler *Driver) getUploadCredential(ctx context.Context, policy storage.PutPolicy, file *fsctx.UploadTaskInfo, TTL int64, resume bool) (*serializer.UploadCredential, error) { | ||||||
|  | 	// 上传凭证 | ||||||
| 	policy.Expires = uint64(TTL) | 	policy.Expires = uint64(TTL) | ||||||
| 	mac := qbox.NewMac(handler.Policy.AccessKey, handler.Policy.SecretKey) | 	upToken := policy.UploadToken(handler.mac) | ||||||
| 	upToken := policy.UploadToken(mac) |  | ||||||
|  | 	// 初始化分片上传 | ||||||
|  | 	resumeUploader := storage.NewResumeUploaderV2(handler.cfg) | ||||||
|  | 	upHost, err := resumeUploader.UpHost(handler.Policy.AccessKey, handler.Policy.BucketName) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	ret := &storage.InitPartsRet{} | ||||||
|  | 	if resume { | ||||||
|  | 		err = resumeUploader.InitParts(ctx, upToken, upHost, handler.Policy.BucketName, file.SavePath, true, ret) | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	return &serializer.UploadCredential{ | 	return &serializer.UploadCredential{ | ||||||
| 		Token: upToken, | 		UploadURLs: []string{upHost + "/buckets/" + handler.Policy.BucketName + "/objects/" + base64.URLEncoding.EncodeToString([]byte(file.SavePath)) + "/uploads/" + ret.UploadID}, | ||||||
| 	}, nil | 		Credential: upToken, | ||||||
|  | 	}, err | ||||||
| } | } | ||||||
|  |  | ||||||
| // 取消上传凭证 | // 取消上传凭证 | ||||||
| func (handler Driver) CancelToken(ctx context.Context, uploadSession *serializer.UploadSession) error { | func (handler Driver) CancelToken(ctx context.Context, uploadSession *serializer.UploadSession) error { | ||||||
| 	return nil | 	resumeUploader := storage.NewResumeUploaderV2(handler.cfg) | ||||||
|  | 	return resumeUploader.Client.CallWith(ctx, nil, "DELETE", uploadSession.UploadURL, http.Header{"Authorization": {"UpToken " + uploadSession.Credential}}, nil, 0) | ||||||
| } | } | ||||||
|  | |||||||
| @ -144,16 +144,12 @@ func (fs *FileSystem) DispatchHandler() error { | |||||||
|  |  | ||||||
| 		fs.Handler = handler | 		fs.Handler = handler | ||||||
| 	case "qiniu": | 	case "qiniu": | ||||||
| 		fs.Handler = qiniu.Driver{ | 		fs.Handler = qiniu.NewDriver(currentPolicy) | ||||||
| 			Policy: currentPolicy, |  | ||||||
| 		} |  | ||||||
| 		return nil | 		return nil | ||||||
| 	case "oss": | 	case "oss": | ||||||
| 		fs.Handler = oss.Driver{ | 		handler, err := oss.NewDriver(currentPolicy) | ||||||
| 			Policy:     currentPolicy, | 		fs.Handler = handler | ||||||
| 			HTTPClient: request.NewClient(), | 		return err | ||||||
| 		} |  | ||||||
| 		return nil |  | ||||||
| 	case "upyun": | 	case "upyun": | ||||||
| 		fs.Handler = upyun.Driver{ | 		fs.Handler = upyun.Driver{ | ||||||
| 			Policy: currentPolicy, | 			Policy: currentPolicy, | ||||||
|  | |||||||
| @ -91,8 +91,6 @@ func (fs *FileSystem) Upload(ctx context.Context, file *fsctx.FileStream) (err e | |||||||
| // TODO 完善测试 | // TODO 完善测试 | ||||||
| func (fs *FileSystem) GenerateSavePath(ctx context.Context, file fsctx.FileHeader) string { | func (fs *FileSystem) GenerateSavePath(ctx context.Context, file fsctx.FileHeader) string { | ||||||
| 	fileInfo := file.Info() | 	fileInfo := file.Info() | ||||||
|  |  | ||||||
| 	if fs.User.Model.ID != 0 { |  | ||||||
| 	return path.Join( | 	return path.Join( | ||||||
| 		fs.Policy.GeneratePath( | 		fs.Policy.GeneratePath( | ||||||
| 			fs.User.Model.ID, | 			fs.User.Model.ID, | ||||||
| @ -103,28 +101,7 @@ func (fs *FileSystem) GenerateSavePath(ctx context.Context, file fsctx.FileHeade | |||||||
| 			fileInfo.FileName, | 			fileInfo.FileName, | ||||||
| 		), | 		), | ||||||
| 	) | 	) | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	// 匿名文件系统尝试根据上下文中的上传策略生成路径 |  | ||||||
| 	var anonymousPolicy model.Policy |  | ||||||
| 	if policy, ok := ctx.Value(fsctx.UploadPolicyCtx).(serializer.UploadPolicy); ok { |  | ||||||
| 		anonymousPolicy = model.Policy{ |  | ||||||
| 			Type:         "remote", |  | ||||||
| 			AutoRename:   policy.AutoRename, |  | ||||||
| 			DirNameRule:  policy.SavePath, |  | ||||||
| 			FileNameRule: policy.FileName, |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	return path.Join( |  | ||||||
| 		anonymousPolicy.GeneratePath( |  | ||||||
| 			0, |  | ||||||
| 			"", |  | ||||||
| 		), |  | ||||||
| 		anonymousPolicy.GenerateFileName( |  | ||||||
| 			0, |  | ||||||
| 			fileInfo.FileName, |  | ||||||
| 		), |  | ||||||
| 	) |  | ||||||
| } | } | ||||||
|  |  | ||||||
| // CancelUpload 监测客户端取消上传 | // CancelUpload 监测客户端取消上传 | ||||||
|  | |||||||
| @ -48,8 +48,9 @@ type UploadSession struct { | |||||||
| 	Policy         model.Policy | 	Policy         model.Policy | ||||||
| 	Callback       string // 回调 URL 地址 | 	Callback       string // 回调 URL 地址 | ||||||
| 	CallbackSecret string // 回调 URL | 	CallbackSecret string // 回调 URL | ||||||
| 	OneDriveUploadURL string | 	UploadURL      string | ||||||
| 	OSSUploadID       string | 	UploadID       string | ||||||
|  | 	Credential     string | ||||||
| } | } | ||||||
|  |  | ||||||
| // UploadCallback 上传回调正文 | // UploadCallback 上传回调正文 | ||||||
|  | |||||||
| @ -244,7 +244,8 @@ func InitMasterRouter() *gin.Engine { | |||||||
| 			) | 			) | ||||||
| 			// 七牛策略上传回调 | 			// 七牛策略上传回调 | ||||||
| 			callback.POST( | 			callback.POST( | ||||||
| 				"qiniu/:key", | 				"qiniu/:sessionID", | ||||||
|  | 				middleware.UseUploadSession("qiniu"), | ||||||
| 				middleware.QiniuCallbackAuth(), | 				middleware.QiniuCallbackAuth(), | ||||||
| 				controllers.QiniuCallback, | 				controllers.QiniuCallback, | ||||||
| 			) | 			) | ||||||
|  | |||||||
| @ -149,9 +149,9 @@ func (service *PolicyService) AddCORS() serializer.Response { | |||||||
|  |  | ||||||
| 	switch policy.Type { | 	switch policy.Type { | ||||||
| 	case "oss": | 	case "oss": | ||||||
| 		handler := oss.Driver{ | 		handler, err := oss.NewDriver(&policy) | ||||||
| 			Policy:     &policy, | 		if err != nil { | ||||||
| 			HTTPClient: request.NewClient(), | 			return serializer.Err(serializer.CodeInternalSetting, "跨域策略添加失败", err) | ||||||
| 		} | 		} | ||||||
| 		if err := handler.CORS(); err != nil { | 		if err := handler.CORS(); err != nil { | ||||||
| 			return serializer.Err(serializer.CodeInternalSetting, "跨域策略添加失败", err) | 			return serializer.Err(serializer.CodeInternalSetting, "跨域策略添加失败", err) | ||||||
| @ -169,6 +169,7 @@ func (service *PolicyService) AddCORS() serializer.Response { | |||||||
| 				}, | 				}, | ||||||
| 			}), | 			}), | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if err := handler.CORS(); err != nil { | 		if err := handler.CORS(); err != nil { | ||||||
| 			return serializer.Err(serializer.CodeInternalSetting, "跨域策略添加失败", err) | 			return serializer.Err(serializer.CodeInternalSetting, "跨域策略添加失败", err) | ||||||
| 		} | 		} | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 HFO4
					HFO4