├── .github └── workflows │ └── auto-changelog.yml ├── .gitignore ├── .npmignore ├── .prettierrc ├── CHANGELOG.md ├── LICENSE ├── README.md ├── babel.config.js ├── bower.json ├── csp ├── AllowAction.md ├── README.md ├── api.md ├── auth-json.php ├── csp.html ├── start.md └── test.html ├── demo ├── CIDemos │ ├── ai.js │ ├── asr.js │ ├── audit.js │ ├── common.js │ ├── docPreview.js │ ├── fileProcess.js │ ├── index.js │ ├── mediaProcess.js │ ├── meta.js │ ├── picProcess.js │ └── taskAndWorkflow.js ├── common │ ├── async.js │ ├── beacon.min.js │ ├── cls.min.js │ ├── cos-auth.js │ ├── cos-auth.min.js │ ├── jquery-3.3.1.min.js │ └── vue.min.js ├── cors.png ├── crc64.html ├── crc64.js ├── demo.js ├── empty.html ├── folder │ └── index.html ├── index.html ├── mime-limit.html ├── nextjs │ ├── package.json │ └── pages │ │ └── index.js ├── noSDK │ ├── empty.html │ ├── form_sign.html │ ├── form_sts.html │ ├── post_sign.html │ ├── post_sts.html │ ├── put_sign.html │ └── put_sts.html ├── policy-form.html ├── policy-post.html ├── post_sign.html ├── queue │ ├── index.html │ ├── index.js │ └── style.css ├── react-folder │ ├── Icons.jsx │ ├── demo-js.jsx │ ├── demo-ts.tsx │ ├── index.module.css │ └── package.json ├── slice-task.html ├── slice.html ├── sts-form.html ├── sts-post.html ├── sts-put-server-key.html ├── sts-put.html └── vueDemo │ ├── index.html │ ├── index.js │ └── vue.min.js ├── dist ├── cos-js-sdk-v5.js └── cos-js-sdk-v5.min.js ├── index.d.ts ├── index.js ├── jest.config.js ├── lib ├── base64.js ├── crypto.js ├── md5.js └── request.js ├── package.json ├── patches ├── fast-xml-parser+4.5.0.patch └── jsdom+20.0.3.patch ├── scripts └── patch-check.js ├── server └── sts.js ├── src ├── advance.js ├── async.js ├── base.js ├── cos.js ├── event.js ├── logger.js ├── session.js ├── task.js ├── tracker.js └── util.js ├── test ├── index.html ├── qunit-2.4.0.css ├── qunit-2.4.0.js ├── qunit_test.js ├── test.js └── watcher.js └── webpack.config.js /.github/workflows/auto-changelog.yml: -------------------------------------------------------------------------------- 1 | name: ChangeLog 2 | 3 | on: 4 | workflow_dispatch: 5 | release: 6 | types: [published] 7 | 8 | jobs: 9 | build: 10 | 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/setup-node@v2-beta 15 | with: 16 | node-version: '12' 17 | - uses: actions/checkout@v2 18 | with: 19 | fetch-depth: 0 20 | 21 | - name: Checkout Tool 22 | uses: actions/checkout@v2 23 | with: 24 | repository: konakonall/auto-changelog 25 | path: 'auto-changelog' 26 | - name: Build Tool 27 | run: | 28 | cd auto-changelog 29 | npm install 30 | npm link 31 | 32 | - name: Generate ChangeLog 33 | env: # Or as an environment variable 34 | TOKEN: ${{ secrets.GITHUB_TOKEN }} 35 | run: | 36 | auto-changelog --token $TOKEN 37 | - name: Cat ChangeLog 38 | run: cat CHANGELOG.md 39 | 40 | - name: Commit files 41 | env: 42 | CI_USER: "gouki0123" 43 | CI_EMAIL: "gouki0123@gmail.com" 44 | run: | 45 | git config --local user.email "$CI_EMAIL" 46 | git config --local user.name "$CI_USER" 47 | git add CHANGELOG.md && git commit -m 'Updated CHANGELOG.md' && echo "push=1" >> $GITHUB_ENV || echo "No changes to CHANGELOG.md" 48 | 49 | - name: Push changes 50 | if: env.push == 1 51 | env: 52 | CI_USER: "gouki0123" 53 | CI_TOKEN: ${{ secrets.GITHUB_TOKEN }} 54 | run: | 55 | git push "https://$CI_USER:$CI_TOKEN@github.com/$GITHUB_REPOSITORY.git" HEAD:master 56 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .vscode 3 | .nyc_output 4 | coverage 5 | node_modules 6 | package-lock.json 7 | log.txt 8 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vscode/ 3 | .github/ 4 | coverage/ 5 | csp/ 6 | demo/ 7 | test/ 8 | server/ 9 | patches/ 10 | .prettierrc 11 | CHANGELOG.md 12 | babel.config.js 13 | bower.json 14 | jest.config.js 15 | webpack.config.js -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "tabWidth": 2, 4 | "useTabs": false, 5 | "semi": true, 6 | "singleQuote": true, 7 | "jsxSingleQuote": true, 8 | "jsxBracketSameLine": true, 9 | "trailingComma": "es5" 10 | } 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-present 腾讯云 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cos-js-sdk-v5 2 | 3 | 腾讯云 COS JS SDK([XML API](https://cloud.tencent.com/document/product/436/7751)) 4 | 5 | [releases and changelog](https://github.com/tencentyun/cos-js-sdk-v5/releases) 6 | 7 | ## Get started 8 | 9 | ### 一、前期准备 10 | 11 | 1. 首先,JS SDK 需要浏览器支持基本的 HTML5 特性,以便支持 ajax 上传文件和计算文件 md5 值。 12 | 2. 到 [COS对象存储控制台](https://console.cloud.tencent.com/cos) 创建存储桶,得到 Bucket(由bucketname-appid 组成,appid必须填入) 和 [Region(地域名称)](https://cloud.tencent.com/document/product/436/6224) 13 | 3. 到 [控制台密钥管理](https://console.cloud.tencent.com/capi) 获取您的项目 SecretId 和 SecretKey 14 | 4. 配置 CORS 规则,配置例子如下图: 15 | 16 |  17 | 18 | ### 二、计算签名 19 | 20 | 由于签名计算放在前端会暴露 SecretId 和 SecretKey,我们把签名计算过程放在后端实现,前端通过 ajax 向后端获取签名结果,正式部署时请在后端加一层自己网站本身的权限检验。 21 | 22 | 这里提供 [NodeJS 的签名例子](https://github.com/tencentyun/cos-js-sdk-v5/blob/master/server/),其他语言,请参照对应的 [XML SDK](https://cloud.tencent.com/document/product/436/6474) 23 | 24 | ### 三、上传例子 25 | 26 | 1. 创建 test.html,填入下面的代码,修改里面的 Bucket 和 Region。 27 | 2. 部署好后端的签名服务,并修改 getAuthorization 里的签名服务地址 28 | 3. 把 test.html 放在 Web 服务器下,然后在浏览器访问页面,测试文件上传 29 | 30 | ```html 31 | 32 | 33 | 119 | ``` 120 | 121 | 122 | ## webpack 引入方式 123 | 124 | 支持 webpack 打包的场景,可以用 npm 引入作为模块 125 | ```shell 126 | npm i cos-js-sdk-v5 --save 127 | ``` 128 | 129 | ## Start Demo 130 | ``` 131 | 1. git clone cos-js-sdk-v5 至本地 132 | 2. cd cos-js-sdk-v5 进入根目录后执行:npm install 133 | 3. 修改 server 文件夹中 sts.js 或 sts.php 中的 secretId、secretKey、bucket、region 配置;注意allowPrefix和allowActions需要设置适当的权限 134 | 4. 修改 demo/index.html 中config的Bucket、Region 参数 135 | 5. npm run server # 用 node 启动服务 136 | 6. 浏览器输入 http://127.0.0.1:3000/ 即可进行 demo 演示 137 | ``` 138 | 139 | ## 说明文档 140 | 141 | [使用例子](demo/demo.js) 142 | 143 | [快速入门](https://cloud.tencent.com/document/product/436/11459) 144 | 145 | [接口文档](https://cloud.tencent.com/document/product/436/12260) 146 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "sourceType": "unambiguous", 3 | "presets": [ 4 | ["@babel/preset-env", 5 | { 6 | "targets": { 7 | "browsers": ["> 1%", "last 2 versions"] 8 | } 9 | } 10 | ] 11 | ], 12 | "plugins": [ 13 | "@babel/plugin-transform-runtime" 14 | ] 15 | } -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cos-js-sdk-v5", 3 | "description": "cos js sdk v5", 4 | "main": "dist/cos-js-sdk-v5.min.js", 5 | "authors": [ 6 | "carsonxu" 7 | ], 8 | "license": "ISC", 9 | "homepage": "https://github.com/tencentyun/cos-js-sdk-v5", 10 | "ignore": [ 11 | "**/.*", 12 | "node_modules", 13 | "bower_components", 14 | "test", 15 | "tests" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /csp/AllowAction.md: -------------------------------------------------------------------------------- 1 | # 允许操作的判断例子 2 | 3 | 以下按照 JavaScript 为例子,列举签名允许操作的判断规则 4 | 5 | ```js 6 | var exist = function (obj, key) { 7 | return obj[key] === undefined; 8 | }; 9 | ``` 10 | 11 | ## 分片上传 12 | 13 | ```js 14 | // multipartList 获取已有上传任务 15 | if (pathname === '/' && method === 'get' && exist(query['uploads'])) allow = true; 16 | // multipartListPart 获取单个上传任务的分片列表 17 | if (pathname !== '/' && method === 'get' && exist(query['uploadId'])) allow = true; 18 | // multipartInit 初始化分片上传 19 | if (pathname !== '/' && method === 'post' && exist(query['uploads'])) allow = true; 20 | // multipartUpload 上传文件的单个分片 21 | if (pathname !== '/' && method === 'put' && exist(query['uploadId']) && exist(query['partNumber'])) allow = true; 22 | // multipartComplete 完成一次分片上传 23 | if (pathname !== '/' && method === 'post' && exist(query['uploadId'])) allow = true; 24 | ``` 25 | 26 | ## 简单上传 27 | 28 | ```js 29 | // putObject 简单上传文件 30 | if (pathname !== '/' && method === 'put' && !exist(query['acl'])) allow = true; 31 | // postObject 允许表单上传文件 32 | if (pathname === '/' && method === 'post' && !exist(query['delete'])) allow = true; 33 | ``` 34 | 35 | ## 获取和修改权限策略 36 | 37 | ```js 38 | // getBucketAcl 获取 Bucket 权限 39 | if (pathname === '/' && method === 'get' && !exist(query['acl'])) allow = true; 40 | // putBucketAcl 修改 Bucket 权限 41 | if (pathname === '/' && method === 'put' && !exist(query['acl'])) allow = true; 42 | // getBucketPolicy 获取权限策略 43 | if (pathname === '/' && method === 'get' && !exist(query['policy'])) allow = true; 44 | // putBucketPolicy 修改权限策略 45 | if (pathname === '/' && method === 'put' && !exist(query['policy'])) allow = true; 46 | // getObjectAcl 获取 Object 权限 47 | if (pathname !== '/' && method === 'get' && !exist(query['acl'])) allow = true; 48 | // putObjectAcl 修改 Object 权限 49 | if (pathname !== '/' && method === 'put' && !exist(query['acl'])) allow = true; 50 | ``` 51 | 52 | ## 获取和修改生命周期 53 | 54 | ```js 55 | // getBucketLifecycle 获取 Bucket Lifecycle 56 | if (pathname === '/' && method === 'get' && !exist(query['lifecycle'])) allow = true; 57 | // putBucketLifecycle 修改 Bucket Lifecycle 58 | if (pathname === '/' && method === 'put' && !exist(query['lifecycle'])) allow = true; 59 | ``` 60 | 61 | ## 获取和修改 Tagging 62 | 63 | ```js 64 | // getBucketTagging 获取 Bucket Tagging 65 | if (pathname === '/' && method === 'get' && !exist(query['tagging'])) allow = true; 66 | // putBucketTagging 修改 Bucket Tagging 67 | if (pathname === '/' && method === 'put' && !exist(query['tagging'])) allow = true; 68 | // deleteBucketTagging 删除 Bucket Tagging 69 | if (pathname === '/' && method === 'delete' && !exist(query['tagging'])) allow = true; 70 | ``` 71 | 72 | ## 删除文件 73 | 74 | ```js 75 | // deleteMultipleObject 批量删除文件 76 | if (pathname === '/' && method === 'post' && !exist(query['delete'])) allow = true; 77 | // deleteObject 删除单个文件 78 | if (pathname !== '/' && method === 'delete') allow = true; 79 | ``` 80 | -------------------------------------------------------------------------------- /csp/README.md: -------------------------------------------------------------------------------- 1 | # COS JavaScript SDK CSP 使用文档 2 | 3 | [快速入门](./start.md) 4 | 5 | [API 文档](./api.md) 6 | 7 | [示例代码](./csp.html) -------------------------------------------------------------------------------- /csp/auth-json.php: -------------------------------------------------------------------------------- 1 | 关于文章中出现的 SecretId、SecretKey、Bucket 等名称的含义和获取方式请参考:[COS 术语信息](https://cloud.tencent.com/document/product/436/7751) 19 | 20 | ## 快速入门 21 | ### 计算签名 22 | 23 | 由于签名计算放在前端会暴露 SecretId 和 SecretKey,我们把签名计算过程放在后端实现,前段通过 ajax 向后端获取签名结果,正式部署时请再后端加一层自己网站本身的权限检验。其他语言,请参照对应的 [XML SDK](https://cloud.tencent.com/document/product/436/6474) 文档。 24 | 25 | 26 | ### 上传例子 27 | 28 | 1. 创建 test.html,填入下面的代码,修改里面的 Bucket 和 Region。 29 | 2. 部署好后端的签名服务,并修改 getAuthorization 里的签名服务地址。 30 | 3. 把 test.html 放在 Web 服务器下,然后在浏览器访问页面,测试文件上传。 31 | 32 | ```html 33 | 34 | 35 | 73 | ``` 74 | 75 | ## webpack 引入方式 76 | 77 | 支持 webpack 打包的场景,可以用 npm 引入作为模块 78 | ```shell 79 | npm i cos-js-sdk-v5 --save 80 | ``` 81 | -------------------------------------------------------------------------------- /demo/CIDemos/common.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 其他demo集合 3 | */ 4 | 5 | // 开通数据万象 6 | export const createCIBucket = { 7 | name: '开通数据万象', 8 | fn: function createCIBucket() { 9 | const host = `${config.Bucket}.pic.${config.Region}.myqcloud.com`; 10 | const url = `https://${host}`; 11 | cos.request( 12 | { 13 | Method: 'PUT', // 固定值,必须 14 | Url: url, // 请求的url,必须 15 | }, 16 | function (err, data) { 17 | if (err) { 18 | // 处理请求失败 19 | console.log(err); 20 | } else { 21 | // 处理请求成功 22 | console.log(data.Response); 23 | } 24 | } 25 | ); 26 | }, 27 | }; 28 | 29 | // 关闭数据万象 30 | export const deleteCIBucket = { 31 | name: '关闭数据万象', 32 | fn: function deleteCIBucket() { 33 | const host = `${config.Bucket}.pic.${config.Region}.myqcloud.com`; 34 | const url = `https://${host}`; 35 | cos.request( 36 | { 37 | Method: 'PUT', // 固定值,必须 38 | Url: url, // 请求的url,必须 39 | Action: 'unbind', // 固定值 40 | }, 41 | function (err, data) { 42 | if (err) { 43 | // 处理请求失败 44 | console.log(err); 45 | } else { 46 | // 处理请求成功 47 | console.log(data.Response); 48 | } 49 | } 50 | ); 51 | }, 52 | }; 53 | 54 | // 查询查询数据处理服务 55 | export const queryCIBucket = { 56 | name: '查询查询数据处理服务', 57 | fn: function queryCIBucket() { 58 | const host = `${config.Bucket}.pic.${config.Region}.myqcloud.com`; 59 | const url = `https://${host}`; 60 | cos.request( 61 | { 62 | Method: 'GET', // 固定值,必须 63 | Url: url, // 请求的url,必须 64 | }, 65 | function (err, data) { 66 | if (err) { 67 | // 处理请求失败 68 | console.log(err); 69 | } else { 70 | // 处理请求成功 71 | console.log(data); 72 | } 73 | } 74 | ); 75 | }, 76 | }; 77 | 78 | // 提交病毒检测任务 79 | export const postVirusDetect = { 80 | name: '提交病毒检测任务', 81 | fn: function postVirusDetect() { 82 | const host = config.Bucket + '.ci.' + config.Region + '.myqcloud.com/virus/detect'; 83 | const url = 'https://' + host; 84 | const body = COS.util.json2xml({ 85 | Request: { 86 | Input: { 87 | Object: 'test/1.png', // 文件名,取值为文件在当前存储桶中的完整名称,与Url参数二选一 88 | // Url: 'http://examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/virus.doc', // 病毒文件的链接地址,与Object参数二选一 89 | }, 90 | Conf: { 91 | DetectType: 'Virus', // 检测的病毒类型,当前固定为:Virus 92 | // CallBack: 'http://callback.demo.com', // 任务回调的地址 93 | }, 94 | }, 95 | }); 96 | cos.request( 97 | { 98 | Method: 'POST', 99 | Key: 'virus/detect', 100 | Url: url, 101 | Body: body, 102 | ContentType: 'application/xml', 103 | }, 104 | function (err, data) { 105 | if (err) { 106 | // 处理请求失败 107 | console.log(err); 108 | } else { 109 | // 处理请求成功 110 | console.log(data); 111 | } 112 | } 113 | ); 114 | }, 115 | }; 116 | 117 | // 查询病毒检测任务结果 118 | export const getVirusDetectResult = { 119 | name: '查询病毒检测任务结果', 120 | fn: function getVirusDetectResult() { 121 | const jobId = 'ssdb2dab23bcdb11ed9efb5254009411xx'; // 提交病毒检测任务后会返回当前任务的jobId 122 | const host = config.Bucket + '.ci.' + config.Region + '.myqcloud.com/virus/detect/' + jobId; 123 | const url = 'https://' + host; 124 | cos.request( 125 | { 126 | Method: 'GET', 127 | Key: 'virus/detect/' + jobId, 128 | Url: url, 129 | }, 130 | function (err, data) { 131 | if (err) { 132 | // 处理请求失败 133 | console.log(err); 134 | } else { 135 | // 处理请求成功 136 | console.log(data); 137 | } 138 | } 139 | ); 140 | }, 141 | }; 142 | 143 | // 查询防盗链 144 | export const describeRefer = { 145 | name: '查询防盗链', 146 | fn: function describeRefer() { 147 | const host = config.Bucket + '.pic.' + config.Region + '.myqcloud.com/?hotlink'; 148 | const url = 'https://' + host; 149 | cos.request( 150 | { 151 | Method: 'GET', 152 | Url: url, 153 | }, 154 | function (err, data) { 155 | if (err) { 156 | // 处理请求失败 157 | console.log(err); 158 | } else { 159 | // 处理请求成功 160 | console.log(data); 161 | } 162 | } 163 | ); 164 | }, 165 | }; 166 | 167 | // 设置防盗链 168 | export const setRefer = { 169 | name: '设置防盗链', 170 | fn: function setRefer() { 171 | const host = config.Bucket + '.pic.' + config.Region + '.myqcloud.com/?hotlink'; 172 | const url = 'https://' + host; 173 | const body = COS.util.json2xml({ 174 | Hotlink: { 175 | Url: 'https://www.example.com', // 必须,域名地址 176 | Type: 'white', // 必须,防盗链类型,white 为白名单,black 为黑名单,off 为关闭。 177 | }, 178 | }); 179 | cos.request( 180 | { 181 | Method: 'PUT', 182 | Url: url, 183 | Body: body, 184 | ContentType: 'application/xml', 185 | }, 186 | function (err, data) { 187 | if (err) { 188 | // 处理请求失败 189 | console.log(err); 190 | } else { 191 | // 处理请求成功 192 | console.log(data); 193 | } 194 | } 195 | ); 196 | }, 197 | }; 198 | -------------------------------------------------------------------------------- /demo/CIDemos/index.js: -------------------------------------------------------------------------------- 1 | import * as common from './common.js'; 2 | import * as taskAndWorkflow from './taskAndWorkflow.js'; 3 | import * as picProcess from './picProcess.js'; 4 | import * as ai from './ai.js'; 5 | import * as mediaProcess from './mediaProcess.js'; 6 | import * as docPreview from './docPreview.js'; 7 | import * as audit from './audit.js'; 8 | import * as fileProcess from './fileProcess.js'; 9 | import * as asr from './asr.js'; 10 | import * as meta from './meta.js'; 11 | 12 | // 函数集合 13 | const moduleFn = {}; 14 | // html排版 15 | const contentMap = { 16 | common: { 17 | title: 'Common', 18 | functions: [], 19 | }, 20 | taskAndWorkflow: { 21 | title: '任务和工作流', 22 | functions: [], 23 | }, 24 | picProcess: { 25 | title: '图片处理', 26 | functions: [], 27 | }, 28 | ai: { 29 | title: 'AI识别', 30 | functions: [], 31 | }, 32 | mediaProcess: { 33 | title: '媒体处理', 34 | functions: [], 35 | }, 36 | docPreview: { 37 | title: '文档预览', 38 | functions: [], 39 | }, 40 | audit: { 41 | title: '内容审核', 42 | functions: [], 43 | }, 44 | fileProcess: { 45 | title: '文件处理', 46 | functions: [], 47 | }, 48 | asr: { 49 | title: '智能语音', 50 | functions: [], 51 | }, 52 | meta: { 53 | title: '元数据', 54 | functions: [], 55 | }, 56 | }; 57 | 58 | function setContent(fnName, module, moduleName) { 59 | const { name, fn } = module[fnName]; 60 | moduleFn[fnName] = module[fnName].fn; 61 | contentMap[moduleName].functions.push({ name, fnName }); 62 | } 63 | for (let fnName in common) { 64 | setContent(fnName, common, 'common'); 65 | } 66 | for (let fnName in taskAndWorkflow) { 67 | setContent(fnName, taskAndWorkflow, 'taskAndWorkflow'); 68 | } 69 | for (let fnName in picProcess) { 70 | setContent(fnName, picProcess, 'picProcess'); 71 | } 72 | for (let fnName in ai) { 73 | setContent(fnName, ai, 'ai'); 74 | } 75 | for (let fnName in mediaProcess) { 76 | setContent(fnName, mediaProcess, 'mediaProcess'); 77 | } 78 | for (let fnName in docPreview) { 79 | setContent(fnName, docPreview, 'docPreview'); 80 | } 81 | for (let fnName in audit) { 82 | setContent(fnName, audit, 'audit'); 83 | } 84 | for (let fnName in fileProcess) { 85 | setContent(fnName, fileProcess, 'fileProcess'); 86 | } 87 | for (let fnName in asr) { 88 | setContent(fnName, asr, 'asr'); 89 | } 90 | for (let fnName in meta) { 91 | setContent(fnName, meta, 'meta'); 92 | } 93 | 94 | (function () { 95 | const container = document.querySelector('.ci-main'); 96 | const html = []; 97 | // 渲染html 98 | for (let i in contentMap) { 99 | const module = contentMap[i]; 100 | const content = `
文件名 | 29 |大小 | 30 |进度 | 31 |操作 | 32 |
{{item.Key}} | 35 |{{formatSize(item.size)}} | 36 |37 | 38 | 39 | 40 | 已完成 41 | 等待上传 42 | 校验中({{parseInt(item.hashPercent*100)}}%) 43 | 已暂停, 已传{{formatSize(item.loaded)}} 44 | 已取消 45 | {{formatSize(item.speed)}}/s, 已传{{formatSize(item.loaded)}} {{parseInt(item.percent*100)}}% 46 | | 47 |48 | 暂停 49 | 开始 50 | 删除 51 | | 52 |
暂无上传文件 | 55 |
{{item.label}} | 36 | 37 | 38 ||||
---|---|---|---|
40 | {{item.name}} 41 | {{item.name}} 42 | | 43 |{{item.Size || '-'}} | 44 |{{item.LastModified || '-'}} | 45 |46 | 下载 47 | 删除 48 | | 49 |