animeic 1 year ago
parent
commit
0aa4a09565
3 changed files with 7 additions and 6 deletions
  1. 2 1
      baishuihu/api/upload.go
  2. 1 1
      baishuihu/app.yaml
  3. 4 4
      baishuihu/index.html

+ 2 - 1
baishuihu/api/upload.go

@@ -9,7 +9,7 @@ import (
 )
 
 func Upload(r *GinRouter) {
-	r.GETJWT("upload/policy", UploadPolicy)
+	r.GET("upload/policy", UploadPolicy)
 }
 
 const (
@@ -23,6 +23,7 @@ func CreateClient(accessKeyId *string, accessKeySecret *string) (_result *sts201
 	config := &openapi.Config{
 		AccessKeyId:     accessKeyId,
 		AccessKeySecret: accessKeySecret,
+		Protocol:        tea.String("https"),
 	}
 	// Endpoint 请参考 https://api.aliyun.com/product/Sts
 	config.Endpoint = tea.String(STS_ADDR)

+ 1 - 1
baishuihu/app.yaml

@@ -16,7 +16,7 @@ redis:
   db: 0
 
 nats:
-  url: nats://127.0.0.1:14225
+  url: nats://127.0.0.1:4222
   # url: nats://124.71.139.24:14301
   maxReconnect: 1000
   reconnDelaySecond: 5

+ 4 - 4
baishuihu/index.html

@@ -13,10 +13,10 @@
         // yourRegion填写Bucket所在地域。以华东1(杭州)为例,yourRegion填写为oss-cn-hangzhou。
         region: "oss-cn-chengdu",
         // 从STS服务获取的临时访问密钥(AccessKey ID和AccessKey Secret)。
-        accessKeyId: "STS.NTkTKPpiTB1NVdV7wEQH3wkD4",
-        accessKeySecret: "HT3aNHuN5EKYieU8ECZCpRh98GwJLz4dchpLtAEdTmUi",
+        accessKeyId: "STS.NV7VPCCHGfMPG5xFpdNLRQ8xY",
+        accessKeySecret: "CJ4AeVxAfu7YZcynYAuG5neeoqYpx4TZJafNp3U8NoJ6",
         // 从STS服务获取的安全令牌(SecurityToken)。
-        stsToken: "CAIS9AF1q6Ft5B2yfSjIr5feH/HknbZ19fOlVELn03cQXccfmK7v1jz2IHhMfHdoCeAet/s0lGpY5vYflqZ5Qp5eRVHFbdY155hS8AX5gX99Qw/sv9I+k5SANTW5KXyShb3/AYjQSNfaZY3eCTTtnTNyxr3XbCirW0ffX7SClZ9gaKZ8PGD6F00kYu1bPQx/ssQXGGLMPPK2SH7Qj3HXEVBjt3gX6wo9y9zmm53Du0uD1QWhmr5K9tSsGPX+MZkwZqUYesyuwel7epDG1CNt8BVQ/M909vccoW+Z5oHNWwAOuEXcY7qEr8cBNgZ8YbMhC0f/YkEOchsSGoABsc0y6cqEzBt1pRDRz1781lA4wOlFriMIqNN+raBhapzZ+uGd647DJFpnpm6GqXbY8gWD2EJ4k9eGYEuK7e4kFkCJH6+UUjyT4OVJPKJCUIjZaeJE86TbzcR3a6tw6yuOsV8Knk0r7vc2ngArFBn51XPm3wUKsYn8ZH5rhCDDv24gAA==",
+        stsToken: "CAIS9AF1q6Ft5B2yfSjIr5WCHer3rpdm0Y+7RRPJonAxQsN+vv3Tuzz2IHhMfHdoCeAet/s0lGpY5vYflqZ5Qp5eRVHFbdY155hS8AX54hJsaA/sv9I+k5SANTW5KXyShb3/AYjQSNfaZY3eCTTtnTNyxr3XbCirW0ffX7SClZ9gaKZ8PGD6F00kYu1bPQx/ssQXGGLMPPK2SH7Qj3HXEVBjt3gX6wo9y9zmm53Du0uD1QWhmr5K9tSsGPX+MZkwZqUYesyuwel7epDG1CNt8BVQ/M909vccoW+Z5oHNWwAOuEXcY7qEr8cBNgZ8YbMhC0f/YkEOchsSGoABRXbZO3Bad6G/sxHKOwwOZRHsBlPNeKHc++JKUqsjtgDZ/SO67Z5dDjmCjVQ1fHN3Qme7vpvcJioxBE+ZbfovIrBLVvnP6UpktNg4h1FYLqj6ePdbGFtKhAbXTy6sWw4ed0bX/xiTQXx7jR0njhl9IaCgvxRWzDGrwmGn5ac84HEgAA==",
         // 填写Bucket名称。
         bucket: "baishuihu",
       });
@@ -40,7 +40,7 @@
             mime: "json",
             headers: { "Content-Type": "text/plain" },
           };
-          const result = await client.put("ACC/aaaa.png", data, options);
+          const result = await client.put("images/test.png", data, options);
           console.log(result);
         } catch (e) {
           console.log(e);