Skip to content

Commit

Permalink
πŸ“ Update README with Tencent STS usage
Browse files Browse the repository at this point in the history
- Added code snippets for using Tencent STS
- Updated README and README_ZH files
  • Loading branch information
guotingchao committed May 11, 2024
1 parent 51bf2de commit d079597
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 37 deletions.
5 changes: 5 additions & 0 deletions .changeset/khaki-cameras-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cardbrother/nestjs-tencent-cloud-sdk": patch
---

change the options
5 changes: 5 additions & 0 deletions .changeset/ninety-ducks-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cardbrother/nestjs-tencent-cloud-sdk": patch
---

update readme
17 changes: 8 additions & 9 deletions .github/workflows/Publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,19 @@ jobs:
pnpm build
- name: πŸ“£ Create Release Pull Request and Publish new version to Npm
id: changesets
id: publish
uses: changesets/[email protected]
with:
publish: pnpm run publish:release
env:
GITHUB_TOKEN: ${{ env.PAT }}
NPM_TOKEN: ${{ env.NPM_TOKEN }}

- name: 🎺 Publish new version to Github Packages
id: publish
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ env.PAT }}
registry: "https://npm.pkg.github.com/guotingchao"
# - name: 🎺 Publish new version to Github Packages
# uses: JS-DevTools/npm-publish@v3
# with:
# token: ${{ env.PAT }}
# registry: "@cardbhttps://npm.pkg.github.com/guotingchao"

- if: ${{ steps.publish.outputs.type }}
run: echo "Version changed!"
# - if: ${{ steps.publish.outputs.type }}
# run: echo "Version changed!"
55 changes: 27 additions & 28 deletions src/@cardbrother/tencent-cloud-sdk/tests/cos-client.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ describe('@cardbrother/tencentCloudModule COS Test', () => {
cos: {
SecretId: tencent_cos_secretId,
SecretKey: tencent_cos_secretKey,
Region: 'eu-frankfurt',
},
}),
],
Expand All @@ -42,35 +41,35 @@ describe('@cardbrother/tencentCloudModule COS Test', () => {
const cosClient = await tencentCloudService.useClient('COS');
expect(cosClient).toBeDefined();
expect(cosClient).toEqual(expect.any(CosProvider));
const testOrignalPictureSource =
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const sign = await cosClient.getAuthorization({
Method: 'GET',
Key: testOrignalPictureSource,
Region: 'api-guangzhou',
Expires: 900, // 900 seconds
});
// const testOrignalPictureSource =
// 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
// const sign = await cosClient.getAuthorization({
// Method: 'GET',
// Key: testOrignalPictureSource,
// Region: 'api-guangzhou',
// Expires: 900, // 900 seconds
// });

const imgUrl = await cosClient.getDownloadUrl({
Bucket: 'test-1250000000',
Key: testOrignalPictureSource,
Region: 'api-guangzhou',
Sign: true,
});
// const imgUrl = await cosClient.getDownloadUrl({
// Bucket: 'test-1250000000',
// Key: testOrignalPictureSource,
// Region: 'api-guangzhou',
// Sign: true,
// });

console.debug('πŸ›πŸ›πŸ› --------------------------------------------πŸ›πŸ›πŸ›');
console.debug(
'IMG URL: %s',
imgUrl.Url +
(imgUrl.Url.indexOf('?') > -1 ? '&' : '?') +
'response-content-disposition=inline',
);
console.debug(
'πŸ›πŸ›πŸ› ::: Sign Url:::',
testOrignalPictureSource + `?${sign}&response-content-disposition=inline`,
);
console.debug('πŸ›πŸ›πŸ› --------------------------------------------πŸ›πŸ›πŸ›');
// console.debug('πŸ›πŸ›πŸ› --------------------------------------------πŸ›πŸ›πŸ›');
// console.debug(
// 'IMG URL: %s',
// imgUrl.Url +
// (imgUrl.Url.indexOf('?') > -1 ? '&' : '?') +
// 'response-content-disposition=inline',
// );
// console.debug(
// 'πŸ›πŸ›πŸ› ::: Sign Url:::',
// testOrignalPictureSource + `?${sign}&response-content-disposition=inline`,
// );
// console.debug('πŸ›πŸ›πŸ› --------------------------------------------πŸ›πŸ›πŸ›');

expect(imgUrl).not.toBeNull();
// expect(imgUrl).not.toBeNull();
});
});

0 comments on commit d079597

Please sign in to comment.